Repository navigation
fix(slack): keep thread typing across queued follow-up turns - #168544
synthalorian wants to merge 4 commits into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Proof for head Without the successor handoff, With the fix,
|
|
Codex review: needs real behavior proof before merge. What this changesThis PR gives admitted queued follow-ups fresh typing lifecycles and serializes their Slack session-status updates. Example: A second Slack thread mention queues behind a running claude-cli turn.
Review scores
ProductKind: Bug fix · Worth it: Needs a maintainer decision · Fix scope: Complete Merge readiness⛔ Blocked before merge - 2 items remain Keep open: this PR repairs a source-confirmed queued-turn typing defect still present on current main, and the earlier status-ordering findings are resolved. Priority: P2 Decision needed
Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherThe shared reply pipeline converts admitted queued turns into channel typing callbacks; Slack translates those callbacks into thread session-status requests and activity reactions. flowchart LR
A[Slack inbound mention] --> B[Follow-up queue]
B --> C[Turn admission]
C --> D[Successor typing controller]
D --> E[Channel typing lifecycle]
E --> F[Slack status publisher]
F --> G[Slack thread status]
Technical reviewBest possible solution: Keep successor typing with the existing lifecycle owners and preserve Slack's visible-output suppression and terminal sealing. Do we have a high-confidence way to reproduce the issue? Current main demonstrably reuses a permanently sealed typing controller during queued execution; the contributor also reports a baseline lifecycle failure, while the historical immediate-clearing symptom is not established on current main. Is this the best way to solve the issue? A fresh controller for each admitted turn addresses the shared lifecycle cause, and serialized Slack writes resolve the earlier ordering defects without periodic status reconciliation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 1c272f2ae919. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +181, Tests +405. Total +586 across 13 files. Added test files: 3. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (2 earlier review cycles)
Reviewed October 12, 2026, 11:39 PM ET / October 13, 2026, 03:39 UTC (Revision 3). |
0573de8 to
72fef3c
Compare
|
Proof for head No live Slack Socket Mode and no user token. The follow-up runner was driven with a local typing publisher stub:
That run passed. The runner printed:
Generation 0 is the predecessor. After it was sealed, generation 1 published Slack status settlement, with the predecessor
The second case does not republish Previous CI on
Both are fixed without new suppressions. The maintainer decision is still open: whether |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Follow-up for head
The same rule failed at line 84. The status helpers are arrow functions now. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
d4ba62a to
eddbf36
Compare
eddbf36 to
bc785db
Compare
bc785db to
7a92948
Compare
Admitted follow-ups reused a sealed typing controller, so Slack never showed processing for the queued turn and a late stop could clear the thread. Give each admitted turn its own typing lifecycle and status generation.
Serialize Slack session-status publishes so a predecessor active request cannot land after the successor's processing, and do not republish processing once that successor has finished.
Main replaced follow-up admission, so the successor typing test has to mock prepareReplyAgentTurn instead of the removed admitFollowupTurn path.
7a92948 to
8732ca2
Compare
What Problem This Solves
Slack thread status is per thread, but each inbound dispatch owned its own typing lifecycle. A mid-turn mention that cannot be steered (claude-cli) is parked and later runs as a queued follow-up. That follow-up reused the predecessor dispatch's typing controller. Core cleanup seals that controller, and the channel callbacks close with it, so the queued turn never publishes
processing. A stop from the parked or finished dispatch can also publishactivewhile another turn on the same thread is still the one that should look busy.Why This Change Was Made
Admitted follow-ups now get a successor typing controller. The predecessor stays sealed. The successor reopens channel typing as a new generation, so a late stop from the sealed lifecycle cannot clear the new indicator. Slack session status uses the same generation: a parked pipeline that never published
processingdoes not publishactive, and a queued turn can publishprocessingagain before its own visible output, then return toactivewhen it finishes. Status writes are serialized, so a predecessoractiverequest cannot take effect after the successor'sprocessingrequest. A finished successor is not started again when that older request resolves. The existing visible-output gate still suppresses status once this turn itself has output.User Impact
In a Slack thread, a message sent while the agent is already working no longer drops the native working indicator just because that message was parked. When that message later runs as its own turn, Slack shows the working status again until the turn finishes.
Evidence
Head:
d4ba62ab06df9b544c5eacf7bd8d1d5a2cac75c1Previous CI on
0573de80c75bfb19616c2d8ddc1c7bb13333262cfailed in two jobs:check-lint-core-3:src/channels/typing.ts:103:7: error: Function 'stopIfCurrent' expected no return value. (typescript(consistent-return))checks-fast-baseline-ratchets:First-party mock factories must preserve real exports or explain isolationfor the new follow-up lifecycle test. The same job also warned1073 -> 1074 counted lines (cap 700)onsrc/auto-reply/reply/get-reply.ts.Those are fixed without new suppressions.
stopIfCurrentnow always returns a promise. The lifecycle test spreadsimportOriginal.get-reply.tsno longer passes the silent-token default explicitly, so its counted lines move1076 -> 1075against current main. Localcheck:test-mock-exportsandcheck:line-cap-ratchetagainstupstream/mainpassed. oxlint on the touched files is clean, including the extension tsconfig rule that rejected unbound test helpers.Local publisher stub, no Slack Socket Mode and no user token.
node --import ./scripts/tsx.mjs scripts/run-vitest.mjs src/auto-reply/reply/followup-runner.typing-lifecycle.test.ts extensions/slack/src/monitor/message-handler/thread-status.test.ts --maxWorkers=1passed. The follow-up runner drove the stub and printed:FOLLOWUP_EVENTS ["processing#0","active#0","processing#1","followup-started","active#1"]A later stop and start on that sealed predecessor did not append another event. With the predecessor
activewrite held until after the successor had started, settlement was["processing","active","processing"]. When the successor also finished before that write resolved, settlement was["processing","active","processing","active"], and a further stop published nothing.The ordering regression fails on the previous cycle: while the delayed
activewrite is still pending, the successorprocessingwrite is already in flight (expected 2 to be 1).Maintainer decision still open: whether
beginNextLifecycleshould become a supported optionalTypingCallbackscontract. Issue #158350 does not pin that public-API choice.Fixes #158350