Skip to content

Add ACP dialect hook to normalize tool call progress events - #6769

Merged
ymichael merged 2 commits into
get-bb:mainfrom
dpolishuk:fix/acp-normalize-tool-call-event
Nov 2, 2026
Merged

ymichael merged 2 commits into
get-bb:mainfrom
dpolishuk:fix/acp-normalize-tool-call-event

Conversation

@dpolishuk

@dpolishuk dpolishuk commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Human comments

What was wrong

Kimi Code CLI streams tool call arguments as cumulative JSON snapshots in ACP tool_call_update content text, before it sends rawInput. bb rendered those snapshots as command output and subagent progress. normalizeCommandEvent only covered command output, and it saw only the update being translated, so a dialect could not tell an argument snapshot from real output (both are in_progress text updates without rawInput) without keeping its own per-call state. Recorded ACP evidence: #6768.

What changed

  • Add the optional AcpDialect.normalizeToolCallEvent hook, applied before progress-text extraction and generic close result extraction. Command output continues to use normalizeCommandEvent.
  • Both hooks now receive (event, call): the update being translated, and everything the agent has reported for that tool call so far (the translator's merged state, this update included). They are the same event when a call closes. A dialect can judge an update by call.rawInput, so no per-call state lives in the shared dialect object and bb needs no extra lifecycle signals to clean it up. This deviates from the single-argument hook proposed in ACP: tool call argument JSON leaks into command output and subagent progress (no dialect hook for non-command progress text) #6768 and replaces the earlier forced-terminal-status and provider-error drain commits.
  • Document both hooks in the SDK's dialect section and bump the plugin SDK to 0.6.114. No wire or CLI surface changes; HOST_DAEMON_PROTOCOL_VERSION is unchanged.

Compatibility: one-argument implementations (opencode, the current Kimi normalizer) still type-check and run. Code that calls a hook directly through AcpDialect with one argument, such as a dialect's own tests, must now pass the call too.

How you verified

  • Repro on main: a translator replay of Kimi's sequence (argument snapshots, rawInput echo, real output) emitted {"prompt": "Compute, {"command":"echo hello-probe"} and similar as item.progress / command.outputSnapshot.
  • New translator tests drive a stateless argument-echo dialect through a subagent call, a Bash call whose real output is JSON, and a call left open when the turn ends mid-arguments. Only real output is shown, and the forced close carries no result text. Passing the bare update instead of the call fails the first two tests.
  • pnpm exec turbo run test typecheck lint --filter=@bb/provider-bridge-acp --filter=@get-bb/plugin-sdk passes.
  • CI on df3596b: 44 passed, 5 skipped, 0 failed.

Fixes #6768

🤖 Generated with Claude Code

AGENT GENERATED

Copilot AI balanced review requested due to automatic review settings October 31, 2026 08:01
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-31T08:09:45.439396Z
We couldn’t complete this review. Comment @codex review to try again.
7aadf74 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The reviewer completed the assessment and identified no concrete issues to comment on across the scoped, additive change.

No open issues 🎉

What changed in this PR

This PR adds a new optional normalizeToolCallEvent hook to the AcpDialect interface so a provider dialect can filter or rewrite the progress/output text of non-command ACP tool calls. It addresses issue #6768, where Kimi Code CLI streams cumulative tool-call argument JSON as tool_call_update content text that bb previously surfaced verbatim as subagent progress and generic result text. The existing normalizeCommandEvent hook only covered the command-output path, leaving non-command progress text unfilterable by plugins through the published SDK. The hook is applied before extractAcpToolCallOutputText in the tool_call_update progress path and in genericCloseFields, so dialects observe both in-progress and terminal updates; the command path is unchanged.

Changes:

  • Add normalizeToolCallEvent?(event) to AcpDialect and invoke it in the ACP delta translator's non-command progress and generic-close paths.
  • Add three tests covering suppression, rewriting, and generic-close result filtering.
  • Bump the plugin SDK to 0.6.110 (both package.json and plugin-sdk-version.ts) so the runtime change ships via the publish-if-missing job.
File Description
packages/​provider-bridge-acp/​src/​dialect.ts Declares the new optional normalizeToolCallEvent hook on AcpDialect.
packages/​provider-bridge-acp/​src/​delta-translation.ts Applies the hook before output-text extraction in the progress path and genericCloseFields.
packages/​provider-bridge-acp/​src/​delta-translation.test.ts Adds tests for suppression, rewrite, and generic-close filtering of the new hook.
packages/​plugin-sdk/​package.json Bumps the published SDK version to 0.6.110.
packages/​domain/​src/​plugin-sdk-version.ts Bumps PLUGIN_SDK_VERSION to 0.6.110 to stay in sync with the manifest.

Review effort: Balanced

@dpolishuk

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

An unknown error occurred
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

dpolishuk and others added 2 commits November 2, 2026 14:21
normalizeCommandEvent and normalizeToolCallEvent now receive the call as
well as the update: everything the agent has reported for the tool call
so far, this update included. A dialect can tell argument echo from real
output by the call's rawInput without keeping per-call state in the
shared dialect object, so bb needs no extra lifecycle signals to clean
that state up, and a call closed before its arguments finish no longer
leaks a partial argument snapshot as its result.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ymichael
ymichael force-pushed the fix/acp-normalize-tool-call-event branch from 8913f8a to df3596b Compare November 2, 2026 22:34
@ymichael
ymichael merged commit 4b2b728 into get-bb:main Nov 2, 2026
50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ACP: tool call argument JSON leaks into command output and subagent progress (no dialect hook for non-command progress text)

3 participants