Skip to content

fix(worktrees): avoid sparse isolation test timeouts on Linux - #150431

Merged
steipete merged 1 commit into
mainfrom
ci-burden/sparse-isolation-host-stall
Sep 17, 2026
Merged

steipete merged 1 commit into
mainfrom
ci-burden/sparse-isolation-host-stall

Conversation

@steipete

Copy link
Copy Markdown
Contributor

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-parse call 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 bb1124465258 did not contain this file.

Evidence

A disposable node:26-bookworm Linux 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-support shard on stock RunsOn x86 Ubuntu at this PR head; isolated ARM64 proof does not reproduce that shard's preceding memory history.

Validation completed:

  • Three fresh container runs, with default networking and twice with --network none: both cases passed each time (3.420–7.561 seconds per case).
  • macOS worktree siblings: 408 tests passed across the agents-support and explicitly selected unit-fast lanes; existing Linux/Windows-only cases remain platform-gated. This includes native APFS lifecycle proof.
  • node scripts/check-changed.mjs, including line-cap/max-lines ratchets, core test typechecking, lint, and dead-export scans.
  • oxfmt --check on the changed file and git diff --check.
  • Independent branch autoreview: no actionable P0/P1 findings.

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 explicit name.test.ts and template-registry.test.ts routing. The proof containers and images were removed afterward.

@clawsweeper

clawsweeper Bot commented Sep 17, 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.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S maintainer Maintainer-authored PR labels Sep 17, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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 Sep 17, 2026
@clawsweeper

clawsweeper Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 16, 2026, 9:04 PM ET / September 17, 2026, 01:04 UTC.

ClawSweeper review

What this changes

Batch 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
Reviewed head: b4cb2a9bda8565440333bfd6734591a964ed6125

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused optimization with preserved assertions and relevant comparative measurements; the original full-shard timing remains unverified.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: The supplied repository state identifies a maintainer-authored PR, so the external-contributor gate does not apply; its real-Git container measurements directly exercise the changed test observations, with full-shard coverage explicitly outstanding.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied repository state identifies a maintainer-authored PR, so the external-contributor gate does not apply; its real-Git container measurements directly exercise the changed test observations, with full-shard coverage explicitly outstanding.
Evidence reviewed 8 items Introduced change preserves behavioral coverage: The pinned introduction diff replaces repeated metadata subprocesses with one observation helper. Both scenario orderings, sibling byte comparisons, source-content checks, reuse rejection, and guarded fallback assertions remain intact.
Current main still has the repeated queries: Fetched main retains the separate rev-parse calls in observations and sibling capture; it does not contain this optimization.
Latest release predates this test: The sparse-isolation test path is absent from the supplied latest release, v2026.9.4; no shipped replacement for this test optimization was established.
Findings None None.
Security None None.

How this fits together

Managed 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]
Loading

Before merge

  • Resolve merge risk (P2) - The isolated ARM64 benchmark supports the subprocess-overhead mechanism but does not establish that the original full-shard RunsOn x86 timeout is eliminated.
Agent review details

Security

None.

PR surface

Tests +38. Total +38 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 63 25 +38
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 63 25 +38

Review metrics

Metric Value Why it matters
Metadata subprocesses 7 → 1 per observed checkout; 4 → 1 per sibling capture The diff directly reduces process-launch overhead without removing observation phases.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep metadata observations fresh at each phase while reducing process launches and preserving the existing isolation contract.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best 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.

Labels

Label changes:

  • add P2: This addresses a bounded test-runtime problem without changing user-facing behavior.
  • 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. Not applicable: The supplied repository state identifies a maintainer-authored PR, so the external-contributor gate does not apply; its real-Git container measurements directly exercise the changed test observations, with full-shard coverage explicitly outstanding.

Label justifications:

  • P2: This addresses a bounded test-runtime problem without changing user-facing behavior.
  • 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. Not applicable: The supplied repository state identifies a maintainer-authored PR, so the external-contributor gate does not apply; its real-Git container measurements directly exercise the changed test observations, with full-shard coverage explicitly outstanding.

Evidence

What I checked:

Likely related people:

  • Jason (Json): Raw commit 5f3ca5a adds src/agents/worktrees/service.sparse-isolation.test.ts:149 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 5f3ca5a8553d; files: src/agents/worktrees/service.sparse-isolation.test.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Confirm the complete agentic-agents-support shard stays within budget on RunsOn x86 Ubuntu.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit 642c090 into main Sep 17, 2026
106 checks passed
@steipete
steipete deleted the ci-burden/sparse-isolation-host-stall branch September 17, 2026 01:23
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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