Repository navigation
Description
Summary
After DCP compression runs in a long, tool-heavy session on Kimi K3 (moonshotai/kimi-k3 via OpenRouter), subsequent turns intermittently fail with the provider error Kimi K3 tool messages need a resolvable tool name: carry \tool`/`name`, or match a preceding assistant tool_call by order`. The turn is fully blocked; resending the same user message usually succeeds.
Environment
- opencode version: 2.0.32
- OS: Linux 7.0.0-31-generic x86_64 (Ubuntu)
- Terminal: tmux (TERM=xterm-256color, COLORTERM=truecolor)
- Shell: /bin/bash
- Install/channel: latest
- Active plugins: @tarquinen/opencode-dcp@latest
- Model: moonshotai/kimi-k3 (OpenRouter)
Reproduction
- Run OpenCode v2.0.32 with
@tarquinen/opencode-dcp@latestand modelmoonshotai/kimi-k3. - Run a long session with many tool calls (shell/read/edit), so that the agent invokes DCP
compressseveral times. Compressed blocks are created; some retain "protected tools" outputs (the block notes "The following protected tools were used in this conversation as well", e.g. askilltool result). - Continue working after a compression event.
Observed: 3 failures in a single session, each on a turn following a DCP compression.
Expected Behavior
After compression, the assembled provider history must never contain a tool-role message whose matching assistant tool_call was summarized away (nor an assistant tool_call whose results were removed). Every tool message must resolve by name or by order, as strict chat-template renderers require.
Actual Behavior
The request fails with:
Error: Kimi K3 tool messages need a resolvable tool name: carry `tool`/`name`, or match a preceding assistant tool_call by order
The whole turn is rejected; no partial output is produced.
Additional Context
- The error string comes from the Kimi K3 chat-template renderer (e.g.
vllmrust/src/chat/src/renderer/kimi_k3/encoding.rs; same string inmlx-vlm,llm-compressor). It strictly validates that every tool message resolves to a tool name. - Hypothesis: when a compressed block retains protected-tool outputs but the assistant message carrying the matching
tool_callis replaced by the compression summary, the expanded history contains orphaned tool messages, which Kimi K3 rejects. (Atool_call/toolpair split across a compression boundary would produce the same pattern.) - Same failure pattern in other stacks: issue: Repeated tool-call ids across rounds drop a function_call and leave an orphaned tool message, permanently breaking the chat open-webui/open-webui#28570 (orphaned tool message permanently breaks chat), Fork-context children inherit dangling tool_calls; strict OpenAI-compat servers (Kimi K3) reject the forked history nicobailon/pi-subagents#1956 (Kimi K3 rejects dangling tool_calls).
- Session-side workaround: avoid further compressions; retry the blocked turn.
Activity
Tarquinen commentedon Nov 16, 2026
Fixed in #683 (merged into dev). It will ship in the next release.