Repository navigation
fix: retain compaction services through issued work - #143633
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: needs maintainer review before merge. Reviewed September 9, 2026, 10:49 PM ET / September 10, 2026, 02:49 UTC. ClawSweeper reviewWhat this changesKeep compaction’s prepared runtime and tool services alive until issued work and cleanup finish, while preserving prompt cancellation results and hook deadlines. Merge readiness✅ Ready for maintainer review This PR remains useful: current main still disposes delegated compaction resources before outstanding work necessarily finishes. No blocking defect was found in the introduced changes, and the merged foreground-compaction repair explicitly leaves this boundary separate. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s built-in compactor receives manual or automatic requests and summarizes session history using model providers, plugin hooks, and tool services. Its lifecycle owner must retain those resources through outstanding work without extending session authority. flowchart TD
A[Compaction request] --> B[Prepared runtime]
B --> C[Session compaction and hooks]
C --> D[Result or cancellation]
C --> E[Outstanding work settles]
D --> F[Session authority retired]
E --> G[Tool cleanup settles]
G --> H[Prepared runtime released]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +108, Tests +724. Total +832 across 7 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Preserve the separation between prompt session retirement and resource cleanup, with normal-run registration-disposal activation remaining independently validated. Do we have a high-confidence way to reproduce the issue? Yes, from source: a timeout can return while tracked compaction or hook work remains pending, after which main disposes its tools. The new controlled regressions exercise that ordering; they were inspected but not executed here. Is this the best way to solve the issue? Yes. Moving physical cleanup to the work owner repairs the lifetime mismatch while retaining existing timeout, session-disposal, fallback, and transcript contracts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e6a2df70bf38. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
What Problem This Solves
Fixes an issue where cancelling or timing out compaction could close MCP/LSP resources while issued compaction work or plugin hooks were still using them. A timed-out hook could also escape the work owner that retained its prepared database resources.
Why This Change Was Made
Compaction now separates the caller's result from physical cleanup. Its owner waits for actual preparation, compaction, provider, and hook work before disposing tool runtimes, then joins cleanup tails before releasing the prepared generation. Partial setup failures transfer cleanup ownership before allocating resources.
Timed hook dispatch observes the already-started handler promise while preserving the original timeout race and error policy. Session disposal still retires authority at the original boundary; diagnostics, transcript fences, accounting, checkpoints, and skill-environment restoration keep their existing ordering.
User Impact
Compaction can report cancellation or timeout promptly while allowing already-issued work to finish safely. Normal compaction, native CLI routing, fallbacks, and the default 180-second watchdog remain unchanged. Hook deadlines and fail-open behavior are preserved.
Normal-run registry disposal is not enabled by this change. The database disposal regression uses the existing managed read-only producer at the native delegate input boundary. The compiled smoke uses the public delegate with the current normal-run producer; managed default-flow integration remains required before activating its disposal.
Evidence