Repository navigation
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
Codex Review Summary: ✅ CompletedThis 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. |
|
@clawsweeper review Please review head |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. What this changesThis PR lets cleanup reclaim disposable scratch clones and abandoned Git repack files while using session completion and live custody to determine idleness. Example: An eligible checkout contains a local clone at .openclaw/tmp/landing/native.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR addresses a concrete disk-reclamation failure and resolves the earlier GC fixture finding; no new actionable code defect was found. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe managed-worktree service consumes registry records, session-owner facts, filesystem inventories, and Git state to preserve active work, snapshot eligible checkouts, and reclaim disposable storage. flowchart TD
Registry[Worktree registry] --> GC[Managed worktree GC]
Sessions[Session custody facts] --> GC
GC --> Inventory[Shared checkout inventory]
Inventory --> Snapshot[Safety snapshot]
Snapshot --> Removal[Checkout removal]
GC --> Packs[Linux temporary pack cleanup]
Technical reviewBest possible solution: Keep the focused repair in the existing inventory, receipt, session-custody, and pack-cleanup owners. Do we have a high-confidence way to reproduce the issue? Current-main source admits scratch clones into nested-repository inspection and short-circuits stopped receipts; the supplied real-Git regressions and measurements describe that failure without an independent execution in this review. Is this the best way to solve the issue? The patch restores reclamation through existing owners without adding a scheduler, cache, schema, or parallel cleanup path, and preserves the relevant custody and nested-repository safeguards. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against abd4b4fc6a82. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +58, Tests +141, Docs 0, Other +41. Total +240 across 17 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. 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 HistoryReview history (1 earlier review cycle)
Reviewed November 19, 2026, 6:47 PM ET / 23:47 UTC (Revision 2). |
|
Addressing the one open item in the review of
The exact CI case fails locally before this correction and passes after it. Changed-file @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…202122) * fix: reclaim stale scratch clones and Git repack leftovers * test: retain an active owner in the snapshot GC fixture
* fix: keep agent temporary files in owned scratch * fix: preserve sandbox temp access and queued isolation custody (cherry picked from commit f91bc99) Release adaptation: keep the staged #202815 Git shim implementation and independently assert both Git shim execution and writable owned temp in its merged Docker/Podman fixture. Use the beta.3 isolated custody configuration (896f33d52174), not ambient sandbox inventory. Companions: #193677 scratch expiry owner is present (99ba844); #202815 is present-equivalent (7d33d1a). #202122 is independent Git/scratch clone reclamation, #202428 is CLI history ownership, #202644 is host file-write authority, and #202874 is workspace cleanup scheduling; none prerequisite. Other later same-path commits concern separate template, sandbox, prompt, sharing, or run-lifecycle policy; see the lane companion audit. Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit a4070bc5b669308210b62a0b80b92c16af768b34)
What Problem This Solves
A local clone created in a managed worktree's scratch directory can make automatic cleanup preserve the whole checkout forever as a nested repository. Those clones keep base Git packs hardlinked, and abandoned repack temporary files are also missed by maintenance.
User Impact
Idle managed worktrees can clean themselves up again, including previously stopped scratch-only checkouts, so their pack hardlinks stop pinning storage. Real user nested repositories and live or queued work remain protected. Completed sessions no longer stay active solely because their activity timestamp is recent. No configuration or migration is required.
Why This Change Was Made
The shared snapshot/nested-repository inventory excludes disposable
.openclaw/tmp/content. Existing stopped receipts are re-evaluated through the existing fingerprint owner, then eligible removals use the normal serial pacing and leases. Session idleness comes from session completion and live custody instead of the worktree activity stamp.On Linux, temporary-pack cleanup also recognizes repack
.tmp-<pid>-pack-*files and sidecars. It requires age over 24 hours, a definitely dead PID, and the existing exclusive file lease and inode checks. Any live or unknown PID is retained, including closed sidecars awaiting publication. Logs report removed file count and apparent bytes; hardlinks elsewhere can still retain physical storage.Evidence
145 focused tests plus the corrected retention case pass across the affected maintenance, GC, snapshot, session-facts, scratch, and Gateway owners. Regressions fail on the exact base for scratch nested-repository detection, automatic re-arming, terminal-session facts, and stale repack selection. A separate Linux production-path test passes with the fix, and a real Git subprocess protects its closed sidecar until exit. Real local clones prove pack nlink drops after cleanup; the unchanged consolidation owner then folds the formerly shared packs.
The overdue snapshot retry fixture succeeds on both base and candidate at attempt five with retryAt six weeks overdue. No retry cap was reproduced, so this change does not invent a scheduler repair.
Worktrees UI boundary checks pass: 28 component tests and five Chromium E2E tests.
pnpm check:changedpasses for the full change and the one-line CI correction. Initial CI caught a retained-checkout fixture that still supplied an idle owner; it now supplies an active owner, preserving every snapshot-retention and lookup-count assertion. The exact failing case reproduces before that correction and passes afterward. Production code is unchanged by this correction. Codex autoreview is scoped-clean with no accepted/actionable P0–P2 findings. Production code grows by 58 lines for PID safety, scratch exclusion, receipt re-evaluation, byte accounting, and terminal owner facts; no new cache or schema.Serial synthetic btrfs A/A controls and A/B measurements use a 62,000-file, 1.14 GB checkout and a separate 35 GiB/5,000-row background SQLite storage fixture. This is a reclamation-cost comparison: the base preserves the clone while the candidate snapshots and removes it. Across five interleaved pairs, first-GC wall median is 110.5 ms before (checkout retained) and 9.31 s after (snapshot saved, checkout removed, pack nlink 2 -> 1). Process CPU medians are 102 ms / 6.17 s; main-isolate allocation medians are 9.68 MB / 961.11 MB. A/A wall controls are 117.3 / 124.1 ms. These numbers measure newly enabled removal work, not a speedup. CPU excludes Git children; allocation excludes worker/native memory. The background DB is not a copied production DB or a claim to exercise the complete agent schema.