Repository navigation
fix(compaction): stop cancelled queued preparation - #138649
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. |
|
Codex review: blocked before merge. Reviewed September 4, 2026, 6:01 PM ET / 22:01 UTC. ClawSweeper reviewWhat this changesThis PR makes queued session compaction stop preparation after cancellation or host-authority loss and normalizes native CLI aborts to the public cancelled result. Merge readiness⛔ Blocked before merge - 4 items remain Keep open for explicit maintainer review: the introduced cancellation checks and lease cleanup align with the queued-compaction owner boundary, and no discrete correctness defect was established; the local partial clone could not complete a comparison with fetched current main. Priority: P1 Review scores
Verification
How this fits togetherQueued compaction prepares a model runtime and context engine before placing transcript work on session lanes. It must stop when its caller or session owner is no longer active, so stale preparation cannot retain resources or continue into compaction. flowchart LR
A[Compaction request] --> B[Resolve session owner]
B --> C[Prepare model runtime]
C --> D[Resolve context engine]
D --> E{Caller and host active?}
E -- yes --> F[Queued compaction]
E -- no --> G[Cancelled result and cleanup]
F --> H[Session transcript update]
Decision needed
Why: This is a maintainer-authored, protected-label PR; repository policy requires explicit human judgment rather than automated closure or merge recommendation. Before merge
Agent review detailsSecurityNone. PR surfaceSource +24, Tests +276. Total +300 across 4 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep cancellation normalization at the queued lifecycle owner and retain the shared post-await authority checks, with a maintainer confirming the bounded production growth. Do we have a high-confidence way to reproduce the issue? Yes—source and focused regression tests provide a high-confidence deterministic path by aborting or expiring host authority while each preparation await is held. Is this the best way to solve the issue? Yes—the queue coordinator owns both the caller-facing result and the preparation lifecycle, while the native backend preserves abort identity for that owner to normalize. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 0b1e8697aa8e. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
@clawsweeper re-review Rank-up moves addressed on unchanged head
Please refresh the verdict against the updated durable evidence. |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
Stop queued compaction preparation when caller cancellation or session-host authority invalidates the request. - revalidate cancellation and host ownership after asynchronous preparation - release acquired prepared-runtime leases from the queued lifecycle owner - preserve signal-owned native CLI aborts for canonical cancellation reporting - cover admission, host-expiry, writer, successor, and overflow sibling paths Exact-head validation: 227 focused owner/sibling tests, `check:changed`, 130 hosted CI checks, autoreview, local ClawSweeper, and native landing gates.
Related: #138184
What Problem This Solves
Fixes an issue where queued compaction could continue preparing a model after
the caller cancelled or the session host lost authority. That stale work could
retain a prepared-runtime lease, and native CLI cancellation could be reported
as an ordinary backend failure instead of a cancelled compaction.
Why This Change Was Made
Queued execution now revalidates cancellation and host authority at the
preparation owner after each asynchronous boundary, and releases any acquired
prepared-runtime lease from one lifecycle-owned cleanup path. Native CLI
signal-owned aborts remain exceptions until the queued owner converts them to
the public cancellation result; ordinary CLI failures remain result-based and
completed work still wins over a late abort.
This is separate from #138473, which repairs Codex thread-binding continuity
after a committed compaction successor.
User Impact
Stop and timeout requests now halt stale queued compaction before further model
or context-engine work. A cancelled native CLI compaction reports
compaction aborted, and replacement session owners do not inherit abandonedpreparation or leases.
Evidence
Exact signed head:
dce2f6535e47cf1bc72d0c37aca278099c7d00c0.model-resolution step.
containing
request timed outinstead ofcompaction aborted.cancellation, queued/native compaction, successor ownership, and overflow
recovery.
node scripts/check-changed.mjs: passed withcoreandcoreTests; no temp-directory warnings.0 failed or pending in
https://github.com/openclaw/openclaw/actions/runs/33923172518.
scripts/pr prepare-runaccepted that hosted exact-head proof andrecorded
gates_mode=hosted_exact_or_recent_parent.verdict was the queued lifecycle owner. Its sandbox could not start Vitest
because artifact writes are read-only, so the executable proof is the
separate exact-head run above.
3921a30d6b11218883e5bb81a48082095cf79b7c: task cancellation is expected toterminate promptly, and
TurnAbortedowns aborted-turn lifecycle handling(
codex-rs/core/src/tasks/mod.rs:187,codex-rs/core/src/tasks/compact.rs:28).origin/mainwas checked at6e42083f34e74d122d9773d163e3604dfe9da629; no intervening commit touched thefour changed files, so the branch was not cosmetically rebased.
Maintainer Decision
Approved for self-landing after exact-head gates. The +24 production-line delta
is accepted because the distinct post-await checks protect caller cancellation,
host authority, and one lease-release owner; collapsing them to one downstream
guard would leave stale preparation running. Native review artifacts record no
findings and recommend
READY FOR /prepare-pr.ClawSweeper's medium-confidence limitation was its read-only/partial-clone
environment, not a source finding. The missing evidence is supplied above by
the exact-head hosted matrix, the 227-test local owner/sibling run, and the live
main overlap check.
Production LOC: +74/-50 (net +24) | Tests: +276/-0.
The positive production delta carries cancellation and host-authority facts
through the existing queued owner and provides one lease-release boundary.
Moving the checks downstream would leave stale preparation active; swallowing
abort at the native backend boundary reproduces the original failure.
No config, schema, dependency, protocol, docs, or changelog surface changes.