Repository navigation
perf(projects): avoid repeated history downloads for pinned commits - #170970
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ae1add19ed
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "rev-list", | ||
| "--missing=allow-any", | ||
| "--no-walk", | ||
| `${input.commit}^{commit}`, |
There was a problem hiding this comment.
Preserve the partial-clone filter during the explicit fetch
For an existing partial clone configured only with remote.origin.partialclonefilter=blob:none, this new probe suppresses the promisor fetch and falls through to git fetch <URL> <SHA> below. Fetching by URL does not inherit origin's filter; Git requires --filter=<filter-spec> to “request that the server sends a subset of reachable objects” (Git documentation), so the fetch downloads every new reachable blob, including large intermediate blobs deleted before the pinned commit. The regression test masks this by adding a synthetic remote.<url>.partialclonefilter configuration at lines 439–440, which production clones do not have. Read the existing origin filter and pass it explicitly, as refreshProjectCheckout already does.
Useful? React with 👍 / 👎.
What Problem This Solves
Preparing a missing pinned commit in a partial project clone can download its entire commit/tree history again, growing the shared object store and delaying sessions.
User Impact
Missing pinned commits now use the existing incremental fetch. Already-present commits remain usable offline; checkout HEAD, refs, and partial-clone filtering keep their existing behavior. New managed project clones already default to full clones; existing partial clones remain supported.
Why This Change Was Made
The old
cat-file -e SHA^{commit}presence check could initiate Git's promisor fetch before the explicit fetch ran. That implicit transport uses noop negotiation and can transfer all ancestry. The replacement probes one commit withrev-list --missing=allow-any --no-walk, which disables lazy fetching before revision resolution. Disabling the commit graph for this probe preserves the physical-object guarantee required by missing-tip recovery.This replaces the implicit network path rather than adding another fetch owner. Production LOC delta: +9 (11 added, 2 removed). The growth preserves both physical commit verification and offline reuse on Git versions predating the global
--no-lazy-fetchoption, without a version cache or compatibility dispatcher.Related: #170935 handles the resulting pack consolidation. Blob-only lazy fetches from other Git readers remain possible; this change addresses the reproduced pinned-commit writer. Pack mtimes alone do not prove creation time because Git can freshen an existing pack without changing its index/marker.
Evidence
An isolated Linux sandbox used a public 128-commit checkout plus 96 synthetic commits, Git 2.53.0, and the real
ensureProjectCheckoutCommitbefore/after implementations. Session publication was represented by retained session branch refs. No production writes or maintenance occurred.A separate simulated day of 96 fixed pinned requests with 24 hourly calls to the real maintenance owner peaked at 17 packs / 2,103,709 bytes and ended at 1 pack / 2,103,197 bytes (6.31 s total; MIDX verified).
The real maintenance owner subsequently reduced both stores from 97 packs to 1 (before: 2,074,248 bytes; after: 2,103,197 bytes), with valid MIDX coverage. Native batched backfill then hydrated the public historical blobs in 6.89 / 6.91 s. Identical 128-commit
log --numstatoutput (3,173,919 bytes) completed in 3.36 / 3.34 s afterward: neutral traversal cost. Before backfill, missing blobs made both logs fail; this producer fix does not silently hydrate arbitrary historical queries.These are single local-transport samples, not production latency estimates. Each transfer still creates a small promisor pack; the existing maintenance owner handles consolidation. Historical missing blobs and arbitrary agent Git commands are outside this producer fix. Successful production Git launches were not recorded in the inspected journal, so it cannot attribute every historical pack to this one path.
The extended real partial-clone regression fails on old code because the new pack contains the already-present base commit. It passes after the fix, verifies the requested commit, unchanged HEAD, offline reuse, and filtered refresh.
pnpm test src/projects/project-registry.test.ts src/agents/worktrees/git-fetch.test.ts --maxWorkers=1: 53 passed, 91.70 s wall time; file durations 23.47 s and 28.41 s; changed regression 0.767 s. Changed-file oxfmt, repo type-aware oxlint, andgit diff --checkpassed. Full gates run in PR CI; no Testbox/Crabbox lease was allocated.Independent subagent review (autoreview route unavailable): scoped clean, no actionable P0–P2 findings. The provider preflight refused the requested route; no operator configuration was changed. Older-Git compatibility was source-checked, not exercised in a full version matrix. Release-note context: reused partial project clones no longer download redundant history merely to test whether a pinned commit is available.
Full exact-head PR CI run passed on
ae1add19eda24424a6ae0defd490512bc63ee1fd, 614 s workflow wall time. All changed-test jobs, types, lint, docs, and guards passed; per-file CI times were not collected. No failed job or rerun.