Skip to content

fix(acp): recover omitted channel replies - #5637

Draft
j3h7sx wants to merge 1 commit into
block:mainfrom
j3h7sx:fix/issue-5388-acp-reply-guard
Draft

fix(acp): recover omitted channel replies#5637
j3h7sx wants to merge 1 commit into
block:mainfrom
j3h7sx:fix/issue-5388-acp-reply-guard

Conversation

@j3h7sx

@j3h7sx j3h7sx commented Aug 12, 2026

Copy link
Copy Markdown

Summary

  • capture final ACP assistant messages by messageId
  • check for an agent-authored channel message at successful turn completion
  • publish the captured answer as a signed kind-9 event when the relay confirms that the turn produced no visible message
  • preserve flat top-level DMs and the triggering reply context for existing threads

Root cause

ACP sends generated assistant text through agent_message_chunk updates. Buzz Desktop shows those updates in Activity. The session/prompt result contains only a stop reason.

External ACP runtimes can finish a turn without calling buzz messages send. When that happens, the answer exists in Activity but no channel event exists for desktop or mobile clients to render.

This patch adds a harness-level delivery safety net at end_turn. An explicit agent send still wins. A relay query error or timeout skips recovery to protect against duplicate messages.

The same recovery path covers the race where a control signal arrives after the ACP prompt has already completed.

Related reports

This addresses the missing-event failure mode reported in #5388.

It complements #5635, which handles a separate desktop Inbox case where a signed NIP-10 reply exists on the relay but the DM projection omits it. The two patches have no file overlap.

Validation

  • cargo test -p buzz-acp with 743 library tests and 9 lifecycle tests passing
  • cargo clippy -p buzz-acp --all-targets -- -D warnings
  • cargo fmt -- --check
  • git diff --check

Co-authored-by: Hyung-shik Jung <jung.hyungshik@gmail.com>
Signed-off-by: Hyung-shik Jung <jung.hyungshik@gmail.com>
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.

1 participant