Repository navigation
fix(slack): expose channel reaction events to thread turns - #122363
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: passed. Reviewed August 12, 2026, 3:08 AM ET / 07:08 UTC. ClawSweeper reviewWhat this changesCarries route-scoped system events, including eligible Slack reaction notifications, into the next thread-scoped reply turn without exposing new public reply or Plugin SDK fields. Merge readinessKeep open for maintainer review. Current main still drains only the thread session’s queue, while this PR privately carries the base route and defers destructive draining until admission succeeds; the route-first ordering has explicit approval in the PR discussion. Priority: P1 Review scores
Verification
How this fits togetherSlack reaction handlers enqueue authorized notifications against a channel route, while incoming threaded messages dispatch to a distinct thread session. The channel-turn pipeline bridges those identities into reply admission, which builds the agent prompt and consumes queued events. flowchart LR
A[Slack reaction event] --> B[Channel route event queue]
C[Mentioned thread message] --> D[Channel turn assembly]
B --> D
D --> E[Reply admission decision]
E --> F[Route events then thread events]
F --> G[Agent thread response]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +48, Tests +140. Total +188 across 7 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep route ownership private, drain route events before thread-local events only after admission can run, and validate the focused regressions against the clean current-main merge result; no net-neutral alternative is evident because current reply options carry no route-owner fact and public-context propagation would widen contracts. Do we have a high-confidence way to reproduce the issue? Yes—source-reproducible with high confidence: enqueue an authorized Slack reaction on the base route, then dispatch a mentioned thread turn whose session key differs; current main drains only the thread queue. Is this the best way to solve the issue? Yes. The private route carrier preserves existing public contracts, and deferring drains until admission succeeds repairs both route visibility and the busy-return loss without a new configuration surface. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d3696f8d769f. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (8 earlier review cycles)
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Maintainer decision for the latest ClawSweeper review: I approve the route-first ordering for this fix. Route-owned reaction events are shared-channel context that predates the thread-local turn, so they should be delivered before thread-owned events in the next eligible turn. The exact-head checks are green. @clawsweeper re-review |
|
@clawsweeper autofix |
|
🦞🧹
This is fix-only; I will not merge this PR. |
|
@clawsweeper re-review |
|
🦞✅ Source: Why human review is needed: What the maintainer can do as a next step: I added |
Land-ready proofMaintainer acceptance: the route-first shared-channel ordering and the justified +48 production LOC called out by ClawSweeper are accepted for this landing. ClawSweeper has zero findings at Root cause: Slack reaction notifications are owned by the base channel route, while a mentioned reply can dispatch to a distinct thread session. Reply admission previously drained only the dispatch session, so admitted route events were invisible; it could also drain events before a busy admission returned without an agent turn. Owner and fix: the shared channel-turn/reply-admission boundary now privately carries the distinct route session and drains route events before dispatch events only after admission succeeds. Public reply, context, configuration, and Plugin SDK contracts are unchanged. Slack and Discord exercise the shared carrier. Validation:
Before/after: the anonymized live pre-fix reproduction showed admitted reaction-added and reaction-removed events missing from the next thread-scoped turn. The focused regressions fail on the pre-fix behavior and pass on this head, including preservation when admission returns busy. Known gaps and ClawSweeper rank-up disposition:
|
|
Merged via squash.
|
…#122363) (#122828) Co-authored-by: Sarah Fortune <[email protected]>
…122363) * test: cover routed Slack system events * fix: deliver route events to thread turns * style: format routed event test * fix: scope parent event routing to Slack * test: isolate routed event admission proof * fix(slack): keep reaction route handoff internal * fix(slack): preserve channel turn public types * fix(slack): hide reaction route carrier from sdk * style: keep channel lifecycle within lint budget * style: trim channel lifecycle carrier setup * test: preserve route events on busy admission * fix(reply): defer system event drain until admission * test: prove deferred system event drain --------- Co-authored-by: Sarah Fortune <[email protected]>
What Problem This Solves
Fixes an issue where an eligible Slack reaction event could be hidden from the next mentioned turn when that turn was routed into a Slack thread session.
Message authorship is controlled by the existing
reactionNotificationspolicy; it is not intrinsic to this bug:own(default)allallowlistAll admitted reaction events use the same channel-route queue and were affected by the route-to-thread visibility gap.
Why This Change Was Made
Preserves the base channel route as the owner of channel-scoped system events while dispatching the message to its thread session. Reply admission drains the authorized route queue before the current session queue, preserving thread isolation while exposing pending channel events.
Destructive event draining is deferred until after active-run admission. If admission returns the existing “still shutting down” response without executing a turn, both the route and dispatch queues remain intact for a later turn.
Core carries route ownership through private symbol-backed reply metadata that survives the existing option spreads. Public
MsgContext, reply-option, and Plugin SDK contracts remain unchanged. The generic route/dispatch carrier is covered for both Slack and Discord.This uses the existing route/dispatch separation shared by channel plugins and does not change configuration or defaults.
AI-assisted by Codex.
User Impact
Agents can observe queued Slack reaction-added and reaction-removed events from any message admitted by the configured reaction-notification policy on the next eligible thread-scoped turn instead of returning an empty result. Busy admission no longer consumes those events without an agent turn.
Evidence
Slack reaction added: :eyes:from the parent route.node scripts/run-vitest.mjs src/auto-reply/reply/get-reply-run.media-only.test.ts -t 'keeps route and dispatch system events queued when busy admission returns'passed (1 test).node scripts/run-vitest.mjs src/auto-reply/reply/get-reply-run.media-only.test.ts -t 'drains system events only after waiting behind an active run'passed (1 test).node scripts/run-vitest.mjs src/auto-reply/reply/get-reply-run.media-only.test.ts -t 'includes route system events in a thread-scoped turn'passed (1 test).node scripts/run-vitest.mjs src/channels/turn/run-channel-turn.pipeline.test.ts -t 'carries .* route system-event ownership privately into dispatch'passed (2 tests: Slack and Discord).node scripts/run-vitest.mjs extensions/slack/src/monitor/message-handler/prepare.test.tspassed (151 tests).oxlintpassed.oxfmt --checkpassed on all 7 touched source and test files.git diff --checkpassed.pnpm plugin-sdk:api:checkreports the same pre-existinginfra-runtime.jsonmismatch at both this head and the untouched PR merge-base; their generated contract sets are byte-identical, so this PR adds no Plugin SDK drift.Anonymized live reproduction
A live test workspace reproduced the bug before the patch using the default
ownpolicy; all workspace, channel, app, bot, user, message, thread, tenant, host, and run identifiers have been removed.ownmode:eyes:The focused regression models the shared base-route-to-thread-session transition after reaction-policy admission. It failed before the patch and passes with the patch.