Repository navigation
fix(worktrees): partial-clone removal times out scanning promisor packs - #200299
Merged
Merged
Conversation
Fetch missing HEAD objects through the existing promisor hydrator, then require an offline census with no missing objects before capture. Preserve failed and incomplete hydration, including the clean-snapshot fast path. Avoid the whole-pack promisor membership proof. Release-note context: partial-clone cleanup no longer aborts on a repository-wide promisor scan.
Contributor
|
🦞👀 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. |
Contributor
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. |
steipete
enabled auto-merge (squash)
November 16, 2026 23:38
Contributor
Author
|
Merged via squash auto-merge.
|
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Nov 17, 2026
…enclaw#200299) Fetch missing HEAD objects through the existing promisor hydrator, then require an offline census with no missing objects before capture. Preserve failed and incomplete hydration, including the clean-snapshot fast path. Avoid the whole-pack promisor membership proof. Release-note context: partial-clone cleanup no longer aborts on a repository-wide promisor scan.
RomneyDa
added a commit
that referenced
this pull request
Nov 19, 2026
…00299) Fetch missing HEAD objects through the existing promisor hydrator, then require an offline census with no missing objects before capture. Preserve failed and incomplete hydration, including the clean-snapshot fast path. Avoid the whole-pack promisor membership proof. Release-note context: partial-clone cleanup no longer aborts on a repository-wide promisor scan. (cherry picked from commit b220220) Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit d8322bec025b2274daefd1e348680cb706f23d7c)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Problem This Solves
Fixes managed-worktree cleanup aborting after 120 seconds when a large partial clone has unfetched HEAD blobs. Related: #188525, #189288.
Between 13:55 and 15:06 PST on November 16 (release
344cc75d), cleanup failed 16 times across 16 checkouts, every 2–3 minutes after no earlier failures that day, under sustained btrfs I/O pressure, with approximately 360 promisor pack files, another 53 new packs, and a 10 GB temporary pack. Each failure spent approximately 120.4 seconds in snapshot preparation before preserving the checkout and deferring an otherwise repeatable failure for 1–2 hours. Concurrent preparations recorded 110–141 seconds waiting for allocation/reservation; five conversations waited 2–2.5 minutes for a first reply. Those overlapping timings do not establish the lease holder.User Impact
Removal hydrates missing HEAD contents directly and requires local custody before snapshotting, without scanning unrelated promisor packs. Failed hydration, remaining missing objects, corruption, and lost removal authority still preserve the checkout. Worktrees without missing objects retain their existing path. No configuration, timeout, schema, worker, or lazy-import boundary changes.
Why This Change Was Made
The snapshot owner ran
rev-list --missing=allow-promisorbefore the existing batch hydrator. Git initializes promisor membership by scanning every promisor pack;--max-count=1does not bound that work. The fix deletes this classification and uses the existing selected-promisor batch fetch, transport isolation, and Git mutation admission from #188525. An offline--missing=print --max-count=1 HEADcensus then requires no remaining missing objects before capture. Its work follows the selected commit's contents rather than unrelated promised pack contents.Data safety depends on recoverability, not historical promise membership. A remote can serve an exact object ID even if that blob was originally authored locally. Fetch success alone is insufficient: the clean-snapshot fast path can otherwise publish HEAD without reading unchanged blobs. The new offline census closes that gap; capture retains its existing offline dirty/index validation and authority gates. Missing unpromised data that cannot be recovered still preserves the checkout. The retained unpromised-object maintenance fixture now expects one attempted fetch rather than zero; its byte preservation, backoff, and eventual repair assertions are unchanged.
Allocation investigation: ordinary removal acquires only
core:managed-worktrees:mutation/<id>(service.ts:717,allocation.ts:73), while creation usescore:managed-worktrees:create/capacity(allocation.ts:58). The whole-pack proof did not enter the ref-mutation queue (git.ts:215). Its content slot is shared with snapshot/content reads, while preparation has a separate worker lane (git-worker.ts:150). However, global allocation owners can retain their lease while awaiting that checkout:withWorktreeAllocationLeasenests the checkout lease (allocation.ts:62), including restore (service.ts:866) and removed-name reuse (service.ts:489). Rollback directly snapshots under global allocation ownership (service.ts:367,service.ts:395), and count-cap enforcement invokes snapshotting eviction under that lease (capacity-owner.ts:313,capacity-owner.ts:185,eviction.ts:108); eviction supplies its own five-second cancellation signal (eviction.ts:99). The restore/rollback ownership interval includes checkout acquisition and native settlement, not a fixed short critical section. STOP for Goal 2: separating those responsibilities requires a broader capacity/lease redesign, so lease scope is unchanged under the requested escape hatch. The incident's exact holder is not identifiable from the supplied timing lines alone.Simplification: one hydration owner remains; the whole-pack classification is removed. Production delta: −8 lines. Net test delta: +22 lines, one added table case and one extended existing case, no new suite. Acceptance: promised removal/restoration succeeds with a synthetic stalled whole-pack command, exactly one real batch fetch, and zero global membership scans; unsuccessful or incomplete hydration preserves checkout bytes and registry custody. This is a work-count/behavior regression, not a production latency benchmark.
Evidence
f947bdc94981e299fe26b5a71af8bfdd4e7ac125:node scripts/run-vitest.mjs src/agents/worktrees/service.removal-safety.test.ts --maxWorkers=1 -t 'removal \((promisor|incomplete)\)'→ 2 failed / 20 skipped. The first failure is caused by the synthetic whole-pack timeout; the second resolves{ removed: true }rather than preserving missing blobs. The second table label was subsequently shortened fromincompletetonoop; fixture behavior is unchanged.node scripts/run-vitest.mjs src/agents/worktrees/service.removal-safety.test.ts src/agents/worktrees/service.removal-budget.test.ts src/agents/worktrees/service.capacity.test.ts src/agents/worktrees/service.remove-lease.test.ts --maxWorkers=1→ 85 passed: 52 infra cases (208.38 seconds) and 33 removal-budget cases (61.49 seconds), 296.24 seconds total wall time including worker preparation/verification. This retains real Git partial clones, one-batch hydration, transport-denied byte-for-byte restore, unavailable/unpromised/corrupt-object preservation, removal authority, backoff, and allocation-capacity contracts. These existing files exceed 30 seconds because they exercise native Git, worker settlement, and persisted registry/removal custody; the regression adds no suite or product startup.node scripts/run-tsgo-core-test-shards.mjs --changed-paths-json '["src/agents/worktrees/service.removal-safety.test.ts","src/agents/worktrees/service.removal-budget.test.ts"]'→ agents-tools passed. It initially caught missing synthetic result metadata; addingtimeoutMs: 0corrected the fixture type without changing behavior.run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.jsonon all three TypeScript files,pnpm format:checkon all four files, andgit diff --checkpassed. Worker and lazy-import boundaries are unchanged, so no build-boundary change is claimed.f947bdc94981e, P0–P2: scoped-clean, no accepted/actionable findings. Final review includes the fixture metadata correction; unchanged hydration, snapshot inventory, isolated transport, Git execution, and worker owners were supplied as context. Pr-simplify retained the existing hydration owner and removed the redundant classification path.9c7a93e2f44cc2e0937e39dd0289b19275f743fa: completed success, 74 jobs (45 successful / 29 skipped), no failures or cancellations. No CI reruns or repair pushes. The baseline-ratchet job took 16 minutes 47 seconds; its final result was success. No inherited-failure exception was used. Native review/preparation and accepted auto-merge reconciled the exact attempted head as merged, commitb220220905f2bd2d38ccfd95b0e6983a9cce5bd7.