Skip to content

fix(build): prevent native declaration compiler OOMs - #179140

Merged
steipete merged 1 commit into
mainfrom
codex/nodew-r10-update-base
Oct 21, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/nodew-r10-update-base

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Source updates can exhaust memory on a 16 GiB Linux host while generating declarations, causing the native TypeScript compiler to be OOM-killed and the update to retry older commits with ERR_STREAM_DESTROYED.

User Impact

Source builds apply the existing bounded Go runtime policy to the declaration compiler, which runs outside Node's heap limit. Explicit compiler tuning remains respected. Declaration generation and build admission remain required.

Why This Change Was Made

Reuse the existing compiler resource owner and carry one captured memory budget through the complete build plan. This preserves the existing once-per-plan memory-read contract and avoids a separate policy or new configuration option. Constrained hosts use the established memory, GC, and scheduler defaults; larger hosts retain the existing policy's behavior.

LOC delta: production paths 0; build tooling +16, tests +23, docs +4. No schema, protocol, dependency, or public API change.

Evidence

  • Two real published-to-main update builds on the same small machine class lost the native compiler to kernel OOM at approximately 10.7 and 11.1 GiB resident memory.
  • A full build with the Go policy completed in 5m24s, maximum single-process RSS 6.95 GiB; the complete declaration step took 2m37s. This is a reliability result, not a throughput benchmark. The build also printed an unrelated existing Control UI startup-size warning.
  • The missing-policy regression was red on the base. After sharing the captured budget, all 89 owning tests passed: pnpm test test/scripts/tsdown-build.test.ts --maxWorkers=1, 6.49s wrapper / 2.26s Vitest.
  • Changed-file formatting, type-aware lint, git diff --check, and independent Codex review passed.

The live update also exposed a separate foreground restart outcome problem: its helper exits successfully but leaves the run awaiting Gateway completion. That lifecycle investigation is separate from this build fix; this PR does not claim a completed upgrade.

@clawsweeper

clawsweeper Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review in progress

ClawSweeper is reviewing this revision. This supersedes any previous blocked status.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation scripts Repository scripts size: S labels Oct 21, 2026
@steipete
steipete marked this pull request as ready for review October 21, 2026 06:25
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-21T06:40:53.923685Z 997d317 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 21, 2026
@steipete
steipete merged commit 8816945 into main Oct 21, 2026
168 of 169 checks passed
@steipete
steipete deleted the codex/nodew-r10-update-base branch October 21, 2026 06:42
steipete added a commit that referenced this pull request Oct 21, 2026
…79209)

## What Problem This Solves

A foreground Gateway update can activate the candidate successfully but then report `failed / abandoned`. Its updater exits after handing completion to the replacement Gateway. Automatic history reconciliation can mistake that intentional driver exit for abandonment before startup verifies the new build.

## User Impact

The replacement Gateway can record its actual boot verification and complete the update. CLI-owned and managed handoffs, unrelated sentinels, and explicit recovery retain their existing ownership checks.

## Why This Change Was Made

Keep the decision in the existing reconciliation owner: a matching successful foreground restart sentinel reserves completion for the replacement Gateway. No new state, timeout, configuration, protocol, or dependency. The existing repair finalizer already reconciles explicitly after successful recovery.

Production LOC: **+18**. This bounded growth preserves the existing completion owner instead of adding initialization ordering across status readers and watchers. Tests: **+38**; docs: **+5**; three files.

## Evidence

- Two real `2026.10.5` foreground Gateway-to-main updates reproduced the same false terminal result after activation. The worker-local-inference tool completed, and its side effect appeared exactly once on both hosts. The second run used explicit Go compiler limits to isolate the separate build OOM fixed in #179140.
- The new regression was red on the base: the public history read recorded abandonment before the real restart finalizer could complete it. With the fix, the full owning suite passes all **19 tests**, including managed, foreign-sentinel, and explicit-recovery controls.
- `pnpm test src/gateway/server-restart-update-run.test.ts --maxWorkers=1`: **311.70s** wrapper / **283.71s** Vitest on a cold local worker graph; worker preparation took **200.24s**. The suite uses the real SQLite history reader and restart finalizer, with no Gateway boots or added sleeps.

- Remote exact-input validation also passed: type-aware lint (23.4s), all 57 update-repair tests (83.62s wall), and the four reconciliation cases after formatting (44.50s wall). Export collision checks and all three Knip export scans passed (125.30s combined).

The complete published-to-main matrix, including the node update and extended-stable Gateway, will run against merged main. Those results are pending; the earlier activated-but-abandoned updates are not claimed as successful upgrades.

## Inherited CI failure

The CI merge head reports TS2345 in `test/scripts/ci-changed-node-test-plan.test.ts:813,891`: `CompactNodeTestShard` lacks `configs`. The same two diagnostics reproduce with `node scripts/run-tsgo.mjs --noEmit -p test/tsconfig/tsconfig.test.root.tooling.json` on unmodified current main `5e9c3fbfd6a2359f5980e75688c08c23a17af592`. This PR changes neither that test nor the planner types. The Gateway test typecheck passed.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 22, 2026
## What Problem This Solves

Source updates can exhaust memory on a 16 GiB Linux host while generating declarations, causing the native TypeScript compiler to be OOM-killed and the update to retry older commits with `ERR_STREAM_DESTROYED`.

## User Impact

Source builds apply the existing bounded Go runtime policy to the declaration compiler, which runs outside Node's heap limit. Explicit compiler tuning remains respected. Declaration generation and build admission remain required.

## Why This Change Was Made

Reuse the existing compiler resource owner and carry one captured memory budget through the complete build plan. This preserves the existing once-per-plan memory-read contract and avoids a separate policy or new configuration option. Constrained hosts use the established memory, GC, and scheduler defaults; larger hosts retain the existing policy's behavior.

LOC delta: production paths **0**; build tooling **+16**, tests **+23**, docs **+4**. No schema, protocol, dependency, or public API change.

## Evidence

- Two real published-to-main update builds on the same small machine class lost the native compiler to kernel OOM at approximately 10.7 and 11.1 GiB resident memory.
- A full build with the Go policy completed in **5m24s**, maximum single-process RSS **6.95 GiB**; the complete declaration step took **2m37s**. This is a reliability result, not a throughput benchmark. The build also printed an unrelated existing Control UI startup-size warning.
- The missing-policy regression was red on the base. After sharing the captured budget, all **89** owning tests passed: `pnpm test test/scripts/tsdown-build.test.ts --maxWorkers=1`, **6.49s** wrapper / **2.26s** Vitest.
- Changed-file formatting, type-aware lint, `git diff --check`, and independent Codex review passed.

The live update also exposed a separate foreground restart outcome problem: its helper exits successfully but leaves the run awaiting Gateway completion. That lifecycle investigation is separate from this build fix; this PR does not claim a completed upgrade.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 22, 2026
…enclaw#179209)

## What Problem This Solves

A foreground Gateway update can activate the candidate successfully but then report `failed / abandoned`. Its updater exits after handing completion to the replacement Gateway. Automatic history reconciliation can mistake that intentional driver exit for abandonment before startup verifies the new build.

## User Impact

The replacement Gateway can record its actual boot verification and complete the update. CLI-owned and managed handoffs, unrelated sentinels, and explicit recovery retain their existing ownership checks.

## Why This Change Was Made

Keep the decision in the existing reconciliation owner: a matching successful foreground restart sentinel reserves completion for the replacement Gateway. No new state, timeout, configuration, protocol, or dependency. The existing repair finalizer already reconciles explicitly after successful recovery.

Production LOC: **+18**. This bounded growth preserves the existing completion owner instead of adding initialization ordering across status readers and watchers. Tests: **+38**; docs: **+5**; three files.

## Evidence

- Two real `2026.10.5` foreground Gateway-to-main updates reproduced the same false terminal result after activation. The worker-local-inference tool completed, and its side effect appeared exactly once on both hosts. The second run used explicit Go compiler limits to isolate the separate build OOM fixed in openclaw#179140.
- The new regression was red on the base: the public history read recorded abandonment before the real restart finalizer could complete it. With the fix, the full owning suite passes all **19 tests**, including managed, foreign-sentinel, and explicit-recovery controls.
- `pnpm test src/gateway/server-restart-update-run.test.ts --maxWorkers=1`: **311.70s** wrapper / **283.71s** Vitest on a cold local worker graph; worker preparation took **200.24s**. The suite uses the real SQLite history reader and restart finalizer, with no Gateway boots or added sleeps.

- Remote exact-input validation also passed: type-aware lint (23.4s), all 57 update-repair tests (83.62s wall), and the four reconciliation cases after formatting (44.50s wall). Export collision checks and all three Knip export scans passed (125.30s combined).

The complete published-to-main matrix, including the node update and extended-stable Gateway, will run against merged main. Those results are pending; the earlier activated-but-abandoned updates are not claimed as successful upgrades.

## Inherited CI failure

The CI merge head reports TS2345 in `test/scripts/ci-changed-node-test-plan.test.ts:813,891`: `CompactNodeTestShard` lacks `configs`. The same two diagnostics reproduce with `node scripts/run-tsgo.mjs --noEmit -p test/tsconfig/tsconfig.test.root.tooling.json` on unmodified current main `99969d3c08366ceabd6dafc6f10a93bd9e3ccb60`. This PR changes neither that test nor the planner types. The Gateway test typecheck passed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. docs Improvements or additions to documentation scripts Repository scripts size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant