Skip to content

fix(acp): answer owner DMs without an explicit @mention#2777

Open
webdevtodayjason wants to merge 1 commit into
block:mainfrom
webdevtodayjason:fix/acp-dm-mention-gate
Open

fix(acp): answer owner DMs without an explicit @mention#2777
webdevtodayjason wants to merge 1 commit into
block:mainfrom
webdevtodayjason:fix/acp-dm-mention-gate

Conversation

@webdevtodayjason

Copy link
Copy Markdown

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:

  • Subscription filter (config.rs): the relay-side #p filter dropped untagged events before they were ever delivered to the harness.
  • match_event (filter.rs): re-checked the agent's p tag; no match → dropped.

Dropping only the subscription filter is insufficient — match_event would still drop the delivered-but-untagged DM. Both levels have to be exempted together.

Fix

Exempt the mention gate for owner-authored DM events:

  • The caller computes mention_exempt = is_dm && author == owner and threads it into match_event, which skips require_mention when set.
  • DM channels' subscription filter drops the #p requirement so the events are delivered in the first place.
  • setup_mode opts 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 no p tag now matches (agent responds); a group-channel event with no p tag 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.
  • Full gate green: 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 green
  • Bug fix includes regression tests
  • No new unwrap() in production paths
  • No new unsafe

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>
@webdevtodayjason
webdevtodayjason requested a review from a team as a code owner July 24, 2026 22:37
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: agents ignore DMs unless explicitly @mentioned — mention gate has no DM exemption

1 participant