Skip to content

fix(acp): wake agents for mentions added by edits - #6131

Open
loganj wants to merge 1 commit into
fix/edit-message-agent-mentionsfrom
larry/pr-4741-activation
Open

loganj wants to merge 1 commit into
fix/edit-message-agent-mentionsfrom
larry/pr-4741-activation

Conversation

@loganj

@loganj loganj commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

🤖

Summary

Agents currently subscribe to original messages by default, so editing a message to add an agent mention does not wake the newly mentioned agent. This change activates edit mentions on top of the routing foundation in #4741.

  • Adds stream-message edits (kind:40003) to the default actionable-mention kinds at startup, on dynamically discovered channels, and in setup mode.
  • Preserves explicit --kinds and config-rule overrides.
  • Relies on Desktop's newly-added-recipient p tags, so ordinary edits do not re-wake an agent.
  • Documents the default kind set in the ACP README on this PR branch.

Stack position

2 of 3 — default activation, based on #4741 (fix/edit-message-agent-mentions).

Previous: #4741. Next: #6132 (native steer and lifecycle fencing).

Related issue

None found. Split from #4741's original combined scope.

Testing

  • cargo test -p buzz-acp --all-targets — one unrelated idle_resets_on_stdout_activity timing failure; isolated rerun passed
  • cargo check -p buzz-acp

@loganj
loganj changed the base branch from larry/pr-4741-foundation to fix/edit-message-agent-mentions August 17, 2026 15:03
@loganj
loganj marked this pull request as ready for review August 19, 2026 11:12
@loganj
loganj requested a review from a team as a code owner August 19, 2026 11:12
@loganj
loganj force-pushed the larry/pr-4741-activation branch 4 times, most recently from ff25d69 to 4a6fe5c Compare August 19, 2026 14:45
Include kind:40003 in the default mention subscriptions across normal, dynamic-channel, and setup listeners. Preserve explicit kind overrides and document the actionable default.

Signed-off-by: npub1em3jmyn4vu57urqf03txrwreccvejvwdy5c4er8nnrwt7rc4tncscs3ssu <cee32d92756729ee0c097c5661b879c6199931cd25315c8cf398dcbf0f155cf1@buzz.block.builderlab.xyz>
(cherry picked from commit 7ad7d79)
Signed-off-by: Larry <8cf5a83f590ec0955b11647d1c88f796a98e088c30a492c58e0e46c3026ae7a4@buzz.block.builderlab.xyz>
@loganj
loganj force-pushed the fix/edit-message-agent-mentions branch from 81f8baf to d4ed2d5 Compare August 19, 2026 15:07
@loganj
loganj force-pushed the larry/pr-4741-activation branch from 4a6fe5c to 681ae2c Compare August 19, 2026 15:07

@jedwards27 jedwards27 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Verdict: REQUEST CHANGES

Reviewed: d4ed2d5d3a49067d61049fff79de62b7ab0d4a78..681ae2c4d34dccf1adb9fb82908fd9eb88fcf3d1 (exact live head verified immediately before submission)

Risk: High — this changes agent wake admission across relay subscription, local rule matching, queue/prompt delivery, and setup-mode nudging.

Blocking finding

The new regression assertions do not protect both production admission seams needed for the advertised behavior. Two causal mutations independently restored the old failure while the full package suite remained green:

  1. Removing kind 40003 from the normal startup rule at crates/buzz-acp/src/lib.rs:2099-2106 still left cargo test -p buzz-acp green (830 unit + 9 integration, 0 failed). Relay subscription admission remained enabled via resolve_channel_filters, but filter::match_event later dropped the edit at lib.rs:2922.
  2. Removing kind 40003 from the setup subscription rule construction at crates/buzz-acp/src/setup_mode.rs:529-535 also left the same full suite green (830 + 9, 0 failed). is_setup_nudge_kind accepted the event, but filter::match_event at setup_mode.rs:449 dropped it.

The added tests cover the shared kind helper/dynamic filter and setup kind predicate independently, not the production compositions that must both admit the event. Consequently, the exact regression this PR fixes can return with green tests.

Author action: Add causal behavioral coverage through the normal listener and setup listener production seams, or extract a single tested admission seam used by each. Prove that a kind 40003 edit carrying the agent's newly-added p tag reaches queue/prompt and setup nudge respectively, while an edit without that p tag does not wake. Mutation-removing each production inclusion must fail the intended assertion.

Verification owner: Author runs the causal mutations; reviewer/tooling reruns the full cargo test -p buzz-acp suite and confirms each mutant fails for the intended assertion.

Contracts traced / non-blocking results

No separate runtime, security, or product defect was found. The implementation centralizes actionable mention defaults while preserving explicit --kinds and config-rule overrides (config.rs:1277-1323, lib.rs:2099-2111, setup_mode.rs:516-559). Subscriptions remain channel- and recipient-scoped, and local matching requires the exact agent p tag (relay.rs:3213-3245, filter.rs:352-396). Desktop emits edit p tags only for newly added mentions, so ordinary and removal edits do not re-wake agents (desktop/src/features/messages/ui/submitMessageEdit.ts:97-136, hooks.ts:762-801, desktop/src-tauri/src/events.rs:357-381). Existing routing resolves and signature-checks the original, isolates edit batches, and anchors prompt/reactions to the visible original (pool.rs:3353-3391, queue.rs:335-369,1544-1559,1698-1773); relay ingest enforces same-channel edit ownership (buzz-relay/src/handlers/ingest.rs:918-997,2491-2495). This aligns with the repository's Nostr-first, channel-scoped agent model.

Validation

At exact head 681ae2c4d34dccf1adb9fb82908fd9eb88fcf3d1, clean worktree:

  • cargo test -p buzz-acp: PASS — 830 unit + 9 integration, 0 failed.
  • cargo fmt --all -- --check: PASS.
  • cargo clippy -p buzz-acp --all-targets -- -D warnings: PASS.
  • Both production-seam mutants above: package suite incorrectly PASS, establishing the test defect.
  • GitHub required checks at this head: green/skipped as expected; no PR-caused gate failure observed.

Manual/native evidence: No live Desktop → isolated relay → real ACP child workflow was run.

Residual risk / confidence gap: After test repair, reviewer/integration tooling should exercise: original unmentioned message → edit adds agent mention → exactly one turn anchored to the original; then typo edit and mention removal → zero further turns. This live-workflow gap is not itself author rework; the blocking item is the mutation-proven regression-test blind spot above.

— :bot: Jude’s code review agent

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.

2 participants