Repository navigation
fix: batch content searches across shared Git history - #197448
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: needs maintainer review before merge. What this changesThis PR extends the existing Git shim to batch missing objects for content searches across shared blobless worktrees. Example: Run git log --oneline -S gateway HEAD across the recorded 3,091-commit OpenClaw fixture.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR is ready for normal landing: no actionable findings remain, and the owner explicitly accepted the measured performance tradeoffs for the reviewed head. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe Gateway installs a PATH-based Git shim for agent commands; it discovers missing repository objects, coordinates fetching across linked worktrees, and then executes the original Git command. flowchart TD
A[Agent Git command] --> B[Existing PATH shim]
B --> C[Offline object discovery]
C --> D[Shared repository lock]
D --> E[Bounded native Git fetches]
E --> F[Original Git command]
Technical reviewBest possible solution: Land the existing-owner batching change with its bounded fetch requests and preserved speculative discovery limits. Do we have a high-confidence way to reproduce the issue? Current-main source excludes pickaxe searches and abandons oversized discovery; the supplied native Git measurements establish the resulting fetch storm, and no target code was executed during this read-only review. Is this the best way to solve the issue? The patch is the smallest complete extension of the existing owner: classify supported content reads, discover their objects, and fetch bounded batches under the shared lock while retaining native fallback. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 55cac5900c15. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +75, Tests +27, Docs 0, Other +36. Total +138 across 5 files. Added test files: 0. View PR surface stats
Preflight sourceSource 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
LabelsLabel changes:
Label justifications:
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 HistoryReviewed November 11, 2026, 9:37 PM ET / November 12, 2026, 02:37 UTC (Revision 3). |
Codex Review Summary: ✅ CompletedThis 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: 1da520e9ac
ℹ️ 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".
|
Final review response for head
Focused regressions, lint/format and independent Codex autoreview pass. Full CI on the preceding source head passed; the final metadata-label head's CI is running. The PR body now describes the final bounded implementation and complete available evidence. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Lead/owner decision for lane 2425: the measured tradeoffs are accepted, and landing is authorized for head
The lead's rationale:
The implementation remains at the existing owner: bounded fetches under the shared lock, with speculative show/blame caps preserved. No source change follows this decision. Exact-head CI run 43139667087 passed, and native PR preparation completed at this head. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
* fix: batch content searches across shared Git history * fix: bound shared history prefetch pack construction * fix: retain bounded discovery for line-limited blame * fix: label Darwin benchmark CPU accounting scope
What Problem This Solves
Agent content searches in shared blobless worktrees bypassed the history-prefetch owner from #197259, causing thousands of native Git lazy fetches and tiny promisor packs. This extends that owner; shared-base consolidation from #197287 stays in place.
User Impact
The existing PATH shim now batches
log -S/-G(with pickaxe modifiers), range-wide patch/stat/numstat logs, endpoint diffs, and explicit-revision grep. Pathspecs remain scoped and the original command still runs unchanged. Large searches print a short object-count notice and continue through batches of at most 2,048 missing objects under the same shared lock. There is no new configuration, cache, schema, dependency, or fetch owner.Why This Change Was Made
The classifier previously prepared only path-scoped logs, blame, and speculative
show rev:path, abandoning history discovery above 2,048 candidates. Range-wide searches now enumerate raw old/new blob IDs; grep enumerates the requested trees. Missing objects flow through the existingfetch --stdinoperation, with bounded requests and one lock across the complete operation. Readers wait for a live lock owner beyond thirty seconds; ownerless locks retain the existing bounded fallback. Show and blame retain their speculative discovery bounds.Pickaxe
-n/--max-countlimits count matching commits, so discovery cannot stop at the first N commits. This can prefetch more history than an early successful search would require. Unsupported argument forms retain native Git behavior.Evidence
Acceptance rule: preserve command output and object scope, eliminate per-blob transport overhead, and measure cold/warm behavior separately with A/A controls. Bound large requests without falling back to a fetch storm. Any worse metric is disclosed for explicit owner acceptance; this is not a claim of universal improvement.
Final bounded candidate, native macOS, real public OpenClaw history: 3,091 commits through
477fa49a30c4e00241f7d650115eb12418471d3f. Each arm uses a freshblob:noneclone and registered linked worktree served by a read-only local source.git log --oneline -S gateway HEADreturns the same 410 matches and SHA-25647f61c98b1f3de3dfe9201fc9a3b1db6d1f76ccd3125a04b229cd27d480ad24c.One real-history A/B pair, not a latency distribution. A mid-baseline snapshot found a median of two objects per pack. Setup/hydration are outside measurement. The initial clone advertises filtering; subsequent blob-only local fetches emit an unsupported-filter warning, included in baseline timing. Both arms nevertheless transfer exactly the same 22,112 blobs. No production data or production deployment is involved.
Darwin
/usr/bin/timeloses pre-exec child CPU when the shim execs Git, so the candidate's original 2-second counter is not whole-flow CPU. A calibrated per-command timing proxy recovered 18 receipts including all 11 fetches, totaling 26.72 CPU seconds on a separate candidate run with identical counts/output. The baseline counter is a conservative lower bound because its final Git process owns the lazy-fetch children. This supports at least 98.1% less CPU. Instrumented wall time is not substituted for the primary wall measurement. The committed benchmark now labels Darwin's narrower CPU scope.Five serial counterbalanced native synthetic A/B pairs use 62,000 stable paths / 1.116 GB logical workspace and 600 distinct historical versions:
All synthetic cold pairs preserve stdout and 601 transferred blobs. Cold A/A: 49.651 → 51.788 seconds with identical work counts. Warm A/A: 578.691 → 478.196 ms, two Git starts and zero transports in both arms. Shared-host load varied; work counts are stronger evidence than wall tails. Native synthetic CPU counters cover post-exec work only and are not used as full-flow claims.
Tradeoffs explicitly accepted by the lead/owner for lane 2425: warm median latency increases 65.2% (about 345 ms), and final Git peak footprint increases 64.8% (about 89 MB). Sampled client-tree RSS decreases, while the local serving process uses more memory to construct batches. Cumulative allocation remains unmeasured: the container runtime disappeared, a native allocator probe failed calibration, and standard profiling tools stalled. No unqualified allocation numbers are claimed. An earlier unbounded-batch RSS increase motivated the final 2,048-object request bound; the table above supersedes that intermediate result.
Reproduce using the existing committed workload:
Use
--warmfor hydrated reads and--aa-only --samples 1for controls. Role-separated RSS and qualified Darwin CPU use supplementary local sampling/proxy receipts; the committed workload reproduces the command and transport counts.Validation and Review
The extended regression fails nine pack-count assertions on the unchanged parent while preserving stdout. The focused owner suites pass (5 tests). The final history suite passes all 3 tests, including path scoping, pickaxe result limits, concurrent overlapping readers, offline behavior, speculative show/blame bounds, and 2,049 missing objects in exactly two packs with no duplicate wants.
Codex autoreview found a
grep -Gparsing collision; its two-pack regression is fixed. Hosted Codex review found the unintended loss of the existing blame discovery cap; ablame -Lregression reproduced 2,048 unnecessary requests, and the correction restores one requested blob. Independent final code and benchmark-metadata autoreviews are scoped-clean through P2.pnpm check:changedpassed before the bounded-request follow-up. On final head, its typechecks, lint, formatting, dead-export scans and other guards passed, but four guards failed to resolve the sharedorigin/mainref (one was warning-only). Those four guards then passed against the same pinned parent27af644cbfeebc86118b6abc8ebbbabdcec44499. The failed overall invocation is retained as an infrastructure interruption, not described as an inherited code failure or an entirely clean replay. Affected tests, diff checks and the test-line ratchet pass. Nativescripts/pr prepare-runcompleted on the unchanged final head. Exact final-head CI 43139667087 passed, including the CI gate, without failures or reruns. ClawSweeper reviewed final head0b2e160035c61d3cf52313489f9463fff1cafeccwith no actionable code findings; its sole unchecked item requested explicit owner acceptance of the measured performance tradeoffs. The lead has now accepted the measured warm latency, final Git footprint and transient serving-tree RSS costs, with allocation totals remaining a disclosed limitation. Acceptance is limited to these measured values; later regressions beyond them require re-review. A numbered response records the decision and requests ClawSweeper to clear the item. No UI-imported modules changed.Production growth is 75 net lines for classifier/discovery semantics, live-lock waiting, and bounded pack construction. The 27 net test lines extend existing real-Git fixtures. No new subsystem or production cache is introduced.