Skip to content

fix(test): run-tsgo worktree tests time out in git add on loaded hosts - #163322

Merged
steipete merged 1 commit into
mainfrom
steipete/run-tsgo-worktree-fixture-closure
Oct 2, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/run-tsgo-worktree-fixture-closure

Conversation

@steipete

@steipete steipete commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: all three tests in test/scripts/run-tsgo-worktree.test.ts fail with spawnSync git ETIMEDOUT on loaded hosts. The failure comes from the fixture's own git add ., before any wrapper behavior is exercised.

User Impact

No user-visible change. The linked-worktree compiler wrapper tests stop spending their 10 s Git budget on hashing hundreds of unrelated files, so they fail far less often for reasons unrelated to the wrapper.

Why This Change Was Made

createLinkedCheckoutFixture copied five scripts plus the whole scripts/lib directory (490 files) into a temp primary checkout, committed everything, and checked it out again with git worktree add. The git add, commit, and checkout each had to process every file. The wrapper only loads its own runtime import closure.

The fixture now commits just that closure. It is computed by the existing owner, collectRuntimeImportClosure (with dynamic imports), the same way worktree-setup.test.ts and the run-vitest fixture build their checkouts. The closure is 29 files instead of 490. The CLI shim loads two files by path rather than by import, so they are explicit inputs: scripts/run-tsgo.mts (its implementation option) and scripts/tsx.mjs (the --import loader). Because the list is computed, it follows the wrapper's import graph as it changes, and the hand-maintained top-level script list is gone. Git timeouts, test budgets, and assertions are unchanged, with no retries and no sleeps.

Evidence

Host: 32-core Mac at load 46–89, APFS volume ~93% full.

Fixture steps, interleaved A/B. Six alternating pairs ran in one process, and each Git step was capped at 120 s for measurement only. Values are median (max):

Step Full scripts/lib (490 files) Closure (29 files)
copy 15.3 s (28.9 s) 1.6 s (2.4 s)
git add . 36.2 s (52.2 s) 3.0 s (13.6 s)
git commit 7.4 s (12.1 s) 1.5 s (1.6 s)
git worktree add 16.4 s (34.6 s) 6.1 s (8.1 s)

git add exceeded the 10 s budget in 5 of 6 full-tree runs and 1 of 6 closure runs. The unchanged git init ranged from 2.4 s to 103 s in both variants. Those are kernel I/O stalls (processes sit in state U); a fixture cannot bound them, but it can stop multiplying its exposure by 17×.

Whole tests, one Vitest process. The original and changed fixtures ran in the same process with budgets lifted for measurement only:

Test Fixture: old → new Test total: old → new
selects its own root compiler 27.8 s → 4.8 s 84.8 s → 80.8 s
refuses a missing local install 38.8 s → 3.8 s 113.6 s → 33.7 s
skips a missing sparse project 58.2 s → 2.9 s 87.6 s → 19.5 s

Same contract. For all four wrapper invocations (-p tsconfig.json in the linked checkout, --version in primary and linked, and the sparse skip), status, stdout, and stderr were byte-identical between the full-tree and closure fixtures after normalizing temp paths and UUIDs. That includes the Cannot find module 'typescript/package.json' refusal and the sparse-skip diagnostics. A module missing from the closure would fail the primary or linked wrapper runs with ERR_MODULE_NOT_FOUND, not pass for a different reason.

Real budgets.

  • Before: the original file failed all three tests with spawnSync git ETIMEDOUT, inside git init or git add.
  • After: with the changed file under real budgets in the same Vitest run, the missing-install test passed (39.1 s) and the sparse-skip test passed (32.0 s). The root-compiler test still exceeded its 30 s budget, but in installCheckoutTools, not Git: that test materializes the native compiler twice (24.5 s + 34.2 s at load ~89). That copy cost is tracked separately (fix(test): tsgo changed-test typecheck test times out on loaded hosts #163057 introduces a cheaper installed-compiler path).

Cost of the closure. Computing it adds 0.6–2.3 s once per file at collection (module import plus graph build, measured at load ~60). CI timing for this file was 2 s (config/ci-test-timings.json); on this head's CI run (job checks-node-compact-small-1, shard core-tooling-8-hosted-3) the file took 1.71 s, with tests at 481 ms, 357 ms, and 181 ms.

Checks. oxfmt, root-test oxlint (node scripts/run-oxlint.mjs --tsconfig test/tsconfig/tsconfig.test.root.json), pnpm run tsgo:test:root, and git diff --check pass. Autoreview (Codex) ran on the diff.

…/lib

The linked-worktree fixture copied, committed, and checked out the whole
scripts/lib directory (490 files with the top-level scripts), so its
`git add .` exceeded the 10 s spawnSync budget on loaded hosts before any
wrapper behavior ran. Commit only the wrapper's runtime import closure
(29 files), computed by collectRuntimeImportClosure, plus the two files
the CLI shim loads by path (run-tsgo.mts and tsx.mjs).

Interleaved A/B at load 46-78: git add 36.2 s -> 3.0 s median, worktree
add 16.4 s -> 6.1 s, copy 15.3 s -> 1.6 s. Wrapper status/stdout/stderr
are byte-identical between the old and new fixtures; timeouts and
assertions are unchanged.
@clawsweeper

clawsweeper Bot commented Oct 2, 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.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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 Oct 2, 2026
@clawsweeper

clawsweeper Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 2, 2026, 11:45 AM ET / 15:45 UTC (Revision 2).

ClawSweeper review

What this changes

The compiler-wrapper tests copy only their runtime dependencies into temporary Git worktrees, reducing fixture setup work on loaded hosts.

Merge readiness

✅ Ready for maintainer review

The PR remains useful: current main and the latest release still copy the full scripts library. The focused change preserves the existing assertions and budgets, with convincing measured evidence and no actionable patch findings.

Priority: P2
Reviewed head: c436c9e9aa3d40a2a542ec0dbd84d8632210f54d

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, maintainable fixture repair supported by unusually useful comparative measurements and unchanged boundary coverage.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The captured body exercises the changed fixture through real Git operations and the actual compiler-wrapper entrypoint on a loaded Mac, showing lower setup cost and equivalent outputs across compiler selection, missing-install refusal, and sparse skipping. Remaining compiler-copy stalls are separately documented; no stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The captured body exercises the changed fixture through real Git operations and the actual compiler-wrapper entrypoint on a loaded Mac, showing lower setup cost and equivalent outputs across compiler selection, missing-install refusal, and sparse skipping. Remaining compiler-copy stalls are separately documented; no stored-data contract changes.
Evidence reviewed 8 items Pinned introduced change: The introduced patch replaces recursive library copying with the existing runtime dependency collector, includes dynamic imports, and explicitly seeds the implementation and loader. Assertions, Git deadlines, and test budgets are unchanged.
Existing dependency owner: The collector follows resolved runtime edges, rejects unresolved relative imports, and closes its compiler resources. The run-vitest fixture already uses the same collector with dynamic imports enabled.
Still necessary on current main: Fetched main retains the explicit script list and recursive copy of scripts/lib; it does not contain this fixture reduction.
Findings None None.
Security None None.

How this fits together

These tooling tests create independent Git checkouts and exercise OpenClaw’s compiler wrapper. They verify checkout-local compiler selection, missing-install refusal, and sparse-project skipping.

flowchart TD
  A[Compiler wrapper sources] --> B[Runtime dependency collection]
  B --> C[Temporary primary checkout]
  C --> D[Git commit and linked worktree]
  D --> E[Real compiler wrapper invocation]
  E --> F[Compiler selection and diagnostic assertions]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +2. Total +2 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 11 9 +2
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 11 9 +2

Review metrics

Metric Value Why it matters
Fixture Git workload 490 → 29 files; reported git-add median 36.2 → 3.0 s The reduction targets setup work without increasing deadlines or weakening assertions.

Technical review

Best possible solution:

Keep fixture inputs tied to the existing runtime dependency collector while preserving real checkout-local compiler coverage.

Do we have a high-confidence way to reproduce the issue?

Yes for the reported loaded-host setup: the body supplies interleaved before/after Git measurements, and current main still stages the full library. This reviewer did not execute a current-main reproduction; timing failures depend on host contention.

Is this the best way to solve the issue?

Yes. Reusing the existing dependency collector removes unnecessary fixture work while retaining the real wrapper entrypoint, negative controls, assertions, and deadlines.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 8bb49fa67a27.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded tooling reliability improvement with no user-visible runtime change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The captured body exercises the changed fixture through real Git operations and the actual compiler-wrapper entrypoint on a loaded Mac, showing lower setup cost and equivalent outputs across compiler selection, missing-install refusal, and sparse skipping. Remaining compiler-copy stalls are separately documented; no stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured body exercises the changed fixture through real Git operations and the actual compiler-wrapper entrypoint on a loaded Mac, showing lower setup cost and equivalent outputs across compiler selection, missing-install refusal, and sparse skipping. Remaining compiler-copy stalls are separately documented; no stored-data contract changes.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-02T06:41:03.287Z sha c436c9e :: needs maintainer review before merge. :: none

@steipete
steipete merged commit a324281 into main Oct 2, 2026
88 checks passed
@steipete
steipete deleted the steipete/run-tsgo-worktree-fixture-closure branch October 2, 2026 17:02
@steipete

steipete commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 3, 2026
…/lib (openclaw#163322)

The linked-worktree fixture copied, committed, and checked out the whole
scripts/lib directory (490 files with the top-level scripts), so its
`git add .` exceeded the 10 s spawnSync budget on loaded hosts before any
wrapper behavior ran. Commit only the wrapper's runtime import closure
(29 files), computed by collectRuntimeImportClosure, plus the two files
the CLI shim loads by path (run-tsgo.mts and tsx.mjs).

Interleaved A/B at load 46-78: git add 36.2 s -> 3.0 s median, worktree
add 16.4 s -> 6.1 s, copy 15.3 s -> 1.6 s. Wrapper status/stdout/stderr
are byte-identical between the old and new fixtures; timeouts and
assertions are unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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