Skip to content

fix(tooling): prevent local tsgo checks from saturating CPUs - #119517

Merged
vincentkoc merged 1 commit into
openclaw:mainfrom
fuller-stack-dev:fix/local-tsgo-cpu-cap
Aug 5, 2026
Merged

vincentkoc merged 1 commit into
openclaw:mainfrom
fuller-stack-dev:fix/local-tsgo-cpu-cap

Conversation

@fuller-stack-dev

@fuller-stack-dev fuller-stack-dev commented Aug 5, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes an issue where constrained local tsgo checks 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 GOMAXPROCS to 1 inside the existing throttled local tsgo policy, while preserving explicit operator overrides and leaving full-speed mode unchanged.

The change stays at the run-tsgo resource-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 tsgo process monopolize several CPU cores and degrade the Gateway or other interactive workloads.

Evidence

Punchcard-Session: clear-orchard-lantern-bc

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: XS maintainer Maintainer-authored PR labels Aug 5, 2026
@clawsweeper clawsweeper Bot added 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. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Aug 5, 2026
@clawsweeper

clawsweeper Bot commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 5, 2026, 3:31 AM ET / 07:31 UTC.

ClawSweeper review

What this changes

The PR defaults throttled local tsgo runs to one Go scheduler CPU while preserving explicit GOMAXPROCS values and full-speed mode.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep 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
Reviewed head: 2977d8724134b6af2036e37b8a8042c2b0ee1f03
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused owner-boundary fix with direct behavior evidence and boundary coverage.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body provides exact-head before/after scheduler output, CPU samples, override/full-mode results, focused tests, and Testbox validation.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body provides exact-head before/after scheduler output, CPU samples, override/full-mode results, focused tests, and Testbox validation.
Evidence reviewed 7 items Current main remains unfixed: Current main retains the throttled tsgo branch with checker, GC, and memory defaults but no GOMAXPROCS value; the two touched files are unchanged from the PR base.
Canonical owner boundary: The normal launcher obtains the shared policy environment and passes it directly to the spawned tsgo process; profiling uses the same policy helper.
Focused regression coverage: The PR verifies the throttled default, an explicit GOMAXPROCS override, and the absence of a cap in roomy/full mode.
Findings None None.
Security None None.

How this fits together

OpenClaw 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
Loading

Decision needed

Question Recommendation
Should the tooling owner accept the throttled tsgo CPU cap after the branch is refreshed against current main? Merge after refresh: Retain the focused policy change once the final head is cleanly merged and required checks are refreshed.

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

  • Resolve merge risk (P1) - The branch is behind current main; refresh the clean merge result and required checks on the final head before landing.
  • Complete next step (P2) - A maintainer should confirm the internal tooling default and refresh the exact-head merge/check view; no mechanical repair is pending.
Agent review details

Security

None.

PR surface

Tests +6, Other +4. Total +10 across 2 files.

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

Review metrics

Metric Value Why it matters
Production versus test delta production +4, tests +6 The small production addition implements one resource-policy default and the tests cover default, override, and full-mode boundaries.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep the cap in the shared tsgo policy, preserve explicit GOMAXPROCS and full-speed behavior, then land after the final merge/check refresh.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

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

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides exact-head before/after scheduler output, CPU samples, override/full-mode results, focused tests, and Testbox validation.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P3: This is a bounded developer-tooling performance safeguard with limited end-user blast radius.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body provides exact-head before/after scheduler output, CPU samples, override/full-mode results, focused tests, and Testbox validation.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides exact-head before/after scheduler output, CPU samples, override/full-mode results, focused tests, and Testbox validation.

Evidence

What I checked:

  • Current main remains unfixed: Current main retains the throttled tsgo branch with checker, GC, and memory defaults but no GOMAXPROCS value; the two touched files are unchanged from the PR base. (scripts/lib/local-heavy-check-runtime.mjs:140, 3faa2b088823)
  • Canonical owner boundary: The normal launcher obtains the shared policy environment and passes it directly to the spawned tsgo process; profiling uses the same policy helper. (scripts/run-tsgo.mjs:22, 3faa2b088823)
  • Focused regression coverage: The PR verifies the throttled default, an explicit GOMAXPROCS override, and the absence of a cap in roomy/full mode. (test/scripts/local-heavy-check-runtime.test.ts:151, 2977d8724134)
  • Go runtime contract: OpenClaw pins tsgo through @typescript/native-preview; the directly inspected Go runtime contract says GOMAXPROCS caps CPUs executing Go code simultaneously and otherwise defaults to the host CPU count. (package.json:2034, 3faa2b088823)
  • Policy provenance: The current throttle branch is blamed to Vincent Koc's current policy commit; available history also identifies the original local-tsgo throttling commit 7899f5c. (scripts/lib/local-heavy-check-runtime.mjs:140, fd1662f49cc3)
  • Supplied real behavior proof: The PR body records a current-main versus exact-head scheduler A/B, sustained CPU samples near one core after the change, override/full-mode checks, focused tests, and a passing Testbox changed-check run. (2977d8724134)

Likely related people:

  • Vincent Koc: Available history identifies the original throttle commit, and current blame attributes the shared policy branch and its adjacent tests to his latest area commit. (role: original local-tsgo throttle author and recent shared-policy contributor; confidence: high; commits: 7899f5c5ce31, fd1662f49cc3; files: scripts/lib/local-heavy-check-runtime.mjs, test/scripts/local-heavy-check-runtime.test.ts, scripts/run-tsgo.mjs)

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-08-05T06:30:57.598Z sha 2977d87 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 5, 2026
@vincentkoc
vincentkoc merged commit 05a03c6 into openclaw:main Aug 5, 2026
121 of 131 checks passed
@vincentkoc

Copy link
Copy Markdown
Member

Merged via squash.

vincentkoc added a commit that referenced this pull request Aug 5, 2026
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
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 6, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 6, 2026
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. scripts Repository scripts 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.

2 participants