Repository navigation
fix(worktrees): avoid sparse isolation test timeouts on Linux - #150431
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: blocked before merge. Reviewed September 16, 2026, 9:04 PM ET / September 17, 2026, 01:04 UTC. ClawSweeper reviewWhat this changesBatch Git metadata queries in the sparse-worktree isolation tests to reduce Linux subprocess overhead while preserving their assertions. Merge readiness⛔ Blocked before merge - 1 item remains Keep open: this remains a useful, focused optimization absent from current main. No actionable correctness defect was found, and the maintainer-protected PR is not eligible for cleanup closure. Priority: P2 Review scores
Verification
How this fits togetherManaged worktrees give agent tasks separate Git checkouts. These tests create full and sparse checkouts, inspect their Git metadata, and verify that changes in one checkout do not contaminate its siblings. flowchart LR
A[Repository fixture] --> B[Managed worktree service]
B --> C[Full and sparse checkouts]
C --> D[Batched Git metadata reads]
D --> E[File and configuration observations]
E --> F[Isolation assertions]
Before merge
Agent review detailsSecurityNone. PR surfaceTests +38. Total +38 across 1 file. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep metadata observations fresh at each phase while reducing process launches and preserving the existing isolation contract. Do we have a high-confidence way to reproduce the issue? No high-confidence reproduction of the exact timeout was established here; the PR reports retained-memory performance measurements but explicitly distinguishes them from the original full-shard failure. Is this the best way to solve the issue? Yes: batching equivalent read-only Git queries addresses measured overhead while retaining fresh path resolution, scenario order, assertions, and timeout policy. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 9fde6953090e. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
What Problem This Solves
Fixes the sparse-isolation regression test exceeding its 120-second budget on RunsOn Ubuntu workers after a large agent test shard has retained substantial memory.
User Impact
No product behavior changes. Both sparse/disable orderings retain their full source-isolation, index/HEAD preservation, reuse rejection, and guarded Git-fallback coverage.
Why This Change Was Made
This is a test subprocess-volume problem:
execFile("git", ...)repeatedly forks the resident Vitest process to collect the same revision/path metadata. In benchmark 35165603749, the companion-free case already took 105.966 seconds before the companion case timed out at 121.622 seconds. The run's microprobe measured process creation rising from 1.022 ms to 60.136 ms with 4 GiB resident memory.Batch the seven revision/path queries into one
git rev-parsecall per observation and resolve sibling paths once before reading their bytes. Metadata is still resolved afresh after each mutation, including Git's transition to per-worktree sparse configuration. Preserve every phase, diagnostic field, and behavioral assertion; no timeout, retry, skip, or production change is involved.The managed-source provisioner added in #149585 is not called here, and its new existing-branch path is not used by this test. The test was introduced in #149581; the earlier benchmark base
bb1124465258did not contain this file.Evidence
A disposable
node:26-bookwormLinux ARM64 container used Node 26.8.2 and Git 2.55.0, with bind-mounted source/dependencies, a fresh HOME, no global Git identity or SSH agent, and terminal prompts disabled. Bookworm's bundled Git 2.39 initially produced an acceleration-expectation failure because it lacks the attribute-path probe; Git was matched to the actual benchmark version before the comparison.The exact 120-second timeout did not reproduce in the isolated container. An external instrumentation preload retaining 8 GiB demonstrated the mechanism without changing test behavior: all Git commands completed, synchronous process launch dominated, and the two cases issued 1,460 → 707 Git subprocesses. Their combined execution fell from 63.773 → 38.929 seconds with the same retained-memory input and networking disabled.
The remaining integration check is the complete 339-file
agentic-agents-supportshard on stock RunsOn x86 Ubuntu at this PR head; isolated ARM64 proof does not reproduce that shard's preceding memory history.Validation completed:
--network none: both cases passed each time (3.420–7.561 seconds per case).node scripts/check-changed.mjs, including line-cap/max-lines ratchets, core test typechecking, lint, and dead-export scans.oxfmt --checkon the changed file andgit diff --check.Focused command in each container:
node scripts/run-vitest.mjs src/agents/worktrees/service.sparse-isolation.test.ts. macOS siblings:node scripts/run-vitest.mjs src/agents/worktrees/, plus explicitname.test.tsandtemplate-registry.test.tsrouting. The proof containers and images were removed afterward.