Skip to content

fix: preserve partial-clone filtering across shared fetches - #196854

Merged
steipete merged 3 commits into
mainfrom
steipete/fix-base-fetch-promisor-2374
Nov 10, 2026
Merged

steipete merged 3 commits into
mainfrom
steipete/fix-base-fetch-promisor-2374

Conversation

@steipete

@steipete steipete commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: shared blobless project clones accumulate ordinary packs when publication hydrates content, checkout preparation fetches a pinned commit by URL, or an agent fetches from a secondary repository. These packs make later partial-clone maintenance unnecessarily expensive.

Related: #196784. The separate scripts/pr fix landed in #193670.

User Impact

Managed partial clones retain promisor packs across these fetch paths. Agent fetches and pulls in shared blobless clones register Git's standard promisor/filter settings for configured and literal remotes, preserving later reads of peer-only blobs. An explicit --no-filter fetch is refused there; standalone repositories and projections retain their existing choices. No new OpenClaw configuration is introduced.

Why This Change Was Made

Literal URLs do not automatically inherit origin's filter. Publication content hydration also selected --refetch --stdin instead of retaining --filter=blob:none. Both owners now retain filtering. Pinned-commit acquisition reuses the existing project filter reader after its present-commit fast return.

The agent wrapper lets native Git select named remotes, groups and all/multiple fetches; Git rejects a top-level filter option for multi-remote fetches. Durable Git promisor registration is necessary for subsequent peer-only blob hydration. Relative fetch URLs are anchored using Git’s native transport cwd and URL-rewrite resolution, so other linked worktrees can use those promises; distinct additional URLs and push URLs are preserved. The existing config read supplies an invocation-local snapshot, so correctly configured remotes incur no config writes. One argument scan replaces the previous three scans.

Evidence

Native regression tests fail on the original owners with an ordinary pack missing its .promisor marker. All 85 tests across the four affected files pass, including installed exec → native Git, remote groups, --all, --multiple, URL/path operands, upload-pack option values, pulls, subsequent peer-only content reads, and standalone behavior. Hosted review caught two additional regressions before landing: cross-worktree hydration through relative peers, and missing trees revealing previously unknown blobs. Both now have failing-before/passing-after native proof. Publication hydration needs at most two filtered batches when trees are absent; blob-only hydration retains identical Git argv and pack bytes.

On a synthetic fixture with 13,006 refs and 1,054 packs, pinned-commit acquisition falls from 9 objects / 3,147,341 bytes to 6 commits-and-trees / 623 bytes. Median wall time falls 358→254 ms and native CPU 310→170 ms. The additional config command raises JS CPU 11.27→15.33 ms and sampled allocation 1.08→1.52 MB; already-present commits still use one offline command and no config read or fetch.

Publication hydration transfers the identical requested blobs and pack bytes before/after, now with the promisor marker. Five paired trials and A/A controls show no demonstrated speedup: median wall 392→408 ms, JS allocation +0.9%, with host-tail contention.

The corrected small local explicit-fetch fixture measures 6→9 Git processes and 46.78→47.97 ms child CPU; wall medians 69.77→103.98 ms, with A/A 68.69 ms. This is added fetch-policy overhead on macOS, not a production Linux latency claim. Subsequent correctly configured fetches make zero config writes. A separate qualified Linux Git allocator interposer reports 2,374→3,586 allocation requests and 5,248,735→5,530,696 cumulative requested bytes per explicit fetch; all five A/B/A2 samples match exactly, with A2 identical to A. These counts exclude shell/Python, mmap and hidden libc allocations and do not measure retained memory. The already-present content path still returns before fetch policy and remains two Git processes with no network or pack changes; its earlier path-specific A/B/A2 control was within noise.

The exact base-root git diff --quiet <a> <b> -- <path> with two missing commits was separately verified through exec → Python bare git: 36 objects without the wrapper, 6 with it, all promisor; changed and unchanged paths retain native exit codes. The already-merged revision preparation needs no further diff change.

Production growth is 104 lines; tests grow 102 lines with an exact scoped allocation. The growth covers shared native fetch selection, usable promisor registration, and one reused project filter reader; there is no new cache or transport staging layer. The separate scripts/pr authoritative-fetch correction is merged in #193670.

Fresh independent Codex autoreview through P3 is scoped-clean after both hosted-review corrections. The corrected pnpm check:changed run completed: types, formatting and the other guards pass. It caught a test-only no-shadow error, which was corrected and passed targeted lint/format checks. The remaining repository-wide dead-export scan fails on 33 production / 9 full-tree entries. The canonical checker reproduces identical entries on exact parent 2a41138, with no module-resolution errors; the causal attribution reuses prior lane evidence, with the new diagnostics export identified below. The test-line guard reproduces the same 128-line deficit on exact parent 2a41138ac9d467e12b33d8981cafe7d13ad6d019 (6,635,428 lines / 6,635,300 ceiling); this PR adds exactly 102 lines and 102 allocation. That deficit was introduced by #196346 (b91520c), not this change. The newly detected unused projectLeaseDiagnosticFrames export originates in 2c4e34a72f490c710bc155319fcabf872f482b3e and is a main regression requiring separate repair. No live shared clone was modified for this proof, and the historical observed packs cannot be assigned to a particular caller from the available logs.

@clawsweeper

clawsweeper Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 10, 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-10T21:12:40.124707Z b979326 New commits
ℹ️ 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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime size: M labels Nov 10, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8995833fba

ℹ️ 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".

Comment thread src/infra/agent-git-shim.ts Resolved
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 10, 2026
@clawsweeper

clawsweeper Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Preserves filtered promisor packs during publication hydration, pinned-commit acquisition, and agent fetches in shared blobless clones.

Example: An agent runs git fetch peer contributor-pr in a shared blobless clone, then reads fork.txt from another linked worktree.

  • Before: The fetch can import ordinary packs and eagerly download blobs.
  • After: The fetch retains promisor packs, and the other worktree can hydrate peer-only content through a stable remote URL.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Useful, focused repair with native transport regressions, documented compatibility evidence, resolved earlier findings, and passing exact-head CI.
Proof confidence 🐚 platinum hermit (4/6) Maintainer-authored PR outside the ordinary contributor proof gate; supplied evidence covers installed exec → native Git, peer-only cross-worktree reads, publication blob/tree hydration, and pinned acquisition using synthetic local repositories.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Shared partial clones download unnecessary blobs and accumulate ordinary packs that make later repository maintenance expensive.
Reason: The source establishes the filtering omissions, and the maintainer-authored direction accepts the disclosed fetch-policy cost while preserving standalone behavior.

Merge readiness

✅ Ready for maintainer review

This PR addresses a current partial-clone defect through the existing fetch owners; both earlier findings are resolved, no actionable defect remains, and the exact-head CI gate passes.

Priority: P2
Reviewed head: b979326ec8e2df03a829962b8642ac45c34c9eda

Before merge

None.

Findings

None.

Agent review details

How this fits together

Agent exec, project preparation, and GitHub publication invoke native Git to acquire repository objects; their existing transport owners control filtering, remote registration, and content readiness.

flowchart TD
  A[Agent exec] --> B[Git PATH shim]
  C[Project preparation] --> D[Project Git transport]
  E[GitHub publication] --> F[Publication Git transport]
  B --> G[Native Git]
  D --> G
  F --> G
  G --> H[Shared promisor object store]
Loading

Technical review

Best possible solution:

Retain filtering in the existing fetch owners, with stable promisor transports and complete content hydration.

Do we have a high-confidence way to reproduce the issue?

The base source omits filtering for publication content hydration and pinned URL fetches, while shared secondary-remote fetches lack consistent promisor registration; native regressions and the author's before/after records cover these paths, but this read-only review ran no target code.

Is this the best way to solve the issue?

This is a complete repair using the existing shim and transport owners; the extracted project filter reader avoids duplicate policy, and the added test cases protect distinct native Git boundaries.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against a2879ad0a140.

Provenance checked

  • Agent fetch defaults and shared-history policy changes intended behavior with a stated reason (fix: avoid full-history downloads when agents fetch fork PRs #195516: Filter GitHub fork fetches while preserving explicit choices; subsequent shared-history and projection repairs kept native standalone semantics.)
  • Publication content hydration keeps the original intent (ac5faa4: Prepare selected-base and merge-base contents through the authenticated transport before offline integration; the patch preserves that invariant while retaining promisor markers.)
  • Managed project filtering and pinned-commit acquisition keeps the original intent (f24dd3f: Preserve the managed clone's filter when isolated transport cannot inherit origin settings; the patch reuses that reader for missing pinned commits and retains the offline present-commit fast path.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Pinned introduction and current-main comparison: The introduced diff changes the three existing fetch owners; fetched main retains their pre-fix implementations, so the central repair remains necessary. (src/infra/agent-git-shim.ts:343, b979326ec8e2)
  • Earlier findings resolved: Relative remotes are resolved through Git and anchored before persistent registration; publication hydration inventories again after fetching missing trees and permits a second filtered batch for their blobs. Native regressions exercise cross-worktree hydration and treeless content preparation. (src/gateway/github-publication-git-transport.ts:299, b979326ec8e2)
  • Persisted Git-state compatibility: The author's compatibility report preserves refs, exact shallow bytes, existing pack files, unrelated settings, secondary URLs, push URLs, and older content across the latest-stable Git boundary and a fresh-current control. REST inspection confirms that v2026.11.3 installs only the OpenClaw launcher, without the agent Git shim; the locally unavailable release blob was read through GitHub. (src/infra/openclaw-cli-shim.ts, 847611dcaa3b)
  • Owner direction and disclosed tradeoffs: The maintainer-authored PR explicitly adopts durable promisor registration and refusal of --no-filter in shared blobless clones, while retaining standalone choices; its body discloses increased explicit-fetch overhead and makes no publication speedup claim. (src/infra/agent-git-shim.ts:344, b979326ec8e2)
  • Exact-head checks: The live status reports that CI and applicable security review requirements passed; dependency review and security-sensitive review also report success. (b979326ec8e2)
  • Related repair has a distinct owner: fix(pr): landing stalls fetching pinned commits in large partial clones #193670 repairs the analogous literal-URL filtering omission in scripts/pr; it does not replace this PR's application-runtime changes. (src/projects/project-clone-runtime.ts:552, 641fe081c95b)

Likely related people:

  • Peter Steinberger: Raw commit 3f5ace1 adds src/infra/agent-git-shim.ts:109 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 3f5ace1fe144; files: src/infra/agent-git-shim.ts)
  • Shakker: Raw commit ac5faa4 adds src/gateway/github-publication-git-transport.ts:199 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: ac5faa479233; files: src/gateway/github-publication-git-transport.ts)

PR surface

Source +104, Tests +102, Docs +1, Other +2. Total +209 across 9 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 3 139 35 +104
Tests 4 109 7 +102
Docs 1 1 0 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 0 +2
Total 9 251 42 +209

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Production versus regression growth Production +104 net lines; tests +102 net lines Growth remains within existing owners and fixtures, covering native remote selection, stable promisor registration, and distinct hydration failures.
Explicit-fetch overhead 6 → 9 Git processes in the reported local fixture The maintainer-authored body explicitly discloses this cost of preserving usable shared-clone promises.

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: The defect causes unnecessary object downloads and expensive partial-clone maintenance across bounded repository workflows.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (2 earlier review cycles)
  • reviewed 2026-11-10T20:57:09.639Z sha 8995833 :: blocked before merge. :: [P2] Persist a stable transport for relative repository operands | [P2] Complete hydration of blobs revealed by missing trees
  • reviewed 2026-11-10T21:15:18.378Z sha b979326 :: needs maintainer review before merge. :: none

Reviewed November 10, 2026, 4:27 PM ET / 21:27 UTC (Revision 3).

@steipete

steipete commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor Author

All three items from ClawSweeper’s earlier review, including the two hosted Codex findings, are addressed on b979326ec8e2df03a829962b8642ac45c34c9eda:

  1. Relative remotes across linked worktrees (finding): URL resolution and anchoring now use Git's native URL rewrites and transport cwd. Fetch and pull retain their distinct setup behavior; literal replacement preserves distinct secondary URLs and push URLs. The native regression hydrates peer-only content from an actual separate linked worktree. It fails with exit 128 on the prior head and passes after repair. Ten additional actual-shim cases verify root/subdirectory, -C, explicit gitdir/worktree and bare-repository behavior.

  2. Blobs revealed by missing trees (finding): bounded hydration now permits at most two filtered batches. The tree fetch reveals blobs, then explicit blob wants complete the snapshot. The treeless table case fails at content verification on the prior head and passes with two promisor packs. The ordinary blob-only case retains byte-identical Git argv and pack details, with one fetch.

  3. Data-model compatibility: added a persisted-state compatibility check from v2026.11.3’s actual Git boundary to this head, plus a fresh-current control. That release installs only the OpenClaw launcher and has no agent Git shim, so its verified Git boundary is native Git. On the same existing clone, both cases preserve retained refs, exact shallow bytes, unrelated settings, secondary/push URLs and older content. All 11 old pack/index/marker files in the upgrade case remain byte-identical, including its ordinary pack; the fresh control preserves all 16 existing files. New peer objects arrive in promisor packs and their deferred blobs hydrate correctly from another worktree. The transport stabilization changes only the intended standard Git settings. There is no application DB/schema/data-format migration. This is native Git-store compatibility proof, not a full installer or live application-upgrade claim.

All 85 affected tests pass. Fresh full-candidate Codex review through P3 is clean; the subsequent test-only shadowed-variable rename also passed focused lint, formatting and an independent mechanical-change review. The corrected changed-file run's known baseline dead-export failures and exact-parent attribution remain disclosed in the PR body. The 102 added test lines have exactly 102 allocation; the separately reproduced 128-line baseline debt is unchanged. Updated CPU/allocation/A/A evidence is in the PR body.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 10, 2026
@clawsweeper

clawsweeper Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 10, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Nov 10, 2026
@steipete
steipete merged commit 9623635 into main Nov 10, 2026
155 of 157 checks passed
@steipete
steipete deleted the steipete/fix-base-fetch-promisor-2374 branch November 10, 2026 21:31
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 11, 2026
…#196854)

* fix: preserve partial-clone filtering across shared fetches

* fix: hydrate promised content across worktrees and treeless clones

* test: avoid shadowing publication hydration mode
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 gateway Gateway runtime P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant