fix(slack): expose sender bot status in context#97822
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 30, 2026, 1:11 PM ET / 17:11 UTC. Summary Reproducibility: yes. from source inspection. Current main computes Slack Review metrics: 1 noteworthy metric.
Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the narrow Slack sender-context fix after exact-head checks confirm the merge result remains source/test-only and keeps existing bot filtering unchanged. Do we have a high-confidence way to reproduce the issue? Yes, from source inspection. Current main computes Slack Is this the best way to solve the issue? Yes. Passing the already-computed Slack bot fact into existing sender facts is the narrow owner-boundary fix; changing core prompt rendering or adding SDK surface would duplicate existing behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f284ce3b4df7. Label changesLabel changes:
Label justifications:
Evidence reviewedWhat I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
Dependency GuardThis PR changes dependency-related files. Maintainers should confirm these changes are intentional. Changed files:
Maintainer follow-up:
|
Dependency graph changes are blockedOpenClaw does not accept dependency graph changes through PRs unless a repository admin or security explicitly authorizes the current head SHA. Dependency updates are generated internally by maintainers so external PRs cannot change the resolved graph. Detected dependency graph changes:
Auto-scrub was not attempted because this PR changes package manifest dependency graph fields:
Dependency graph changes must be reviewed by security or handled by maintainers internally. Please remove lockfile changes manually if they are not needed. To remove lockfile changes, restore them from the target branch: git fetch origin
git checkout 'origin/main' -- 'pnpm-lock.yaml'
git commit -m 'chore: remove dependency lockfile change'
git pushIf this PR intentionally needs a dependency graph change, ask a repository admin or member of The action will approve the current head SHA ( |
|
Merged via squash.
|
* fix(slack): expose sender bot status in context * fix(slack): expose sender bot status in context --------- Co-authored-by: Vincent Koc <[email protected]>
* fix(slack): expose sender bot status in context * fix(slack): expose sender bot status in context --------- Co-authored-by: Vincent Koc <[email protected]>
* fix(slack): expose sender bot status in context * fix(slack): expose sender bot status in context --------- Co-authored-by: Vincent Koc <[email protected]>
* fix(slack): expose sender bot status in context * fix(slack): expose sender bot status in context --------- Co-authored-by: Vincent Koc <[email protected]>
* fix(slack): expose sender bot status in context * fix(slack): expose sender bot status in context --------- Co-authored-by: Vincent Koc <[email protected]> (cherry picked from commit 5c4e478)
* fix(slack): expose sender bot status in context * fix(slack): expose sender bot status in context --------- Co-authored-by: Vincent Koc <[email protected]> (cherry picked from commit 5c4e478)
Prompt request: Make the Slack channel forward sender bot status into the inbound agent context so an operator running
allowBotscan tell a bot sender from a human, matching what Telegram already exposes, while preserving existing bot detection and filtering.What Problem This Solves
Slack already detects whether an inbound message was authored by a bot (
message.bot_id) and uses that for loop protection, but it never forwards the fact to the agent. WithallowBots: true(or"mentions"), a bot-authored message reaches the agent indistinguishable from a human one: the "Sender (untrusted metadata)" block in the prompt has nois_botfield. Operators wiring bot-to-bot or integration flows on Slack therefore cannot have the agent treat bot senders differently, even though Telegram exposes this today.Why This Change Was Made
The shared inbound context already carries sender bot status end-to-end:
buildChannelInboundEventContextmapssender.isBottoSenderIsBot, which renders asis_botin the untrusted sender metadata block. Telegram populates it; Slack computes the same signal (isBotMessage = Boolean(message.bot_id)) but does not pass it through. This change forwards that existing flag into thesenderobject Slack already builds, so no core or SDK change is needed. This PR only changes the Slack adapter's inbound context assembly and its tests.User Impact
Operators with
allowBotsenabled now see"is_bot": truein the untrusted sender metadata for bot-authored Slack messages, letting their agent or system prompt branch on sender type (for example, not auto-replying to other bots). Human messages are unaffected — the field is simply absent. There is no change whenallowBotsis off, where bot messages are still filtered as before.Evidence
Direct production-path run via
node --import tsx— real production functions with no mocked I/O, not a vitest or CI run (and not a full live Slack network smoke): the Slack inbound pathprepareSlackMessageand the prompt rendererbuildInboundUserContextPrefixwere invoked directly for an admitted bot-authored room message (allowBots: true, explicit owner present) and a human DM. Redacted terminal output of the agent-visibleSender (untrusted metadata)block:The admitted bot message reaches the agent prompt with
is_bot: truein the untrusted sender metadata; the human message omits the field. The same bot and human behavior is also asserted by focused unit tests inprepare.test.ts.