Skip to content

slack: enforce reaction notification policy [AI]#80907

Merged
pgondhi987 merged 5 commits into
openclaw:mainfrom
pgondhi987:fix/fix-607
May 12, 2026
Merged

slack: enforce reaction notification policy [AI]#80907
pgondhi987 merged 5 commits into
openclaw:mainfrom
pgondhi987:fix/fix-607

Conversation

@pgondhi987
Copy link
Copy Markdown
Contributor

Summary

  • Problem: Slack reaction webhook handling could queue reaction events after base authorization without applying the configured reaction notification policy.
  • Why it matters: Operators expect reactionNotifications and reactionAllowlist to control which reaction events can reach the agent event queue.
  • What changed: Added a Slack reaction notification gate for off, own, all, and allowlist modes before queueing system events.
  • What did NOT change (scope boundary): Slack signature validation, base sender/channel authorization, config schema, manifests, and non-reaction Slack handling were not changed.

AI-assisted: Yes.

Change Type

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • None included in public PR text.
  • This PR addresses a bug or regression

Real Behavior Proof

  • Behavior or issue addressed: Slack reaction events now apply the configured reaction notification mode before entering the agent event queue.
  • Real environment tested: Not run in this constrained drafting step.
  • Exact steps or command run after this patch: Not run; the supervisor requested no package or shell verification commands for this metadata step.
  • Evidence after change: Regression coverage was added in extensions/slack/src/monitor/events/reactions.test.ts; command output was not collected.
  • Observed result after change: Static review confirms the handler checks off, own, and allowlist before enqueueSystemEvent(...).
  • What was not tested: Live Slack webhook delivery and local test execution.
  • Before evidence: Not collected in this step.

Root Cause

  • Root cause: The Slack reaction handler reused the generic system-event authorization path but did not apply the dedicated reaction notification policy before queueing.
  • Missing detection / guardrail: Existing reaction tests covered sender/channel authorization, but not the reaction notification modes.
  • Contributing context (if known): The monitor context already carried reactionMode and reactionAllowlist, but the handler did not consume them.

Regression Test Plan

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file: extensions/slack/src/monitor/events/reactions.test.ts
  • Scenario the test should lock in: off drops reaction events, own only allows reactions on bot-authored messages, and allowlist only allows configured reaction senders.
  • Why this is the smallest reliable guardrail: The regression is isolated to the Slack reaction event handler before system-event enqueueing.
  • Existing test that already covers this (if any): Existing tests covered base DM/channel authorization only.
  • If no new test is added, why not: N/A

User-visible / Behavior Changes

Slack reaction webhook events now honor reactionNotifications and reactionAllowlist before reaching the agent system-event queue.

Diagram

Before:
Slack reaction event -> base sender/channel auth -> queue system event

After:
Slack reaction event -> base sender/channel auth -> reaction notification policy -> queue or drop

Security Impact

  • New permissions/capabilities? (Yes/No): No
  • Secrets/tokens handling changed? (Yes/No): No
  • New/changed network calls? (Yes/No): No
  • Command/tool execution surface changed? (Yes/No): No
  • Data access scope changed? (Yes/No): Yes, reduced
  • If any Yes, explain risk + mitigation: Reaction event text is now suppressed before queueing when the configured Slack reaction policy denies it. This narrows event flow and does not expand access.

Repro + Verification

Environment

  • OS: Not run in this step
  • Runtime/container: Not run in this step
  • Model/provider: N/A
  • Integration/channel (if any): Slack
  • Relevant config (redacted): reactionNotifications modes off, own, all, and allowlist

Steps

  1. Configure Slack reaction notification mode.
  2. Send a Slack reaction_added or reaction_removed event that passes base sender/channel authorization.
  3. Observe whether a system event is queued according to the configured reaction policy.

Expected

  • Denied reaction modes do not queue system events.
  • Allowed reaction modes continue to queue system events after base authorization.

Actual

  • Not run in this step; covered by added unit test scenarios.

Evidence

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

No command evidence collected in this constrained step.

Human Verification

  • Verified scenarios: Reviewed the handler path and added regression cases for off, own, and allowlist.
  • Edge cases checked: Empty reaction allowlist fails closed; own mode requires the reacted message author to be the Slack bot user.
  • What you did not verify: Live Slack delivery and package test execution.

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

Compatibility / Migration

  • Backward compatible? (Yes/No): Yes
  • Config/env changes? (Yes/No): No
  • Migration needed? (Yes/No): No
  • If yes, exact upgrade steps: N/A

Risks and Mitigations

  • Risk: own mode depends on Slack reaction events carrying the original message author.
    • Mitigation: The handler fails closed for own mode when the bot-authored message condition is not met, and existing all mode remains available for deployments that intentionally want broader reaction notifications.

@openclaw-barnacle openclaw-barnacle Bot added channel: slack Channel integration: slack size: S maintainer Maintainer-authored PR labels May 12, 2026
@clawsweeper
Copy link
Copy Markdown
Contributor

clawsweeper Bot commented May 12, 2026

Codex review: needs real behavior proof before merge.

Summary
Adds a Slack reaction notification gate and tests so reaction events honor reactionNotifications and reactionAllowlist before queueing system events.

Reproducibility: yes. From source inspection, current main reads the Slack reaction policy into context but the reaction handler queues authorized reaction system events without checking it; a focused harness can set off, own, or allowlist and observe queue calls.

Real behavior proof
Needs real behavior proof before merge: The PR body says the changed behavior was not run in a real environment and provides no terminal output, logs, live Slack proof, screenshot, recording, or linked artifact. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, ask a maintainer to comment @clawsweeper re-review.

Next step before merge
The remaining blockers are contributor real behavior proof and explicit maintainer handling for the protected label, not an automation-repairable code defect.

Security
Cleared: The diff narrows Slack reaction event flow and does not add dependencies, workflow changes, secret handling, network calls, or execution surface.

Review details

Best possible solution:

Merge the narrow Slack handler fix after redacted real behavior proof is added and a maintainer approves the protected Slack policy change.

Do we have a high-confidence way to reproduce the issue?

Yes. From source inspection, current main reads the Slack reaction policy into context but the reaction handler queues authorized reaction system events without checking it; a focused harness can set off, own, or allowlist and observe queue calls.

Is this the best way to solve the issue?

Yes, subject to proof. Gating in the Slack reaction handler with the existing allowlist helper before enqueueSystemEvent(...) is the narrow maintainable fix without changing schema or manifests.

What I checked:

Likely related people:

  • steipete: Recent commit history for Slack reaction, provider, and test paths shows repeated Slack monitor/runtime changes, including moving Slack system events onto the channel runtime and adjacent Slack handler/test refactors. (role: recent area contributor; confidence: high; commits: d83e3afc5642, f0000ab72d01, a0fb7fb04547; files: extensions/slack/src/monitor/events/reactions.ts, extensions/slack/src/monitor/events/reactions.test.ts, extensions/slack/src/monitor/provider.ts)
  • pgondhi987: Beyond authoring this PR, prior merged Slack provider work by this account touched adjacent Slack allowlist/runtime behavior. (role: recent adjacent contributor; confidence: medium; commits: b895c6d939fe; files: extensions/slack/src/monitor/provider.ts)
  • scoootscooob: Moved Slack channel implementation files under extensions/slack/src/, which explains the current file location but is less specific to reaction policy behavior. (role: migration contributor; confidence: low; commits: 8746362f5ebf; files: extensions/slack/src/monitor/events/reactions.ts)

Remaining risk / open question:

  • No contributor-supplied real Slack, terminal, live-output, or redacted log proof shows the after-fix behavior.
  • own mode depends on Slack reaction payloads carrying item_user for the original message author, so live proof should include that path.

Codex review notes: model gpt-5.5, reasoning high; reviewed against f6d787cc5c1f.

@pgondhi987
Copy link
Copy Markdown
Contributor Author

Not applicable to this automation stage; changelog/release-note and external real behavior proof requirements are handled outside auto-pr stages.

Quoted comment from @clawsweeper:

Codex review: needs real behavior proof before merge.

Summary
The PR adds a Slack reaction policy gate in the reaction event handler and extends its harness/tests for off, own, and allowlist modes.

Reproducibility: yes. From source inspection, current main reads reactionNotifications and reactionAllowlist into the Slack monitor context but the reaction handler queues authorized reactions without checking them; a focused harness can set off, own, or allowlist and observe enqueueSystemEvent(...).

Real behavior proof
Needs real behavior proof before merge: The PR body says no real environment, command, live Slack delivery, or after-fix output was run, so contributor-supplied redacted terminal/log/live Slack proof is still required before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, ask a maintainer to comment @clawsweeper re-review.

Next step before merge
Contributor real behavior proof and explicit maintainer handling are required for this protected Slack PR; there is no narrow ClawSweeper repair task right now.

Security
Cleared: The diff narrows Slack reaction event flow and does not add dependencies, workflow changes, secret handling changes, new network calls, or broader execution surface.

Review details

Best possible solution:

Merge a narrow Slack handler fix after the contributor adds redacted real behavior proof and a maintainer approves the protected Slack policy change.

Do we have a high-confidence way to reproduce the issue?

Yes. From source inspection, current main reads reactionNotifications and reactionAllowlist into the Slack monitor context but the reaction handler queues authorized reactions without checking them; a focused harness can set off, own, or allowlist and observe enqueueSystemEvent(...).

Is this the best way to solve the issue?

Yes, subject to proof. Gating in the Slack reaction handler with the existing allowlist helper before enqueueSystemEvent(...) is the narrow maintainable fix; the remaining blockers are contributor proof and maintainer review, not a different code direction.

What I checked:

Likely related people:

  • steipete: GitHub commit history for extensions/slack/src/monitor/events/reactions.ts, extensions/slack/src/monitor/provider.ts, and adjacent tests shows repeated recent Slack monitor/provider changes, including the system-event runtime move and later Slack handler refactors. (role: recent area contributor; confidence: high; commits: d83e3afc5642, f0000ab72d01, a0fb7fb04547; files: extensions/slack/src/monitor/events/reactions.ts, extensions/slack/src/monitor/events/reactions.test.ts, extensions/slack/src/monitor/provider.ts)
  • pgondhi987: Beyond authoring this PR, prior merged Slack provider work by this account touched the same provider/allowlist runtime area, so they are an adjacent Slack policy contributor. (role: recent adjacent contributor; confidence: medium; commits: b895c6d939fe; files: extensions/slack/src/monitor/provider.ts)
  • scoootscooob: The Slack channel code was moved under extensions/slack/src/ in a large extension migration, which is relevant historical ownership context for the current file location but less specific to reaction policy behavior. (role: migration contributor; confidence: low; commits: 8746362f5ebf; files: extensions/slack/src/monitor/events/reactions.ts)

Remaining risk / open question:

  • No after-fix real Slack, terminal, log, or live-output proof is present; the PR body says the changed behavior was not run.
  • The own mode path depends on Slack reaction events carrying item_user for bot-authored messages, so live proof should include that path.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 042a8f106ed1.

@pgondhi987 pgondhi987 merged commit 889afc7 into openclaw:main May 12, 2026
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: slack Channel integration: slack maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant