Repository navigation
fix(sessions): release lifecycle locks after queued admission cancellation - #165898
Conversation
…ation Forward the session admission signal through the store writer adapter so cancellation removes an unstarted barrier instead of retaining lifecycle locks. Started writes keep their existing settlement and FIFO contract.
|
🦞👀 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. |
|
Codex review: needs maintainer review before merge. Reviewed October 5, 2026, 9:51 PM ET / October 6, 2026, 01:51 UTC (Revision 2). ClawSweeper reviewWhat this changesThe PR forwards session admission cancellation to the existing store writer queue and extends regression coverage so cancelled waiting work releases lifecycle locks. Merge readiness✅ Ready for maintainer review The fix remains necessary on fetched main, and the pinned patch has no actionable correctness findings. The inherited CI failure does not establish a defect in this change. Priority: P2 Review scores
Verification
How this fits togetherSession admission coordinates new agent work with session reset, recovery, and cleanup. It holds lifecycle locks while validating against the store writer queue, then returns an admission lease or releases the reservation. flowchart TD
A[New session work] --> B[Acquire lifecycle locks]
B --> C[Validate session]
C --> D[Store writer queue]
E[Cancellation signal] --> D
D --> F{Writer started?}
F -->|No, cancelled| G[Reject and release locks]
F -->|Yes| H[Finish validation and settle]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +2, Tests +14. Total +16 across 3 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep cancellation owned by the existing writer queue so unstarted admissions unwind their lifecycle locks while started writes settle normally. Do we have a high-confidence way to reproduce the issue? Yes, source establishes a focused path: hold a store writer, cancel a waiting admission, then attempt a same-session lifecycle mutation before releasing the writer. I did not execute tests during this read-only review. Is this the best way to solve the issue? Yes, forwarding the existing signal through the adapter is the narrow repair; it preserves queue ownership, final validation, and started-write settlement. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 50f38c6ceb80. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
…ation (openclaw#165898) Forward the session admission signal through the store writer adapter so cancellation removes an unstarted barrier instead of retaining lifecycle locks. Started writes keep their existing settlement and FIFO contract.
What Problem This Solves
Fixes cancelled session admission retaining lifecycle locks while queued behind a store writer. Later reset, recovery, or cleanup work for the same session can remain blocked even after the cancelled admission disappears from active admission counts.
User Impact
Cancelled work releases its unstarted writer barrier so session lifecycle work can proceed. Already-running writes still finish under their existing owner. No configuration, schema, or stored-format change is required.
Why This Change Was Made
The session admission owner already receives cancellation, and the shared store-writer queue already removes cancelled waiting tasks without interrupting admitted writes. The session-store adapter did not carry that signal, leaving the rejected admission's callback queued while it held lifecycle locks. This change completes that existing cancellation path.
Production LOC: +2 net lines. The added option and forwarding are needed to carry the existing cancellation contract through the session-store adapter; no new queue, timer, cache, or cleanup owner is introduced.
Evidence
The extended existing regression holds the original writer open, cancels a queued admission, and requires a same-session lifecycle mutation to complete before that writer is released.
node scripts/run-vitest.mjs src/sessions/session-lifecycle-admission.test.ts -t "releases lifecycle locks".blacksmith-testbox/openclaw-check, leasetbx_01m47dq1j56pjh6axx93qwwbtb: 47 tests passed usingnode scripts/run-vitest.mjs src/sessions/session-lifecycle-admission.test.ts src/shared/store-writer-queue.test.ts src/config/sessions/store-writer.test.ts --maxWorkers=1. Exact source hashes verified before execution. Tests: 31.35 seconds wall time; full command: 53.903 seconds. The changed file's 31 tests completed in a 23.26-second runner invocation, including compilation/import; the new regression took 2 ms.tbx_01m47bmxcmw7vmjf1wb7ae3mkeremained queued beyond 20 minutes and was stopped when the committed head changed. The authorized isolated Linux rig fallback completednode scripts/check-changed.mjs --stagedwith exit 0 (01:21–02:25 UTC). All 27 core test type graphs passed, lint reported zero warnings/errors, dead-export scans reported zero entries, and runtime import-cycle checks reported zero cycles. The remaining native guards passed.Separate diagnostic scenarios using real registry persistence and
agents_waitsettle three timeout results, both with a waiting parent and after parent-wait cancellation. An initialized registry also expires suspended delivery and retires an exhausted requester wake. All end with zero blockers in that fixture, which does not create the full Gateway chat/reply owner graph.This is a bounded admission-lock fix found while investigating terminal child timeout retention. It does not by itself prove that every retained parent/child registration in that incident settles, and it does not force-release unfinished writes.
CI currently has an inherited production-audit failure:
[email protected]matches GHSA-68fv-2mgg-jv7q. A Testbox audit of the exact base381b1e05d7f0lockfile reproduced the same finding (3.879 seconds, exit 1), andcmpverified that the base and PR lockfiles are identical. No dependency change is included. Failed job: https://github.com/openclaw/openclaw/actions/runs/37400070914/job/112065353711. The private-key scan passed. CI fail-fast cancelled 37 jobs; aggregate gates are red from this inherited failure. No rerun or merge has been requested.