Repository navigation
fix(auto-reply): deliverBindingPayload missing abortSignal check - #109109
SunnyShu0925 wants to merge 2 commits into
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 25, 2026, 7:40 AM ET / 11:40 UTC. ClawSweeper reviewWhat this changesThe PR adds abort-signal checks around routed plugin-binding and fast-abort reply delivery, forwards the signal through QA-channel inbound dispatch, and adds regression coverage for a cancellation race. Merge readiness⛔ Blocked until stronger real behavior proof is added - 5 items remain The review environment rejected the required read-only repository inspection before it could run, so this PR remains open rather than receiving a shallow verdict. Priority: P2 Review scores
Verification
How this fits togetherAuto-reply dispatch takes inbound channel events and plugin binding outputs, attempts routed delivery to the originating conversation, then falls back to the active dispatcher when routing does not handle the reply. Abort signals must stop that fallback so cancelled work cannot emit stale replies. flowchart LR
A[Inbound channel event] --> B[QA channel inbound handler]
B --> C[Auto-reply dispatch]
C --> D[Plugin binding payload]
D --> E[Route to originating conversation]
E --> F{Abort signal?}
F -->|No route and active| G[Dispatcher fallback]
F -->|Aborted| H[Suppress delivery]
Decision needed
Why: The contributor's evidence says the route and binding store are mocked in the central race; repository source and the fresh merge result could not be inspected to independently decide whether that is an adequate substitute. Before merge
Agent review detailsSecurityNone. PR surfaceSource +100. Total +100 across 4 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Re-run a read-only review in a working sandbox, verify the current merge result and cancellation paths, then obtain a maintainer proof override or redacted live installed-binding cancellation evidence before merge. Do we have a high-confidence way to reproduce the issue? Unclear: the provided discussion supplies a deterministic test path, but the required current-main source and test inspection could not run in this environment. Is this the best way to solve the issue? Unclear: the proposed pre/post-route abort checks are plausible, but a full module/caller/sibling review and current merge-result check are required before confirming this is the best fix. AGENTS.md: unclear because the file could not be read completely. Codex review notes: model internal, reasoning high; reviewed against 421e287c456f. 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 (15 earlier review cycles; latest 8 shown)
|
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
6e27d5c to
92257b1
Compare
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
e3287cc to
0490d87
Compare
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
23c098f to
4900b6a
Compare
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Real behavior proof: deliverBindingPayload abort guardThis comment provides the redacted terminal output from exercising the real Test executionThe focused regression test was run against the fix branch: What is NOT mocked
What IS mocked (network calls requiring a running gateway)
Abort traceAssertions verified by the test
All 309 dispatch tests passBranch state
|
4900b6a to
284c4ca
Compare
Runtime Proof EvidenceSetup
Proof A — Real handler integration ✅Proof B — Pre-aborted signal short-circuit ✅Proof C — Mid-route abort guard (the fix) ✅Abort trace (the race window in deliverBindingPayload)What is still mocked
Run this locallynode scripts/run-vitest.mjs src/auto-reply/reply/dispatch-from-config.abort-runtime-proof.test.ts -- --reporter=verboseWhat changed3 new commits since last review:
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
89c8c83 to
e63e364
Compare
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
c592622 to
a07702a
Compare
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
This PR has had extensive review and the ClawSweeper report confirms no actionable code defect remains (patch quality: 🐚 platinum hermit). The remaining blocker is the "real behavior proof" gate for the mid-route abort race window. Why this race can only be proven with controlled timing: The fix guards a timing-dependent invariant: abort fires during What the existing proof covers:
Request: Grant a proof override for this timing-dependent internal invariant. The controlled mock test is the strongest practical evidence this race can produce. |
Rebased to latest
|
| File | Change |
|---|---|
dispatch-from-config.ts |
+17/−2 — deliverBindingPayload pre/post abort checks + signal propagation; fast-abort post-route guard |
lifecycle-and-bindings.test-utils.ts |
+93 — mid-route abort regression test (race window) |
qa-channel/inbound.ts |
+3 — optional abortSignal parameter |
Proof gap: why the mid-route race can only be proven with controlled timing
The remaining ClawSweeper blocker is status: 📣 needs proof for a timing-dependent internal invariant: an abort firing during the async routeReplyToOriginating await. In a real gateway with real channels, there is no deterministic way to abort at exactly the right moment — the race window is inside an asynchronous network call.
The controlled test fires abortController.abort() synchronously inside the routeReply mock, creating the window deterministically. This exercises the real deliverBindingPayload, real dispatchReplyFromConfig, real AbortController, and the real post-await guard.
Evidence summary
| Layer | What it proves | Status |
|---|---|---|
| Pre-aborted signal (existing test, L1711) | Entry guard catches aborted signal | ✅ |
| Mid-route abort (new test, L1784) | Post-await guard catches abort during route, suppresses fallback | ✅ |
| Fast-abort post-check (L1264) | Same guard applied to fast-abort fallback | ✅ |
| 315 dispatch tests | All existing behavior preserved | ✅ |
Request
Patch quality is 🐚 platinum hermit; ClawSweeper confirmed no actionable code defect remains. The remaining gate is a maintainer decision on whether this timing-dependent race requires live installed-binding proof or can be accepted with the existing deterministic coverage.
@steipete — requesting your review and proof override decision for this timing-dependent internal invariant.
6742051 to
e0feb05
Compare
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
e81de7f to
37767f6
Compare
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
0221c90 to
37767f6
Compare
…nclaw#109109) Co-Authored-By: Claude Opus <[email protected]>
37767f6 to
b78244c
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
What Problem This Solves
Plugin binding notifications could still be delivered via
routeReplyToOriginating,dispatcher.sendToolResult, ordispatcher.sendFinalReplyafter the dispatch operation has been aborted, becausedeliverBindingPayloaddid not check or propagate the dispatch abort signal. The same gap existed in the fast-abort acknowledgment path: it propagatedabortSignalbut lacked a post-route guard before the direct-dispatcher fallback.Why This Change Was Made
deliverBindingPayloadwas missing the same abort-signal guard thatsendPayloadAsync(the sibling function) already implements. Aligned them by adding:params.replyOptions?.abortSignal?.abortedearly returnparams.replyOptions?.abortSignaltorouteReplyToOriginatingoptionsrouteReplyToOriginatingcall, check.abortedagain before falling through tosendToolResult/sendFinalReplyThe fast-abort acknowledgment path had the same pattern: it propagated
abortSignalthroughrouteReplyToOriginatingbut did not re-check after the await, so a cancellation during routed delivery could still reachdispatcher.sendFinalReplyon the wrong surface.Since
deliverBindingPayloadis defined insideprepareDispatchDelivery's closure (moved from the formerdispatchReplyFromConfigInnerby the #113154 refactor),params.replyOptions?.abortSignalis directly accessible — no need forgetDispatchAbortSignal().User Impact
Users of plugin bindings may see fewer stale/misdirected binding notifications when a dispatch operation is aborted (e.g. session timeout, manual cancellation). The fast-abort acknowledgment is similarly guarded against wrong-surface delivery after cancellation. No behavior change for normal (non-aborted) dispatch paths.
Evidence
Test results
Lint and type checks
tsgo:core(type)oxlintoxfmtE2E proof: Mid-route abort with 500ms async delay (the race window)
Uses a real HTTP server, real
dispatchReplyFromConfigpipeline, realAbortController, and a 500ms artificial delay inrouteReplyto simulate the async race window. Everything exceptrouteReply(requires a real channel gateway) is real.The 500ms delay makes the race window observable: abort fires at +761ms during the async
routeReplyToOriginatingawait, and the post-check catches it 2ms later at +763ms, suppressing fallback delivery.Fast-abort post-route guard
After the
routeReplyToOriginatingawait returns null,params.replyOptions?.abortSignal?.abortedis checked before thedispatcher.sendFinalReplyfallback, preventing wrong-surface delivery when cancellation races with the route.E2E Gateway Proof (pre-aborted signal through QA channel)
Files changed
src/auto-reply/reply/dispatch-from-config.prepare-delivery.tsdeliverBindingPayloadpre/post abort checks + signal propagationsrc/auto-reply/reply/dispatch-from-config.prepare-operation.tssrc/auto-reply/reply/dispatch-from-config.lifecycle-and-bindings.test-utils.tsextensions/qa-channel/src/inbound.tsabortSignalparameter onhandleQaInbound, forwarded into dispatchreplyOptions