fix(acp): answer owner DMs without an explicit @mention#2777
Open
webdevtodayjason wants to merge 1 commit into
Open
fix(acp): answer owner DMs without an explicit @mention#2777webdevtodayjason wants to merge 1 commit into
webdevtodayjason wants to merge 1 commit into
Conversation
In a 1:1 DM the agent required an @mention on every message: the mention gate (require_mention) was applied uniformly to every channel, DM included, at both the relay subscription filter (drops untagged events before delivery) and match_event (re-checks the p-tag). A DM is addressed to the counterparty by definition, so this made agents look unresponsive to their own owner. Exempt the gate for owner-authored DM events — computed as is_dm && author == owner and threaded to match_event as mention_exempt, with the DM channels' subscription filter dropping the #p requirement. Scoped to the owner so agent-to-agent DM messages still require a mention, preserving the block#2270 anti-loop invariant. Group channels are unchanged. DM turns are already restricted to owner + verified siblings (block#2591), so this does not expose agents to third-party prompting. Closes block#2747. Signed-off-by: webdevtodayjason <jason@webdevtoday.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2747.
Problem
In a 1:1 DM with a managed agent, the agent ignored every message unless it was explicitly
@-mentioned — even though a DM has exactly two participants and is addressed to the counterparty by definition. The result: agents look unresponsive to their own owner in DMs.The mention gate (
require_mention) was applied uniformly to every channel, DM included, at two levels:config.rs): the relay-side#pfilter dropped untagged events before they were ever delivered to the harness.match_event(filter.rs): re-checked the agent'sptag; no match → dropped.Dropping only the subscription filter is insufficient —
match_eventwould still drop the delivered-but-untagged DM. Both levels have to be exempted together.Fix
Exempt the mention gate for owner-authored DM events:
mention_exempt = is_dm && author == ownerand threads it intomatch_event, which skipsrequire_mentionwhen set.#prequirement so the events are delivered in the first place.setup_modeopts out (keeps its own mention requirement).Why owner-scoped, not a blanket DM exemption: exempting all DM events would let two agents in a DM trigger each other with no mention, re-creating the thread-deafness loop that #2270 is about. Scoping to the owner means the human's DM messages auto-trigger the agent while agent-to-agent DM still requires an explicit mention — preserving the anti-loop invariant. Group channels are unchanged.
Safety: DM turns are already restricted to the owner and verified siblings (#2591), so this does not open agents to third-party prompting.
Tests
filter.rs: an owner-authored DM event with noptag now matches (agent responds); a group-channel event with noptag still does NOT match (gate preserved); a non-owner DM event still requires a mention.config.rs: the DM subscription filter drops#p; non-DM channels keep it.cargo test -p buzz-acp→ 611 passed,cargo clippy -p buzz-acp --all-targets -- -D warnings→ 0 warnings.Sibling PR: the DM reply-anchor fix (#2748) is up alongside this. Related open issue: #2270 (thread deafness in group channels), a distinct but adjacent case.
Checklist
cargo test -p buzz-acp+ clippy greenunwrap()in production pathsunsafe