Repository navigation
fix(build): prevent native declaration compiler OOMs - #179140
Merged
Merged
Conversation
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review in progressClawSweeper is reviewing this revision. This supersedes any previous blocked status. |
steipete
marked this pull request as ready for review
October 21, 2026 06:25
Contributor
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
pnpm test test/scripts/tsdown-build.test.ts --maxWorkers=1, 6.49s wrapper / 2.26s Vitest.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.