fix: preserve slack mention source metadata#79046
Conversation
|
Codex review: needs changes before merge. Summary Reproducibility: yes. source-level: current main computes explicit Slack mention and implicit thread wake facts but prompt-visible context only receives was_mentioned. The linked issue at #79025 also includes a concrete Slack incident from version 2026.5.5. Real behavior proof Next step before merge Security Review findings
Review detailsBest possible solution: Land the additive Slack metadata carry-through after removing the unrelated Canvas hash drift and keeping the targeted Slack and prompt metadata checks green. Do we have a high-confidence way to reproduce the issue? Yes, source-level: current main computes explicit Slack mention and implicit thread wake facts but prompt-visible context only receives was_mentioned. The linked issue at #79025 also includes a concrete Slack incident from version 2026.5.5. Is this the best way to solve the issue? Yes for the Slack code path: additive carry-through preserves existing WasMentioned and mention-gating behavior while exposing the missing source metadata. The branch is not merge-ready as-is because the unrelated Canvas generated hash should be removed. Full review comments:
Overall correctness: patch is incorrect Acceptance criteria:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 56fe64e8e369. |
e935cdc to
d6783d5
Compare
|
@hera8939 Thanks for the PR. The overall direction looks right butI think this needs a couple changes before merge:
After explicit bot/subteam handling, I think the guidance should apply when the turn is not addressed to the bot, such as when I'd prioritize
|
Summary
WasMentionedboolean.explicitly_mentioned_bot,mentioned_user_ids,mentioned_subteam_ids,implicit_mention_kinds, andmention_source.Linked Issue/PR
Fixes #79025
Real behavior proof
Behavior or issue addressed: Slack thread messages that implicitly wake OpenClaw can now show whether the bot was explicitly mentioned or another Slack user was mentioned, instead of exposing only
was_mentioned: true.Real environment tested: Local OpenClaw checkout on Node 22 with the production inbound prompt metadata renderer.
Exact steps or command run after this patch:
Evidence after fix:
{ "chat_id": "channel:C0AHZFCAS1K", "message_id": "1777244714.000100", "sender_id": "U_BEK", "sender": "U_BEK", "is_group_chat": true, "was_mentioned": true, "explicitly_mentioned_bot": false, "mentioned_user_ids": [ "UOTHER" ], "implicit_mention_kinds": [ "reply_to_bot" ], "mention_source": "implicit_thread" }Observed result after fix: The conversation metadata keeps
was_mentioned: truewhile also exposingexplicitly_mentioned_bot: false, the explicit Slack user targetUOTHER, the implicit thread wake kindreply_to_bot, andmention_source: "implicit_thread".What was not tested: A live Slack workspace Socket Mode event was not sent in this local validation; the Slack prepare path is covered by the added regression test.
Root Cause
Slack computed explicit mention and implicit thread wake facts during message preparation, but only wrote the final collapsed
WasMentionedvalue into the inbound context and prompt metadata.Regression Test Plan
pnpm test extensions/slack/src/monitor/message-handler/prepare.test.ts src/auto-reply/reply/inbound-meta.test.tspnpm lint:extensions -- extensions/slack/src/monitor/message-handler/prepare.tsgit diff --checkUser-visible / Behavior Changes
Slack agents can distinguish direct bot mentions, user-group mentions, mention-pattern wakes, and implicit thread wakes from the inbound prompt metadata. Existing mention-gating behavior is unchanged.
Security Impact
No new permissions or auth bypass. The new fields are provider metadata derived by OpenClaw and rendered as untrusted conversation metadata alongside existing Slack ids.
Human Verification
Verified locally with targeted tests, extension lint,
git diff --check, and a real OpenClaw prompt metadata rendering command.Review Conversations
None.
Compatibility / Migration
Additive context fields only; existing
WasMentionedbehavior remains intact.Risks and Mitigations
Risk is limited to additional Slack mention metadata in prompts. Tests cover the implicit thread wake with another-user mention, user-group mention metadata, and prompt rendering.