Repository navigation
fix(projects): prevent automatic Git repacks in managed clones - #182086
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. |
5a7db0b to
a637006
Compare
|
Codex review: blocked before merge. What this changesPersist Git maintenance suppression and packing limits in Gateway-managed clones, including existing clones when reused or refreshed. Example: A linked worktree runs git commit after clearing GIT_CONFIG_PARAMETERS and GIT_CONFIG_COUNT.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 1 item remains Keep open: this maintainer-authored PR closes a source-confirmed gap in managed-clone maintenance policy, with no concrete introduced correctness defect found. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherGateway project materialization owns managed clones and their lifecycle leases; repository-local Git policy governs ordinary commands, while the existing hourly worktree cleanup owner performs explicit bounded maintenance. flowchart TD
A[Gateway project request] --> B[Project clone owner]
B --> C[New managed clone]
B --> D[Existing checkout lifecycle lease]
C --> E[Shared local Git configuration]
D --> E
E --> F[Linked worktree Git commands]
G[Hourly cleanup owner] --> E
Technical reviewBest possible solution: Keep persistent policy in the existing managed-clone owner and retain the existing bounded hourly maintenance scheduler. Do we have a high-confidence way to reproduce the issue? Current-main clone provisioning persists no suppression policy, so clearing injected Git settings exposes Git defaults; the PR supplies real-Git regression cases and reports base failures, but this read-only review ran no target code. Is this the best way to solve the issue? This addresses the policy at its existing repository owner, preserves operator-registered repositories, and adds no competing scheduler or state store. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 516a142b102f. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +52, Tests +85, Docs +11, Other +267. Total +415 across 7 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 23, 2026, 10:30 PM ET / October 24, 2026, 02:30 UTC. |
Persist repository-local maintenance policy at clone creation and adopt existing managed projects under the checkout lease. Retain the bounded hourly worktree maintenance owner and preserve operator-registered repository configuration.
a637006 to
5386927
Compare
…law#182086) * fix(projects): prevent automatic Git repacks in managed clones Persist repository-local maintenance policy at clone creation and adopt existing managed projects under the checkout lease. Retain the bounded hourly worktree maintenance owner and preserve operator-registered repository configuration. * test(projects): isolate maintenance configuration in environment fixtures * test(projects): prune the retired clone runtime mock exception
What Problem This Solves
Fixes detached, memory-heavy Git auto-repacks starting from ordinary commits or fetches in Gateway-cloned projects when a command clears the injected agent environment.
User Impact
New managed clones and existing clones reused or refreshed after an update retain repository-local maintenance policy, including in linked worktrees. Operator-registered repositories keep their Git configuration. No OpenClaw configuration or Doctor migration is needed; existing clones are adopted lazily under their checkout lifecycle lease.
Why This Change Was Made
Agent environment suppression already exists. Persisting
maintenance.auto=falseandgc.auto=0makes the repository own that policy. Managed clones also setpack.threads=1andpack.windowMemory=64m; the window bounds delta-search memory per thread, not total RSS.The existing hourly worktree owner remains the only automatic maintenance scheduler. It already consolidates small packs in sequential batches of at most 512 MiB, with one thread, no new delta search, lower CPU priority, idle I/O where available, and cancellable subprocesses. This change introduces no replacement scheduler, cache, schema, or fallback reader.
Production delta: +52 lines (53 added / 1 removed in
src/projects); the growth implements persistent policy and its existing-clone adoption boundary. Tests add 85 lines; the rerunnable synthetic measurement script adds 268 lines. There was no superseded production path to delete.Evidence
node scripts/run-vitest.mjs src/projects/project-registry.test.ts src/projects/project-clone-runtime.test.ts --maxWorkers=1: both files pass. Registry file: 52.57 s, mostly existing large-ref inventory cases; the three new regressions take about 2.1 s. Additional operator-policy case passes (about 0.7 s). CI initially found a missing mocked export in the Windows environment-routing fixture; the mock is corrected and all 18 tests in that file pass locally (0.76 s). The test-only repair received a clean independent review. CI then requested removal of the now-obsolete mock exception. The owning generator pruned exactly that one entry (7,129 → 7,128); independent review confirmed the shrink-only change. Prior-head CI run 40052653193 passed ona637006e60be738f7395da483cf6293b40b6c27a. After a patch-identical rebase onto latest main, CI run 40055190091 passed on head5386927a988e633d7fe1ee437033cc736d7f6136.pnpm tsgo:corepasses using tsrs. Export-name collision guard passes. Eager-import and PR-wrapper closure tests: 22 pass.Measurement acceptance and status
Acceptance was recorded before measurement: ordinary commit/fetch launches zero automatic maintenance children; owner maintenance consolidates a synthetic 128 MiB / 4,096-blob / 32-pack repository without losing objects, running full GC, detaching, or accessing a network. The script verifies blob identities/sizes and runs
git fsckafterward.RSS bound unmeasured. The maintainer explicitly approved landing this incident reliability fix based on the real-Git red-to-green suppression regressions; RSS measurement is supporting evidence, not a landing gate. No throughput or total-RSS guarantee is claimed. Four 128 MiB fixtures were prepared, but no measurement ran while the authorized sandbox was overloaded. Benchmark slots are now closed, so no further measurement is scheduled. The existing maintenance owner is unchanged. After SSH recovered and both memory-pressure avg10 readings were 0.00, the queued task process tree was stopped and the task sandbox was removed; no benchmark was started. No local fixture was available for a cheap optional RSS run.
Sibling audit: skill and marketplace Git clones are temporary; installed skill exports strip
.git; session cold storage is not Git. Git plugin updates replace their checkout with a fresh clone instead of accumulating fetch packs. Operator-owned Git backups are a separate follow-up because their commits can trigger auto-GC; this PR does not change that ownership contract.