Repository navigation
fix: finish compile-cache cleanup after short CLI commands exit - #173603
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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs maintainer review before merge. What this changesThis PR moves compile-cache maintenance into a detached process with bounded incremental pruning and completion-based retry scheduling. Example: An explicitly cached short CLI command encounters a 600 MiB cache entry.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR addresses a current cache-cleanup failure with focused changes and passing exact-head CI; no actionable correctness or security findings were identified. Priority: P1 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe shared compile-cache bootstrap serves the packaged CLI, Gateway entry, and prewarmer; it receives a build-qualified cache directory and schedules best-effort removal of disposable bytecode. flowchart TD
A[CLI or Gateway or prewarmer] --> B[Shared compile cache bootstrap]
B --> C[Permission and interval checks]
C --> D[Detached maintenance process]
D --> E[Namespace checks and filesystem lock]
E --> F[Bounded scan and incremental eviction]
F --> G[Completion timestamp and lock release]
Technical reviewBest possible solution: Land the shared-owner repair while retaining nonblocking CLI exit, permission-mode isolation, and documented best-effort cache limits. Do we have a high-confidence way to reproduce the issue? Current-main source establishes that CLI exit can terminate maintenance after the hourly claim but before deletion; the linked report supplies affected-release observations, and no target code was executed during this review. Is this the best way to solve the issue? The change addresses lifetime, retry suppression, and unbounded inventory collection at the existing owner, with a complete worker-to-process cutover and relevant regression coverage. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b925e9a7b17f. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceTests +162, Docs +4, Other +82. Total +248 across 5 files. Added test files: 0. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 15, 2026, 9:21 PM ET / October 16, 2026, 01:21 UTC. |
|
Merged via squash.
|
* commit '56c315156f4542f197a2b7f727681ba3f41c21b5': (23 commits) fix(ui): remove stale Lit cleanup from model catalog tests refactor(tests): consolidate iMessage discovery checks (#173624) fix(auto-reply): retire older collect cancellation after admission fix(memory): avoid rebuilding initially empty indexes after restart (#173622) fix(test): preserve subprocess runtime identity (#173446) perf(sessions): batch transcript index reconciliation (#173620) fix(gateway): share GitHub options preparation during reconnects (#173589) perf(control-ui): open the composer model picker without list-wide work (#173275) fix: finish compile-cache cleanup after short CLI commands exit (#173603) refactor(ui): finish native shell rendering (#171554) fix: preserve standalone CLI profiles and settle Doctor shutdown (#173154) refactor: centralize agent memory host typing (#173619) fix: camera fallback picker opens away from the attachment button (#173618) refactor: deduplicate existing CI runner routing with YAML anchors (#172670) fix(ai): preserve multiline Google replies and report malformed streams (#173612) refactor(tests): remove duplicate speech policy test (#173606) refactor(ui): simplify page rendering and derivations (#173608) fix(release): Linux channel promotion fails after a withdrawn Windows companion (#173615) fix(update): wait for native Gateway ownership before restarting (#173588) test(sessions): admit schema probe fixture writes behind maintenance ...
…claw#173603) * fix: finish compile-cache cleanup after short CLI commands exit * fix: preserve synchronous compile-cache imports in CommonJS bundles
* fix(ci): share the iOS screenshot build * fix(ci): preserve the screenshot artifact container on download * merge: integrate main for iOS screenshot workflow conflicts * style(ci): format the combined screenshot evidence changes * docs(ci): name the combined screenshot capture * fix(ios): expose screenshot simulator creation errors * Merge main at 56c3151 to include the UI test cleanup fix * commit '56c315156f4542f197a2b7f727681ba3f41c21b5': (23 commits) fix(ui): remove stale Lit cleanup from model catalog tests refactor(tests): consolidate iMessage discovery checks (#173624) fix(auto-reply): retire older collect cancellation after admission fix(memory): avoid rebuilding initially empty indexes after restart (#173622) fix(test): preserve subprocess runtime identity (#173446) perf(sessions): batch transcript index reconciliation (#173620) fix(gateway): share GitHub options preparation during reconnects (#173589) perf(control-ui): open the composer model picker without list-wide work (#173275) fix: finish compile-cache cleanup after short CLI commands exit (#173603) refactor(ui): finish native shell rendering (#171554) fix: preserve standalone CLI profiles and settle Doctor shutdown (#173154) refactor: centralize agent memory host typing (#173619) fix: camera fallback picker opens away from the attachment button (#173618) refactor: deduplicate existing CI runner routing with YAML anchors (#172670) fix(ai): preserve multiline Google replies and report malformed streams (#173612) refactor(tests): remove duplicate speech policy test (#173606) refactor(ui): simplify page rendering and derivations (#173608) fix(release): Linux channel promotion fails after a withdrawn Windows companion (#173615) fix(update): wait for native Gateway ownership before restarting (#173588) test(sessions): admit schema probe fixture writes behind maintenance ... Co-authored-by: Vincent Koc <[email protected]>
* fix(ci): share the iOS screenshot build * fix(ci): preserve the screenshot artifact container on download * merge: integrate main for iOS screenshot workflow conflicts * style(ci): format the combined screenshot evidence changes * docs(ci): name the combined screenshot capture * fix(ios): expose screenshot simulator creation errors * Merge main at a11e38b to include the UI test cleanup fix * commit 'a11e38b8bb1eb58aaf392a0eab458dbb47aad30f': (23 commits) fix(ui): remove stale Lit cleanup from model catalog tests refactor(tests): consolidate iMessage discovery checks (openclaw#173624) fix(auto-reply): retire older collect cancellation after admission fix(memory): avoid rebuilding initially empty indexes after restart (openclaw#173622) fix(test): preserve subprocess runtime identity (openclaw#173446) perf(sessions): batch transcript index reconciliation (openclaw#173620) fix(gateway): share GitHub options preparation during reconnects (openclaw#173589) perf(control-ui): open the composer model picker without list-wide work (openclaw#173275) fix: finish compile-cache cleanup after short CLI commands exit (openclaw#173603) refactor(ui): finish native shell rendering (openclaw#171554) fix: preserve standalone CLI profiles and settle Doctor shutdown (openclaw#173154) refactor: centralize agent memory host typing (openclaw#173619) fix: camera fallback picker opens away from the attachment button (openclaw#173618) refactor: deduplicate existing CI runner routing with YAML anchors (openclaw#172670) fix(ai): preserve multiline Google replies and report malformed streams (openclaw#173612) refactor(tests): remove duplicate speech policy test (openclaw#173606) refactor(ui): simplify page rendering and derivations (openclaw#173608) fix(release): Linux channel promotion fails after a withdrawn Windows companion (openclaw#173615) fix(update): wait for native Gateway ownership before restarting (openclaw#173588) test(sessions): admit schema probe fixture writes behind maintenance ... Co-authored-by: Vincent Koc <[email protected]>
Fixes #173568
What Problem This Solves
Fixes: Node's compile cache can grow far beyond its 512 MiB target when short-lived CLI commands exit before cleanup finishes.
User Impact
Explicitly cached CLI commands and release prewarming can finish promptly while detached cleanup continues. Maintenance prunes the combined release cache toward 512 MiB and 4,096 files, with seven-day expiry. A large backlog needs multiple bounded passes; concurrent writers can temporarily exceed these targets. Node permission mode continues to skip maintenance.
Why This Change Was Made
The old unreferenced worker died with the CLI after advancing the hourly timestamp, before the full directory walk and sort had reached any deletion. Cleanup now survives that exit, streams and prunes incrementally, and advances the timestamp only after a completed pass. A filesystem lock serializes cleanup; abandoned locks become recoverable after five minutes. Each invocation examines at most 16,384 entries and stops scheduling scan/prune work after 30 seconds. The retained-file bound prevents tiny entries from consuming unbounded metadata or starving later entries on subsequent passes. Eviction prefers the oldest files observed so far; it does not require a complete inventory first.
Captured facts in detached work: the build-qualified path is immutable cache identity and its namespace/type boundaries are checked by the child; permission mode is checked before launch; application preloads are stripped and child caching is disabled; the child reads the current completion timestamp and lock before pruning, and file metadata during traversal; retention limits are fixed policy owned by the same module. No Gateway configuration, session binding, or credentials are used.
Simplification removes the old worker and its completion-Promise tracking. Production code grows to provide process lifetime, serialization, and bounded incremental pruning rather than leaving any of those responsibilities in callers. Exact numstat versus the merge base: production +125/-43 (net +82), tests +276/-114 (net +162), docs +17/-13 (net +4). This uses the campaign LOC escape hatch: the extra production code owns detached lifetime, serialization, and bounded incremental eviction; no unrelated deletion offsets are included.
Evidence
PR CI is the test gate per maintainer policy. It covers the changed cache owner, its regression tests, launcher integration, type checks, and repository checks. Regression tests added or updated:
leaves failed pruning eligible for the next invocation— an injected unlink failure leaves the completion timestamp unchanged, and the next invocation removes the oversized file.makes bounded progress through tiny entries without claiming an incomplete pass— a synthetic 20,000-entry inventory shrinks across two bounded passes without creating thousands of files.prunes an oversized cache after the packaged command exits— a deterministic IPC barrier holds cleanup until the launching CLI exits, then verifies deletion of a sparse 600 MiB entry.remains synchronously importable from CommonJS bundles— bundles and imports the real helper to protect the build boundary exposed by the first CI run.Changed-file
node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.json node-compile-cache.mjs src/infra/node-compile-cache.test.ts test/openclaw-launcher.e2e.test.ts,oxfmt, andgit diff --checkpass. Precommit and prescribed branch Codex autoreviews are both scoped-clean at P0–P2 with no actionable findings. The repository-local review executable is absent, so both used the installed canonical autoreview helper with the requested private temporary directory and review flags. Tests, typechecks, production negative controls, and live Gateway/Crabbox/Testbox proof were intentionally not run locally under the maintainer proof override. No leases were allocated. Local test wall time is therefore not measured; CI owns execution evidence.The initial CI run (38831336877, UI shard 7/7) found a PR-caused CommonJS build failure from top-level await. The follow-up removes top-level await, guards the direct-entry path before evaluating
import.meta.url, and adds the CommonJS regression. On corrected head1b54e5760119454cc6a688769b5e74d9a3c93492, CI run 38832426683 has passed the formerly failing UI shard. The cache test job passed all 13 cache tests (3.26 s Vitest duration, 5.59 s wrapper wall time). The launcher job passed all 135 launcher tests (28.323 s test time, 30.40 s Vitest duration); the new cleanup-after-CLI-exit case took 100 ms. The full exact-head CI run completed successfully: 43 jobs passed, 26 skipped, and no failures, including production/test type checks and lint. ClawSweeper has acknowledged the PR; no P0–P2 code findings were posted as of this verification.