Repository navigation
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs real behavior proof before merge. Reviewed August 23, 2026, 7:13 PM ET / 23:13 UTC. ClawSweeper reviewWhat this changesThe PR ensures an interrupting Gateway chat request releases its abort registration and session-work admission when cancellation of the active reply throws. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 5 items remain No blocking code finding: the patch releases the admission at the owner boundary before dispatch can take custody. This PR remains necessary because current main still lets a throwing reply-backend cancellation bypass that cleanup; merge is blocked on real after-fix behavior proof and fresh exact-head CI. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (partial) — step 2 Assertions:
How this fits togetherGateway chat sends reserve session lifecycle ownership and an abort handle before interrupting an active reply. That pre-dispatch phase must either transfer ownership to dispatch or release it, so later reset, archive, delete, and gateway-drain work are not blocked. flowchart LR
Request[Gateway chat request] --> Admission[Reserve session work]
Admission --> Abort[Register abort handle]
Abort --> Interrupt[Interrupt active reply]
Interrupt --> Decision{Cancellation fails?}
Decision -->|Yes| Cleanup[Release both owners]
Decision -->|No| Dispatch[Transfer to chat dispatch]
Cleanup --> Lifecycle[Session lifecycle remains available]
Dispatch --> Lifecycle
Before merge
Agent review detailsSecurityNone. PR surfaceSource +8, Tests +45. Total +53 across 2 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the pre-dispatch cleanup at the admission owner, then attach a redacted Gateway trace showing the thrown interrupt error followed by a successful lifecycle operation or zero active admission, and obtain green exact-head CI. Do we have a high-confidence way to reproduce the issue? Yes, from source: attach a reply backend whose cancellation throws, issue an interrupting chat request, and observe that current main bypasses the only pre-dispatch release path. The branch's focused Gateway test encodes this path but was not executed in this read-only review. Is this the best way to solve the issue? Yes: cleanup belongs in admission because the setup caller has no admitted object when interruption throws. A downstream catch would not reliably own the newly registered abort handle or session admission. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 9cd09fdbe373. 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 (3 earlier review cycles)
|
e3c56aa to
0786ac9
Compare
|
Merged via squash.
|
…cle (openclaw#126546) * fix(gateway): release interrupted chat admission * fix(gateway): unify interrupted chat admission cleanup Co-authored-by: NianJiuZst <[email protected]> * chore(gateway): leave changelog to release generation --------- Co-authored-by: NianJiuZst <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
An interrupting
chat.sendcould leave a hidden session-work admission and abort registration behind when either an existing reply backend or another active session admission threw during cancellation. Subsequent session reset, archive, and deletion could hang behind that leaked ownership, and Gateway shutdown could remain blocked until its drain timeout.Why This Change Was Made
admitChatSendacquires its new session admission and abort registration before invoking either direct reply cancellation or identity-scoped session-work interruption. Both interruption contracts may throw, but the previous owner did not clean up those resources on either exception path.The admission owner now has one canonical pre-dispatch cleanup path for its abort registration, session admission, and optional Gateway-root continuation. Direct interruption, fallback interruption, an unsettled predecessor, and rejected or throwing admission-owner callbacks all release the same resources before returning or propagating their original error. This replaces duplicated cleanup branches and removes five production lines overall.
User Impact
Cancellation failures still surface to the operator, but normal session lifecycle actions and Gateway drain recover immediately. Successful sends, ordinary interruptions, and retained post-admission request ownership keep their existing behavior.
Evidence
Exact reviewed head:
e234b446817dca6b8686cc718bcb493d960811a4.Both new owner-boundary regressions were first run against the unchanged current-main implementation and failed: direct reply cancellation left one active session admission, and identity-scoped fallback interruption left a second leaked admission.
Both then passed through the real in-process Gateway and authenticated WebSocket
chat.sendflow. Each independently verifies the session-admission and Gateway-root counts return to zero, then successfully performs a realsessions.resetRPC.Full focused owner and sibling verification:
Result: 206 tests passed across Gateway chat, cloud-worker session lifecycle, session admission, and reply-run cancellation.
Targeted formatting, core lint, and
git diff --checkpassed.Fresh independent structured review completed with no actionable findings.
Production LOC:
+52/-57(net -5); tests:+86/-1.No external provider or cloud lease is required for this Gateway-owned failure; the live product proof is the actual Gateway/WebSocket/session lifecycle with a deliberately failing cancellation backend.
Original fix and regression by @NianJiuZst; contributor authorship and co-author credit are preserved.
AI-assisted: yes