Repository navigation
fix(tooling): prevent local tsgo checks from saturating CPUs - #119517
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 5, 2026, 3:31 AM ET / 07:31 UTC. ClawSweeper reviewWhat this changesThe PR defaults throttled local tsgo runs to one Go scheduler CPU while preserving explicit GOMAXPROCS values and full-speed mode. Merge readinessKeep open for maintainer review. Current main still lacks this bounded local tooling fix; the PR places it at the shared policy owner, preserves overrides and full-speed mode, and has strong supplied before/after proof with no actionable correctness finding. Priority: P3 Review scores
Verification
How this fits togetherOpenClaw routes normal local TypeScript-native compiler commands through a shared resource-policy helper before spawning tsgo. That helper decides whether a host is throttled and supplies the child-process environment used by both ordinary checks and profiling. flowchart LR
A[Local tsgo command] --> B[tsgo launcher]
B --> C[Shared local resource policy]
C --> D{Throttled mode?}
D -->|Yes| E[Go CPU and memory limits]
D -->|No| F[Full-speed compiler settings]
E --> G[Native tsgo compiler]
F --> G
Decision needed
Why: The author is a repository MEMBER and the PR carries the maintainer label, so acceptance of the local-default policy remains a human merge decision despite the strong technical evidence. Before merge
Agent review detailsSecurityNone. PR surfaceTests +6, Other +4. Total +10 across 2 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the cap in the shared tsgo policy, preserve explicit GOMAXPROCS and full-speed behavior, then land after the final merge/check refresh. Do we have a high-confidence way to reproduce the issue? Yes. The supplied current-main versus exact-head scheduler A/B exercises forced throttled mode, and current source confirms the affected shared policy path is still active. Is this the best way to solve the issue? Yes. Applying the cap in the shared policy covers normal tsgo and profiling invocations without duplicating logic in launchers; the Go runtime contract supports this control point. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 3faa2b088823. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
Punchcard-Session: frost-brook-timber-mx * origin/main: fix: cap local tsgo CPU usage (#119517) fix(tool-search): normalize dotted call arguments (#119418) (#119464) fix(qa): retain child output on CLI timeouts (#119524) fix(discord): preserve authored block order in presentation components (#119506) fix: make plugin verification restart guidance install-neutral (#119508) fix(qa): preserve profile execution contracts (#119519) test(qa): cover managed OTEL runtime paths (#118965) Punchcard-Session: frost-brook-timber-mx
Punchcard-Session: frost-brook-timber-mx * origin/main: fix: cap local tsgo CPU usage (openclaw#119517) fix(tool-search): normalize dotted call arguments (openclaw#119418) (openclaw#119464) fix(qa): retain child output on CLI timeouts (openclaw#119524) fix(discord): preserve authored block order in presentation components (openclaw#119506) fix: make plugin verification restart guidance install-neutral (openclaw#119508) fix(qa): preserve profile execution contracts (openclaw#119519) test(qa): cover managed OTEL runtime paths (openclaw#118965) Punchcard-Session: frost-brook-timber-mx
What Problem This Solves
Fixes an issue where constrained local
tsgochecks could consume several CPU cores even though OpenClaw's local policy already selected--singleThreaded --checkers 1. On a 10-core, 16 GB maintainer host, one core-test typecheck sustained 484-566% CPU and contributed to Gateway event-loop starvation.Why This Change Was Made
The TypeScript flags serialize compiler work groups and checker instances, but they do not limit Go runtime and garbage-collector scheduling. This change defaults
GOMAXPROCSto1inside the existing throttled localtsgopolicy, while preserving explicit operator overrides and leaving full-speed mode unchanged.The change stays at the
run-tsgoresource-policy owner. Separate boundary-check orchestration retains its existing concurrency ownership.User Impact
Developers running local OpenClaw typechecks on constrained machines should no longer have one
tsgoprocess monopolize several CPU cores and degrade the Gateway or other interactive workloads.Evidence
f3186b0876bcf4a1dae33be674bf6a3a9136966c2977d8724134b6af2036e37b8a8042c2b0ee1f03tsgoPID sustained 484-566% CPU with--singleThreaded --checkers 1.gomaxprocs=1; five CPU samples stayed between 96% and 101%.gomaxprocs=1GOMAXPROCS=3: remains310)node scripts/run-vitest.mjs test/scripts/local-heavy-check-runtime.test.ts: 35 passedtbx_01kz894pnayym2wp7h7c3y3gtb:pnpm check:changedpassedgomaxprocs=4(https://github.com/openclaw/openclaw/actions/runs/30984248942)gomaxprocs=1; explicit override:3; full mode:4(https://github.com/openclaw/openclaw/actions/runs/30984507173)test/scripts/local-heavy-check-runtime.test.tspassed 35/35 (https://github.com/openclaw/openclaw/actions/runs/30984667515)Punchcard-Session: clear-orchard-lantern-bc