Skip to content

fix(docker): image build runs out of memory on 8 GB builders - #248

Merged
ikhsanuddin merged 1 commit into
boonfrom
fix/docker-build-skip-dts
Sep 27, 2026
Merged

ikhsanuddin merged 1 commit into
boonfrom
fix/docker-build-skip-dts

Conversation

@ikhsanuddin

@ikhsanuddin ikhsanuddin commented Sep 27, 2026 •

Copy link
Copy Markdown

What Problem This Solves

Fixes an issue where the Docker image build ran out of JavaScript heap during pnpm build:docker (tsdown) on 8 GB builders. getboon/gandalf-manager builds this Dockerfile from source on GitHub's private-repo arm64 runner (2 vCPU, 7.7 GiB). Since openclaw 21933b7c every attempt dies with FATAL ERROR: Ineffective mark-compacts near heap limit, so the trial signup-container never builds or promotes (gandalf-manager run 36337996143, both attempts). The PR-side build-and-smoke gate hits the same wall.

Why This Change Was Made

The build ran tsdown with declaration emit on, and the runtime-assets stage then deletes every .d.ts. The declaration pass was pure cost. The RUN now sets OPENCLAW_RUN_NODE_SKIP_DTS_BUILD=1, the same flag scripts/package-openclaw-for-docker.mjs and the ciArtifacts build profile already use. Raising --max-old-space-size would not help: scripts/tsdown-build.mjs already clamps the heap to MemTotal minus 768 MB (about 7143 MB on that runner), which is where the build died.

User Impact

No runtime change. The final image already contained no .d.ts, and the JS output is the same. Image builds fit on 8 GB builders again with room to spare.

Evidence

Local tsdown run at 21933b7c, OPENCLAW_TSDOWN_MAX_OLD_SPACE_MB=7143 to match the runner, /usr/bin/time -v:

  • before: peak RSS 9.5 GB, 1m39s
  • after: peak RSS 3.1 GB, 5s
  • both emit the same 5524 non-declaration files under dist/, dist-runtime/ and packages/*/dist; before adds 1964 .d.ts

src/dockerfile.test.ts and test/scripts/test-install-sh-docker.test.ts pass; the first now also fails if the flag is removed from the build:docker RUN.

Real arm64 build: gandalf-manager run 36341206891, dispatched on a non-main ref (every push/promote step is gated on main) with openclaw_ref=fix/docker-build-skip-dts. Same runner as the failing run (2 CPUs, 7.726 GiB). It built openclaw 42270b19 (this branch on 21933b7c); build:docker finished in 28.7s, where run 36337996143 died after 12+ minutes, and the whole openclaw base image step passed. The run then stopped at the mgmt OIDC step, which does not trust non-main refs, so nothing was pushed or promoted.

The build:docker step ran tsdown with dts enabled, then runtime-assets
deleted every .d.ts. On openclaw 21933b7 the declaration pass pushes
tsdown to 9.5 GB peak RSS, past the 7.7 GiB of GitHub's private-repo
arm64 runner, so gandalf-manager's signup-container build OOMs at the
heap limit on every attempt. With OPENCLAW_RUN_NODE_SKIP_DTS_BUILD=1
(already used by package-openclaw-for-docker and the ciArtifacts build
profile) the same build peaks at 3.1 GB and emits the same 5524
non-declaration files.
@ikhsanuddin
ikhsanuddin requested a review from a team September 27, 2026 18:32

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Heads up: you’re close to your included review allowance. Set a flex budget so reviews don’t pause.

Re-trigger cubic

@augusteo augusteo left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve — verified at head 42270b1, CI-correctness and runner-capacity lens.

Skipping dts changes nothing that ships:

  • tsdown.config.ts:42 reads the flag and sets dts: false on all 17 tsdown entries; JS emit path is untouched.
  • runtime-assets stage (Dockerfile:151) already deletes every .d.ts/.d.mts/.d.cts under /app/dist, and the final stage copies only from runtime-assets — no .d.ts ever reached the image.
  • Same flag is already exercised by scripts/package-openclaw-for-docker.mjs:355 and the ciArtifacts profile in scripts/build-all.mjs, so the mechanism is proven, not new.
  • src/dockerfile.test.ts now hard-requires the flag in the build:docker RUN — regression guard in place.

Runner headroom is real (arm64 proof, gandalf-manager run 36341206891):

  • Step "Build openclaw base image (shared action)" succeeded at openclaw_sha 42270b1 on the 2 vCPU / 7.7 GiB runner: #33 (the build:docker RUN) finished DONE 28.7s.
  • Pre-fix run 36337996143 on main died in that same #33 step: FATAL ERROR: Ineffective mark-compacts near heap limit at 572.5s. Same runner class, before/after is clean.
  • The run's overall failure conclusion is the mgmt OIDC step (sts:AssumeRoleWithWebIdentity — role does not trust non-main refs); nothing was pushed or promoted, and it is unrelated to this change.
  • Heap-clamp claim checks out: tsdown-build.mjs caps at cgroup/MemTotal minus 768 MB (~7143 MB here), so raising --max-old-space-size could not have fixed it — skipping the declaration pass is the right lever.

All 9 openclaw workflows green at 42270b1. LGTM.

@ikhsanuddin
ikhsanuddin merged commit 2ff5dc0 into boon Sep 27, 2026
147 checks passed
@ikhsanuddin
ikhsanuddin deleted the fix/docker-build-skip-dts branch September 27, 2026 18:53
convyusboy added a commit that referenced this pull request Sep 28, 2026
…249)

* chore(release): bump version 2026.6.11-boon.46 -> 2026.6.11-boon.47

Root version, 135 plugin manifests synced via scripts/sync-plugin-versions.ts, changed npm-shrinkwrap.json files regenerated, CHANGELOG section for boon.47.

Shipping: #236/#239 (a plugin tool's own execute() handler can now reliably schedule/unschedule a cron-backed session turn, fixing the browser-handoff recheck across three sequential live-found bugs), #240 (recheck backoff cap tightened 5m -> 2m), #242 (recheck messages the customer before attaching the browser), #241 (delivery.mode: "none" cron jobs can deliver an explicit message-tool send), #243 (Chrome MCP stderr drained before connect, not after), #247 (distinct exec-trajectory label for boon-projects schedule append/list), ENG-20030 (shared turn-resume-instruction wording for boon-core/anychat-boon-web), #248 (Docker build no longer OOMs 8 GB CI runners).

Base = 2026.6.11-boon.46. Gateway plus @openclaw/slack, @openclaw/msteams and @openclaw/diagnostics-prometheus bumped in lockstep; no separately published plugin source changed in this train, so a gateway roll delivers all of it.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(release): regenerate stale extension npm-shrinkwrap.json versions for boon.47

pnpm plugins:sync bumps each plugin's package.json version but does not touch its checked-in npm-shrinkwrap.json, so 65 published extension shrinkwraps still embedded version 2026.6.11-boon.46 despite package.json already reading boon.47. Since npm-shrinkwrap.json ships inside the npm artifact, this would have published every affected plugin with a mismatched embedded version.

Bumped the version field(s) in all 65 (plus the openclaw peerDependency range where present) to 2026.6.11-boon.47, matching the pattern boon.46's bump commit already applied to these same files.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

---------

Co-authored-by: Claude Sonnet 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants