Skip to content

fix(pr): avoid full-history downloads for unseen checkout commits - #194577

Merged
steipete merged 1 commit into
mainfrom
steipete/perf-micro-pr-worktree-lazy-fetch-full-history-20260919
Nov 7, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/perf-micro-pr-worktree-lazy-fetch-full-history-20260919

Conversation

@steipete

@steipete steipete commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: PR preparation downloads the repository's entire reachable commit/tree history when a blobless clone encounters a commit it has not fetched yet.

User Impact

Maintainers preparing PRs in partial clones avoid duplicate history downloads and the associated disk, CPU, and checkout delay. No configuration or migration is required.

Why This Change Was Made

A revision lookup can silently perform Git's promisor lazy fetch, which sends no local-history negotiation. The checkout owner now resolves locally first and acquires a missing commit through its existing filtered canonical fetch owner. Existing batched blob hydration stays in place; final checkout disables lazy fetching. A changed reviewed preparation head hydrates its blobs before checkout.

Hosted-CI reuse had the same presence-probe bug and now explicitly fetches missing commits without changing tags or FETCH_HEAD. Product worktree readers already suppress lazy fetching. The separate merge-admission filter repair in #193670 is intentionally left to that PR.

Production growth is eight lines: the missing negotiated acquisition, a cold-blob prerequisite, and the hosted probe fix. No new helper, cache, dependency, schema, or config. The standalone synthetic benchmark is 203 lines; two real partial-clone regressions add 53 test lines with a matching scoped allocation.

Evidence

Acceptance: advertise haves, remove repeated history transfer (>99% fewer pack bytes), preserve checkout/filter/checkpoints, and improve wall/CPU without >20% peak-RSS growth.

The committed scripts/perf/pr-worktree-fetch.py exercises the actual checkout owner against a local synthetic blob:none clone with 126,357 existing commits and 884,499 trees, followed by one missing PR-like commit. Five counterbalanced A/B pairs plus two A/A pairs used fresh object stores and equal packet tracing.

Metric Before After
Pack bytes, every sample 54,880,025 531
Received objects 1,010,865 9
Negotiation haves 0 16
Median owner wall 6,767 ms 838 ms
Median native CPU 6,890 ms 770 ms
Median peak RSS 397.4 MB 49.1 MB

Pack bytes fell 99.999032%; only the new commit, seven trees, and one blob were received. Both arms still fetched the required checkout blob. Every run preserved config/filter, FETCH_HEAD, and origin/main. A/A wall pairs were 6775/6493 and 6530/6414 ms with identical byte/object counts. Wall min–p95/max was 6472–8511 ms before and 596–2162 ms after (five samples; shared-host scheduling noise).

Reproduce with:

python3 scripts/perf/pr-worktree-fetch.py /absolute/new/fixture \
  --baseline-root /absolute/baseline/source \
  --candidate-root /absolute/candidate/source
  • Both regressions failed before the fix: checkout advertised no haves; hosted-CI reuse downloaded an already-local base commit. Both pass afterward.
  • 97 wrapper tests passed (258.46 s); 81 hosted-gate tests passed (3.30 s); six main-refresh/filter/checkpoint cases passed (98.66 s). The added hosted regression took 481 ms; the strengthened cold-blob regression took approximately 3.2 s. CI runtime is pending.
  • Shell syntax, benchmark parse, changed-file formatting, script typecheck, and root-test typechecks passed. Codex autoreview with complete owner context is scoped-clean at P0–P2.
  • pnpm check:changed --base HEAD found 20 historical changelog-attribution violations, reproduced with identical output on the exact main parent 3f2e7078de23a41f21f14f57e76523be5c165f11. The signature was introduced by 266a7aa0fe69 / fix(release): align attribution gate with human credit policy #194364: the four affected files pass on that commit’s parent and fail afterward. That parent had different pre-existing human-credit failures, so it was not globally green. This is an actionable main regression for the release/changelog owner, not a waived or passing check. All remaining changed checks passed, including formatting, script/root-test types, script/root-test lint, and all three dead-export scans. The aggregate exits 1 solely on that attributed main regression.

Limits: macOS, Git 2.56.0, local file transport, compact synthetic trees, and one tracked checkout file. This models history amplification rather than absolute production bytes, a large workspace, database load, btrfs, concurrent callers, or GitHub latency. CPU includes the local server; peak RSS is not cumulative allocation, which was not measured. The existing Git compatibility policy is unchanged (GIT_NO_LAZY_FETCH requires Git 2.45+). No production host was accessed.

Materialize missing checkout and CI-reuse commits with normal fetch negotiation before local-only probes and checkout. Preserve partial-clone filters and private FETCH_HEAD, and reuse existing batched blob hydration.
@clawsweeper

clawsweeper Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review ended

ClawSweeper stopped reviewing this revision because the pull request closed.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation scripts Repository scripts size: M labels Nov 7, 2026
@steipete
steipete marked this pull request as ready for review November 7, 2026 10:07
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-07T10:09:11.501275Z 2548674 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@steipete
steipete merged commit 2cc89da into main Nov 7, 2026
177 of 180 checks passed
@steipete
steipete deleted the steipete/perf-micro-pr-worktree-lazy-fetch-full-history-20260919 branch November 7, 2026 10:18
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 8, 2026
…enclaw#194577)

Materialize missing checkout and CI-reuse commits with normal fetch negotiation before local-only probes and checkout. Preserve partial-clone filters and private FETCH_HEAD, and reuse existing batched blob hydration.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation scripts Repository scripts size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant