Repository navigation
fix(agents): preserve reply cleanup when cancellation throws - #122252
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
03896d1 to
ef800d4
Compare
|
Codex review: needs maintainer review before merge. Reviewed August 11, 2026, 6:05 PM ET / 22:05 UTC. ClawSweeper reviewWhat this changesThis PR moves reply-abort cleanup into a shared Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessCurrent main still bypasses reply cleanup when backend cancellation throws; this focused owner-boundary fix addresses that path cleanly. Keep it open for normal maintainer review and exact-head validation. Priority: P1 Review scores
Verification
How this fits togetherReply operations own a reply lane from queueing through backend execution and terminal cleanup. User, restart, and upstream cancellation flow through this owner before the next reply can be admitted. flowchart LR
A[User restart or upstream cancellation] --> B[Reply operation owner]
B --> C[Record aborted result]
C --> D[Backend cancellation]
D --> E[Finally cleanup decision]
E --> F[Release queued reply lane]
E --> G[Schedule running terminal settle]
F --> H[Admit next reply]
G --> H
Before merge
Agent review detailsSecurityNone. PR surfaceSource -15, Tests +67. Total +52 across 2 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the shared reply-operation cleanup after it is marked ready and exact-head validation confirms the four throwing-cancellation cases. Do we have a high-confidence way to reproduce the issue? Yes: on current main, a backend Is this the best way to solve the issue? Yes: centralizing the invariant in the reply-operation owner covers user, restart, and upstream cancellation without duplicating caller cleanup. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 459c70e14a2c. 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 (1 earlier review cycle)
|
|
Merged via squash.
|
* origin/main: (1725 commits) fix(agents): preserve reply cleanup when cancellation throws (#122252) fix(ui): render disallowed link schemes as plain text (#122311) fix(test): isolate gateway helper env stubs (#122319) fix(ui): keep chat Markdown block rhythm consistent (#122289) test(cli): trim duplicate Hooks process cases (#122278) fix(ui): retain identity while agent roster loads fix(ui): preserve configured agent labels fix(plugins): keep startup convergence read-only (#122330) fix: preserve WebChat reply context after reloads (#122169) fix(ui): make DONE moves visibly reversible (#122303) fix(ui): keep inline-code punctuation attached (#122291) fix(google-meet): publish exports atomically (#122306) fix(channels): preserve failed agent run reactions (#122009) fix(ui): label patch file operations accurately (#122287) fix(windows): preserve Unicode LAN route aliases (#122263) test(media): synchronize transcode pool completion (#122279) fix(android): keep completed subagent activity visible for sixty seconds (#122089) fix(ui): humanize bare GitHub item links (#122285) refactor(qqbot): install plugin from Tencent package (#107295) chore: scope SQLite session lifecycle CI (#121917) ...
…w#122252) * refactor(agents): canonicalize reply abort cleanup * refactor(agents): document reply abort cleanup invariant
What Problem This Solves
Fixes an issue where a reply backend whose cancellation callback throws could leave queued reply ownership active indefinitely or leave running ownership without its terminal-settle deadline.
Why This Change Was Made
The reply-operation owner now uses one canonical abort path for direct user aborts, restart aborts, and upstream cancellation. It records the terminal result, detaches upstream cancellation, aborts the local signal, invokes backend cancellation, and guarantees the phase-appropriate cleanup in
finally.The change preserves public abortability guards, upstream settled-result handling, user/restart result codes, the Plugin SDK contract, and backend cancellation exception propagation.
User Impact
Reply lanes no longer remain wedged when backend cancellation throws. Normal cancellation behavior is unchanged.
Evidence
1cdc152df420ad323b02c6d07db9ab1233976d52.f30e67298a59384295d120198b083bae2e925577; GitHub reports a valid verified signature, and the commit is live onorigin/main.main: all four queued/running x user/restart cases fail. Queued ownership remains active; running ownership has no terminal-settle timer.node scripts/run-vitest.mjs src/auto-reply/reply/reply-run-registry.test.ts-> 80 passed.generate-plugin-sdk-api-baseline.ts --check->OK docs/.generated/plugin-sdk-api-baseline.31540936563, job93942917774, leasetbx_01kzsds47j67jj8pn91wfrzpaj; exact tree169e267f3fdd8a872d317d8fc4753ed0f9284c5c; four files / 151 tests,check:test-types, and the exact two-file changed gate passed. The full workflow, teardown, and post steps completed successfully.run_3b1147852239, leasecbx_904d5b7bb03e; exact head verified, 151/151 lifecycle tests passed, built CLI and launcher version/help smokes passed, and the lease was released.31543742410completed successfully with 70 jobs and zero failures.AI-assisted: yes.