Skip to content

fix(acp): publish completed streamed replies - #7249

Open
mujtabachang wants to merge 2 commits into
block:mainfrom
mujtabachang:fix/acp-reply-fallback-4923
Open

mujtabachang wants to merge 2 commits into
block:mainfrom
mujtabachang:fix/acp-reply-fallback-4923

Conversation

@mujtabachang

Copy link
Copy Markdown

Summary

  • capture the final assistant text emitted through ACP agent_message_chunk updates
  • publish that text with the harness identity when an end_turn completes without an existing agent-authored reply
  • preserve DM, human-facing thread, and agent-only routing semantics
  • bound captured output to 64 KiB, suppress explicit silence markers, and fail closed when duplicate detection is uncertain
  • require a positive relay acceptance decision and reconcile ambiguous acknowledgements by immutable event ID

Root cause

buzz-acp consumed ACP assistant chunks only for tracing. Agents such as Hermes can complete a turn with stopReason: end_turn but cannot use the Buzz CLI because the terminal environment intentionally omits BUZZ_* credentials. Their completed text therefore never became a kind-9 reply.

The harness already owns the signing keys, so this change adds a delivery fallback at that existing credential boundary. It runs only for successfully completed human-facing turns and checks the relay for an agent-authored reply before publishing, avoiding duplicate replies from agents that did use the normal tool path.

Tests

Added regression coverage for:

  • retaining only the final post-tool assistant segment
  • cumulative capture overflow
  • DM/channel/thread destination mapping
  • explicit silence markers
  • relay rejection
  • ambiguous acknowledgement reconciliation and kind-9 thread tags

Static whitespace validation passed with git diff --check. The local scratch environment did not contain the repository toolchain, so cargo fmt, Clippy, and unit tests are delegated to this PR's CI.

No UI changes.

Related work

Closest overlapping implementation: #5811. This PR incorporates its review feedback by bounding memory, publishing only on end_turn, checking for an existing reply, preserving routing, requiring relay acceptance, reconciling uncertain sends by event ID, and never rerunning the model/tool turn.

Also reviewed #3883 and the closed #2681 while investigating the recurrence.

Fixes #4923

Capture the final ACP assistant segment and publish it through the harness
when an end_turn completes without an existing agent-authored reply.
Bound captured output, preserve human-facing thread routing, suppress
explicit silence markers, and reconcile uncertain relay acknowledgements.

Signed-off-by: Ahmed Mujtaba <mujtabachang@gmail.com>
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

🔐 Codex Security Review

Status: review required for the current range.

The current range is 0e878664b08cdf7fb2d89d940bc2aa92cdc485f7...c60c26c7597830e27ef223cb65a456cc038f8169.
A new review must complete for this exact range. When manual authorization
is required, a Block organization member must comment exactly
@buzz-security-review c60c26c7597830e27ef223cb65a456cc038f8169 to authorize a new review.
Any previous review applies only to its recorded range.

Do not publish captured text in the control-signal completion race because
the dropped prompt future also loses the actual ACP stop reason. Avoid a
clone-on-copy lint and clarify DM routing while here.

Signed-off-by: Ahmed Mujtaba <mujtabachang@gmail.com>
@mujtabachang
mujtabachang marked this pull request as ready for review September 2, 2026 17:11
@mujtabachang
mujtabachang requested a review from a team as a code owner September 2, 2026 17:11
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.

buzz-acp: hermes-agent ACP turns complete successfully but reply never publishes to the channel

1 participant