Repository navigation
fix: avoid base hydration timeouts in large partial clones - #189288
Conversation
Keep the repository-wide promisor membership scan at snapshot retirement, where it protects missing locally authored content, instead of running it for every creation that needs an object batch. Preserve exact-object fetches, local checkout validation, authority checks and existing preparation reuse. Include the thrown error class and innermost phase in preparation receipts without logging command output or changing the original exception. Regression proof covers creation scan counts and failure receipts; native snapshot safety tests retain local-object loss protection. A 62,000-file synthetic fixture cuts median hydration wall time from 1.72 s to 0.77 s and native Git CPU from 1.19 s to 0.25 s with identical checkout byte totals.
|
🦞👀 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 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. |
|
Codex review: needs maintainer review before merge. What this changesThis PR moves promisor classification into snapshot capture and adds failure class and phase to worktree preparation diagnostics. Example: Create a worktree from the supplied 62,000-file partial-clone fixture with one missing blob and 600,000 unrelated historical blobs.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Regression provenanceRegression provenance — verified: source commit Merge readiness✅ Ready for maintainer review Keep open: this PR addresses a current-main creation regression while preserving snapshot safety; no actionable introduced defect was found. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherManaged-worktree preparation resolves a selected Git commit, hydrates missing contents, and estimates checkout capacity; snapshot capture separately verifies that missing local data cannot be mistaken for promised contents. flowchart TD
A[Worktree request] --> B[Base preparation]
B --> C[Shared object hydrator]
C --> D[Exact object fetch]
D --> E[Local sizing and checkout]
F[Snapshot removal] --> G[Promisor classification]
G --> C
Technical reviewBest possible solution: Keep exact-object acquisition shared, confine promisor classification to snapshot capture, and preserve original exceptions while recording preparation failure details. Do we have a high-confidence way to reproduce the issue? Current-main creation reaches the global promisor classification, and Git source confirms its repository-wide initialization; the supplied native fixture reports the extra scan before the fix, but this read-only review ran no reproduction. Is this the best way to solve the issue? The patch fixes the misplaced responsibility directly, retaining existing hydration, local validation, and snapshot-loss protection without adding a cache, timeout, or competing owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 3f8bff35bba2. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +29, Tests +15, Docs +11, Other +176. Total +231 across 9 files. Added test files: 0. View PR surface stats
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 Reviewed October 31, 2026, 6:39 AM ET / 10:39 UTC. |
|
Merged via squash.
|
…189288) Keep the repository-wide promisor membership scan at snapshot retirement, where it protects missing locally authored content, instead of running it for every creation that needs an object batch. Preserve exact-object fetches, local checkout validation, authority checks and existing preparation reuse. Include the thrown error class and innermost phase in preparation receipts without logging command output or changing the original exception. Regression proof covers creation scan counts and failure receipts; native snapshot safety tests retain local-object loss protection. A 62,000-file synthetic fixture cuts median hydration wall time from 1.72 s to 0.77 s and native Git CPU from 1.19 s to 0.25 s with identical checkout byte totals.
What Problem This Solves
Fixes managed-worktree creation timing out during base hydration in large partial clones, with no failure class or phase in the preparation receipt. Related: #188525.
User Impact
New worktrees hydrate the selected commit's missing contents without scanning unrelated promised packs. Failed preparations report their error class and innermost timed phase. Snapshot removal still refuses missing locally authored data and preserves the checkout. No configuration, schema, timeout or cache changes.
Why This Change Was Made
The snapshot-retirement promisor check was added to the shared hydrator. Git's
--missing=allow-promisorinitializes membership by scanning every promisor pack even with--max-count=1(Git source); that offline command has a two-minute budget, while the actual fetch has five minutes. Move the check to the snapshot owner, restoring creation's previous semantics. Keep exact-object batch fetching, local validation, shared commit preparation and Gateway-internal Git placement.Preparation diagnostics record class and phase without including error messages or command output. Runtime growth is 29 lines: 24 for the requested failure receipts and five for preserving the snapshot-only check and its error handling. No competing owner or new cache was added.
Evidence
Acceptance: identical allocated checkout size, remove the global promisor scan from creation, keep one exact-object fetch, and no material latency/CPU/allocation regression. Native Git fixture: 62,000 logical files / 1,142,784,000 payload bytes, one missing 18 KiB blob, and 600,000 unrelated historical blobs. Five fresh-seed interleaved pairs; separate five-pair allocation pass and two same-revision A/A pairs for each mode. macOS/APFS, local
file://transport; this measures the Git owner, not production network, btrfs or a large session database.A/A wall spread was 1.56–2.68 seconds under substantial host load; native CPU was 1.15–1.28 seconds. Candidate timing's worst sample (899 ms) remained below baseline's best (1,565 ms). Allocation is effectively flat within A/A sampling noise (60.1–61.9 MB). Every counted acquisition arm fetched exactly one object. New fixture and existing measurement script make the comparison rerunnable.
Regression proof: the old preparation receipt fails the class/phase assertion; both promisor configuration variants fail the no-global-scan assertion on the old hydrator. The other 18 capacity tests passed on baseline. Existing snapshot tests cover promised, unavailable, corrupt and unpromised local objects; 15 added test lines extend those owner contracts rather than adding another suite.
All 75 focused tests pass across capacity, timing receipts, snapshot-removal safety and removal-budget suites (209 seconds of test-shard wall time, plus one worker build). The real managed-worktree service also materialized all 62,000 files with the correct commit and clean status; hydration/sizing took 535 ms. Total creation was 62.35 seconds under contention, dominated by checkout/template work; this is correctness evidence, not a before/after creation latency claim. Independent Codex autoreview is scoped-clean at P0–P2. The changed-file checks pass except the inherited dead-export audit:
resolveFollowupReplyAnchor,captureRepositoryClientActor,RepositoryOperation, andRepositoryAuthorization. Their three owner files are byte-identical to baselineed3e1a0f80999fcea86add63c806cbc9bd080477, and this patch changes no production import/export edges. The completepnpm check:changedrun finished with only that inherited audit failure; all other stages passed, including core/scripts lint, type checks, runtime boundaries and cycle checks. The test-line allowance also passed. Changed test execution cost: capacity 24.56 seconds, timing receipts 13 ms; no new suite or startup.