fix: deliver group/channel replies automatically when bot is @mentioned#75327
fix: deliver group/channel replies automatically when bot is @mentioned#75327dalu610 wants to merge 12 commits into
Conversation
|
Thanks for the context here. I did a careful shell check against current Current main and v2026.5.28 already implement the central visible-reply behavior: normal group/channel source replies default to automatic delivery, while explicit message-tool-only mode remains documented opt-in behavior. The PR head no longer adds a runtime delivery change beyond current main and carries broad unrelated churn, so it is not useful as a landing branch. So I’m closing this as already implemented rather than keeping a duplicate issue open. Review detailsBest possible solution: Keep the shipped automatic group/channel default and leave explicit message-tool-only room behavior as the documented opt-in path; any remaining typed-context or test cleanup should be proposed as a narrow PR without unrelated churn. Do we have a high-confidence way to reproduce the issue? No. Current main and v2026.5.28 resolve normal unconfigured group/channel source replies to automatic delivery; explicit message-tool-only suppression is now documented opt-in behavior rather than the original bug. Is this the best way to solve the issue? No. The current branch is not the best solution to land because current main already has the runtime behavior, and the remaining type/test slice is mixed with broad unrelated churn. Security review: Security review cleared: No concrete security or supply-chain regression was found; the script/template changes are unrelated churn but not a specific security issue. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 340cc2c1e41c; fix evidence: release v2026.5.28, commit e93216080aa1. |
|
Thanks for the thorough review! Both points addressed: P2 (pre-resolution bypass): Fixed in 1f131b3. Moved the P3 (documentation): Agreed — if maintainers accept the @mention exception, docs and changelog should be updated. Happy to add those in a follow-up once the product decision is made. New test: |
When the bot is directly @mentioned in a group or channel, always use 'automatic' delivery mode so users get a visible response. Without a mention, the existing message_tool_only default is preserved. This fixes the behavior where users @mention the bot in groups with groupPolicy=open but never receive a visible reply because sourceReplyDeliveryMode defaults to message_tool_only. Root cause: resolveSourceReplyDeliveryMode unconditionally returned message_tool_only for group/channel chats, ignoring WasMentioned. Changes: - Add WasMentioned to SourceReplyDeliveryModeContext type - Check WasMentioned in resolveSourceReplyDeliveryMode — return 'automatic' when true for group/channel chats - Add unit tests for @mention delivery behavior
…ested mode Discord and Slack pre-resolve sourceReplyDeliveryMode without WasMentioned context, then pass it as an explicit "requested" mode into the dispatch pipeline. Move the WasMentioned → automatic override so it applies after every mode resolution path (defaults, config, requested, native) — not just the group/channel default branch. This ensures @mentioned messages always get a visible reply, matching user expectation. Adds a test for the pre-resolution override case (requested= message_tool_only + WasMentioned=true).
Upstream removed the logger/warning infrastructure; the test assertion no longer applies and was causing a TS2304 error in CI.
Upstream reordered the resolver to return early when a requested mode is provided, which would skip the post-resolution WasMentioned override. Add the WasMentioned check inside the requested branch so Discord/Slack pre-resolution paths still get the override.
1f131b3 to
2c5d72f
Compare
|
Note: the CI failures ( ✓ unit-fast src/auto-reply/reply/source-reply-delivery-mode.test.ts (20 tests) 4ms |
This is a bug, not a privacy featureI want to push back on the "privacy-sensitive" framing from the automated review. The distinction matters: Unsolicited bot activity in groups → that's a privacy concern. A bot reading every message and responding uninvited could leak information or cause disruption. The @mention → this is the exact opposite. An @mention is an explicit handshake from the user to the bot, just like a DM. The user is actively saying "I want the bot to see this and respond." When the bot receives an @mention, runs the model, generates a reply, and then discards it silently ( The current behavior violates the basic contract of @mention: you call the bot, it processes your message, and you get nothing back. Users see "processing…" but never receive a reply. This has been reported across all platforms (#74876, #77808). This PR fixes the bug with surgical precision:
Would also suggest adding a |
This comment was marked as low quality.
This comment was marked as low quality.
# Conflicts: # src/auto-reply/reply/source-reply-delivery-mode.ts
# Conflicts: # src/logging/diagnostic.test.ts
# Conflicts: # src/auto-reply/reply/source-reply-delivery-mode.test.ts # src/auto-reply/reply/source-reply-delivery-mode.ts
|
ClawSweeper applied the proposed close for this PR.
|
Problem
Since v2026.4.27, groups and channels default
sourceReplyDeliveryModeto"message_tool_only", which suppresses all automatic reply delivery — even when the bot is directly @mentioned. The model runs and generates output, butdispatchReplyFromConfiggates on!suppressDeliveryand drops the response (replies=0).Root Cause
resolveSourceReplyDeliveryModedoes not consultctx.WasMentioned. When a user @mentions the bot in a group or channel, they expect a visible response — the same contract as a DM. But the delivery mode stays"message_tool_only"regardless.Fix
Add
WasMentionedtoSourceReplyDeliveryModeContextand check it in the group/channel branch: when the bot was directly @mentioned, override the default to"automatic". Falls through to the existing config/default path whenWasMentionedisfalseorundefined.Changes
source-reply-delivery-mode.ts: AddWasMentioned?: booleanto the context type. WhenWasMentioned === truein group/channel, forcemode = "automatic".source-reply-delivery-mode.test.ts: Add tests forWasMentioned: truein groups/channels returning"automatic",WasMentioned: falsefalling through tomessage_tool_only, andresolveSourceReplyVisibilityPolicynot suppressing delivery when mentioned.No behavioral change for non-mentioned messages — the default remains
message_tool_onlywith the existing private-delivery warning.Relates to #74876.
Before / After
Before: @mention in group →
dispatch complete (replies=0)After: @mention in group →
dispatch complete (replies=1)