Repository navigation
perf(worktrees): retire redundant packs before bounded consolidation - #170935
Merged
steipete merged 1 commit intoOct 13, 2026
Merged
Conversation
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. |
Contributor
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. |
steipete
deleted the
steipete/perf-micro-project-repo-pack-explosion-20260919
branch
October 13, 2026 10:24
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Oct 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Problem This Solves
Large redundant Git packs in managed project repositories can survive indefinitely when they exceed the 512 MiB consolidation rewrite budget or fewer than 16 packs remain.
User Impact
Hourly managed-worktree maintenance can reclaim duplicate transfers without rewriting their objects. Unique objects, worktree/reflog history, kept packs, cruft packs, and promisor classification remain preserved. Updates require no migration; the next maintenance pass applies the repair.
Why This Change Was Made
Before selecting a bounded rewrite batch, publish a MIDX for each eligible promisor class and expire packs with no selected objects. Prefer the largest pack so overlapping transfers can retire smaller redundant copies. Rescan the surviving files and retain the existing bounded consolidation for distinct small packs. Publish one final MIDX covering every remaining pack.
Ordinary project refresh already seeds its isolated transport repository with the managed remote-tracking refs, and default-base fetches already negotiate incrementally. No speculative fetch or agent-exec policy change is included. Repository failures are already isolated by the existing maintenance owner. Unreachable-object retention and cruft handling remain with Git’s existing contracts; this does not add full GC or pruning.
Production LOC: +4 (21 added / 17 deleted). Separate promisor-class expiry and a rescan after deletion are required to avoid displacing promises with ordinary copies; the obsolete initial full-index write and conditional final-index path were removed.
Evidence
Real production maintenance regression: recreate a redundant promisor transfer after consolidation, then run a second pass below the rewrite threshold. It returns to three packs / two promisor markers and preserves the blob and a valid MIDX.
Focused local proof:
pnpm test src/agents/worktrees/service.gc-performance.test.ts src/projects/project-registry.test.ts --maxWorkers=1— 48 passed, 1 Linux-only skip, 233.83 s wall. Changed maintenance file: 99.28 s total; consolidation/regression case: 1.682 s. Per-file CI timing was not collected; full CI passed on the exact head.Changed-file oxfmt, repository oxlint with type-aware rules, and
git diff --checkpassed. No Testbox/Crabbox lease was allocated; broad gates belong to PR CI.Independent subagent review (autoreview route unavailable): no actionable P1/P2 findings. Autoreview preflight refused the requested provider because it did not match the operator configuration; configuration was unchanged.
Isolated Linux sandbox, public repository history and synthetic fixtures, real
refreshProjectCheckout, default-base fetch, and both baseline/candidate maintenance owners: 24 unchanged refreshes created zero packs (4.17 s total). A simulated day with 96 updates and 24 hourly maintenance passes peaked at 6 packs and ended at 333,553 bytes (34.24 s total). The public history was supplied by a separate immutable sandbox object donor; new synthetic remote objects were transferred independently.Corrected large-transfer measurement (forced independent encodings of the same 320 MiB blob): baseline left 8 packs / 671,549,899 bytes unchanged; candidate retired the redundant large pack, leaving 7 packs / 335,979,931 bytes. Reclaimed 335,569,968 bytes without a pack rewrite. Unique-blob size and MIDX verification passed. Baseline maintenance took 4,612 ms including cold state-worker startup; the candidate took 84 ms with warm workers, so these timings are not a maintenance speedup claim.
Identical public seven-day
git log --numstatoutput: 35.75 s before / 36.40 s after (+1.8%, neutral within single-sample noise). This repair targets redundant disk storage and pack lookup rather than Git’s inherent diff traversal cost.Exact-head broad proof: CI run 38381066342 passed on
c0eee93bb7ae2f2d112bcb53cec9b75b8c911d91, including static checks, changed Node lanes, and both UI end-to-end shards. Security review and its final refresh passed. No failed job or CI rerun occurred.Limits: this does not establish the writer responsible for a particular existing repository’s pack backlog, guarantee a fixed pack count for arbitrarily growing unique large packs, or change Git’s inherent
log --numstattraversal cost. The full public seven-day traversal took approximately 41 s even with one donor pack. External Git readers/writers use Git’s existing publication/expiry guarantees; no new cross-process ownership protocol was introduced.