#1940·cc-connect

agent/acp: `agent_thought_chunk` (ACP spec) is surfaced as reply text — thinking_messages / quiet mode cannot hide reasoning

Author: paraselfCreated Sep 30, 2026Updated Sep 30, 2026

Summary

Agents that emit the ACP-schema discriminator agent_thought_chunk have their reasoning content delivered to the chat as ordinary reply text. The display controls that are supposed to hide reasoning — thinking_messages = false, mode = "compact" / "quiet", thinking_max_len — have no effect on it, because the chunk never becomes a core.EventThinking event.

Reproduced with type = "acp" + dsh --profile acp (DeepSeek Harness ACP server), but this affects any spec-compliant ACP agent.

Root cause

agent/acp/mapping.go (present on both v1.5.0 and main) dispatches on sessionUpdate:

go
switch head.SessionUpdate {
case "agent_message_chunk":
case "tool_call":
case "tool_call_update":
case "plan":
case "user_message_chunk":
default:
    // Optional vendor / future ACP shapes — best-effort text extraction.
    return mapSessionUpdateFallback(sid, head.SessionUpdate, wrap.Update)
}

agent_thought_chunk — the name used by the ACP schema (see agent_message_chunk, agent_thought_chunk, user_message_chunk) — is not a case, so it lands in the fallback. The fallback's reasoning list covers other spellings only:

go
// agent/acp/mapping.go:235
case "reasoning", "reasoning_chunk", "thinking", "agent_thinking_chunk":

Note agent_thinking_chunk (with thinking) vs the spec's agent_thought_chunk (with thought).

It therefore reaches the fallback's default branch (agent/acp/mapping.go:286, "Last resort: try to extract any text-like field from the JSON"), where content.text of the thought payload is extracted and emitted as core.EventText:

go
slog.Debug("acp: mapSessionUpdateFallback: extracted text from unknown format", ...)
return []core.Event{{Type: core.EventText, Content: t, SessionID: sessionID}}

Because it is EventText, the engine treats it as answer text and all thinking-related display settings are bypassed.

Reproduction (protocol level, no cc-connect involved)

Raw ACP frames from dsh --profile acp over stdio — initialize (protocolVersion 1) → session/new → session/prompt with the prompt 只回答两个字:收到:

json
{"sessionUpdate":"agent_thought_chunk","messageId":"…","content":{"type":"text","text":"The user asked me to respond with just two characters: \"收到\". I should comply."}}
{"sessionUpdate":"agent_message_chunk","messageId":"…","content":{"type":"text","text":"收到"}}
{"sessionUpdate":"usage_update","used":16517,"size":1000000}

The agent_thought_chunk text is the reasoning that ends up in the chat.

Two extra data points:

  • Setting the session's reasoning_effort config option to off removes the agent_thought_chunk entirely (only agent_message_chunk + usage_update remain) — confirming the chunk is the source of the visible reasoning text. (There is no way to configure reasoning_effort from cc-connect, since the ACP adapter does not implement ModelSwitcher / config options — but that is a separate topic.)
  • thinking_messages = false was set as a per-project override ([projects.display] → thinking_messages = false), verified to resolve via config.EffectiveDisplay(cfg, proj) and to be respected for genuine EventThinking events (e.g. plan updates). It simply never sees this content.

Impact

  • Reasoning is indistinguishable from the answer in the chat; users get the full chain of thought they explicitly tried to disable.
  • thinking_messages, thinking_max_len, mode = compact|quiet are all silently bypassed for ACP agents.
  • The fallback's "extract any text-like field" behaviour also means any unknown sessionUpdate carrying text becomes user-visible reply text, which is a broader correctness/privacy concern than just this one discriminator.

Suggested fix

Handle the spec name explicitly — e.g. add it to the reasoning case:

go
case "reasoning", "reasoning_chunk", "thinking", "agent_thinking_chunk", "agent_thought_chunk":

or promote it to a first-class case in the top-level switch mapping to core.EventThinking, alongside agent_message_chunk.

Worth considering separately: the fallback's last-resort text extraction could be restricted to an allowlist of known text kinds, so unknown updates are dropped (or logged) instead of being surfaced as assistant output.

Environment

  • cc-connect v1.5.0 (Homebrew, darwin/arm64); the same code is still present on main at the time of writing
  • Agent: ACP over stdio, deepseek-harness-acp 0.0.1 (dsh --profile acp), protocolVersion 1
  • Activation mode: type = "acp", cmd = "dsh", args = ["--profile", "acp"]

中文摘要

agent/acp/mapping.go 的兜底分支把 reasoning 的判别名写成了 agent_thinking_chunk,而 ACP 规范里实际是 agent_thought_chunk(详见文件 agent/acp/mapping.go:235,v1.5.0 与 main 均如此)。于是该 chunk 落到 default 分支,被「last resort 抽取任意文本字段」逻辑当成 EventText 发出去 —— thinking_messages = false、mode = compact/quiet、thinking_max_len 全部失效,用户会看到完整的思维链。建议把 agent_thought_chunk 加入 reasoning 分支(或提到顶层 switch 直接映射到 EventThinking)。