Skip to content

perf(ci): skip global declaration emission in the CI artifacts build - #108949

Merged
steipete merged 2 commits into
mainfrom
perf/ci-build-skip-global-dts
Jul 16, 2026
Merged

steipete merged 2 commits into
mainfrom
perf/ci-build-skip-global-dts

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

build-artifacts is now the PR CI wall-clock pole (376s in run 29492619358). Its cost is one tsdown invocation at 224.7s — and measurement shows declaration emission is ~95% of that: the same main-graph invocation takes 132.5s with dts and 6.0s without (local, M-series; CI instrumentation via [tsdown-build] invocation N timings).

Why This Change Was Made

PR CI's dist consumers (dist-requiring node test bins, QA packaging, boundary checks) execute runtime JS only. The single declaration consumer on the PR path is check-plugin-sdk-exports, and write-plugin-sdk-entry-dts already has a self-build mode that produces the scoped plugin-sdk declarations with its own bounded tsdown pass (45s local). So the ciArtifacts profile now:

  • runs tsdown with OPENCLAW_RUN_NODE_SKIP_DTS_BUILD=1 (precedent: qaRuntime, gatewayWatch, cliStartup, sourcePerformance already skip dts),
  • runs write-plugin-sdk-entry-dts in non-canonical (self-build) mode,
  • drops that step's build cache in self-build mode — its outputs depend on the whole SDK source graph, which the canonical-mode cache inputs do not cover, so a hit could restore stale declarations.

Release and package builds (full profile, docker packaging with OPENCLAW_RUN_NODE_SKIP_DTS_BUILD=0) keep canonical declaration emission and canonical-mode gate verification. Trade-off note: PR CI validates the SDK surface against self-built scoped declarations rather than the full-graph canonical chunks; full-graph dts breakage would surface at release-build validation rather than PR CI. tsgo prod/test typechecks still run on every PR.

User Impact

None at runtime — CI-only. PR feedback gets faster: local end-to-end pnpm build:ci-artifacts drops to 92s (was ~4min equivalent); the CI job should drop from ~376s toward ~200s, removing the current PR wall-clock pole.

Evidence

  • Measurement: node scripts/tsdown-build.mjs 147s total with dts, 14.9s without (same tree, back-to-back).
  • Self-build gate: node --import tsx scripts/write-plugin-sdk-entry-dts.ts (non-canonical) 49s, then node scripts/check-plugin-sdk-exports.mjs → "OK: All 4 required plugin-sdk exports verified" (declaration graph 3.83MB within budget).
  • Full pipeline: pnpm build:ci-artifacts 92s, all steps green, phase timings in the build log.
  • node scripts/run-vitest.mjs test/scripts/build-all.test.ts green (profile expectations updated with the contract note).
  • This PR touches scripts/build-all.mjs, so its own CI run exercises the changed build lane end-to-end — compare build-artifacts duration against 376s baseline before merge.

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: S maintainer Maintainer-authored PR labels Jul 16, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7142a72e4a

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/build-all.mjs
// CI's dist consumers are runtime JS only; the plugin-sdk gate below
// self-builds its scoped declarations instead. Release/package builds
// (full profile, docker packaging) keep canonical dts.
OPENCLAW_RUN_NODE_SKIP_DTS_BUILD: "1",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Don't clobber the package build's DTS override

When scripts/package-openclaw-for-docker.mjs builds self-contained package artifacts it invokes node scripts/build-all.mjs ciArtifacts with OPENCLAW_RUN_NODE_SKIP_DTS_BUILD=0 because that path is supposed to keep declaration generation. resolveBuildAllStep merges the step env after the caller env, so this new ciArtifacts default wins and the nested tsdown still sees 1; Docker/package artifact builds therefore skip the canonical declarations they explicitly requested. Please make the PR-CI fast path conditional or let the packaging override pass through before forcing the skip.

Useful? React with 👍 / 👎.

@steipete
steipete force-pushed the perf/ci-build-skip-global-dts branch from 7142a72 to be8f36d Compare July 16, 2026 11:31

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: be8f36d098

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/build-all.mjs
OPENCLAW_PRESERVE_CLI_STARTUP_METADATA: "1",
},
"write-plugin-sdk-entry-dts": {
OPENCLAW_PLUGIN_SDK_CANONICAL_DTS: "0",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Preserve canonical SDK DTS for package builds

When the Docker/package artifact path calls scripts/build-all.mjs ciArtifacts from scripts/package-openclaw-for-docker.mjs:370 with declaration generation explicitly enabled at scripts/package-openclaw-for-docker.mjs:379, this override still forces write-plugin-sdk-entry-dts into self-build mode and replaces the canonical plugin SDK declarations that package artifacts are supposed to ship. Fresh evidence beyond the prior tsdown override: even if the package helper's DTS override is allowed through, this separate step override prevents canonical-mode gate verification for package builds that reuse ciArtifacts.

Useful? React with 👍 / 👎.

steipete added 2 commits July 16, 2026 04:51
Declaration emission is ~95% of the tsdown wall clock (measured 132.5s
with dts vs 6.0s without on the main graph; 224.7s in CI). PR CI's dist
consumers only execute runtime JS, so the ciArtifacts profile now skips
global dts and the plugin-sdk export gate validates self-built scoped
declarations (write-plugin-sdk-entry-dts non-canonical mode, 45s local).
The step cache is dropped in self-build mode because its outputs depend
on the SDK source graph the canonical cache inputs do not cover.
Release and docker packaging builds keep canonical declarations.
Local end-to-end: build:ci-artifacts 92s with all gates green.
gateway-core and gateway-methods flaked at 6 workers (hook timeouts,
mock-state res.setHeader TypeError, waitForAssertion misses) on the
first run after the worker-budget raise while passing on two prior
validation runs — the same intermittent contention class media-ui
showed. Pin both like the other timing-sensitive groups.
@steipete
steipete force-pushed the perf/ci-build-skip-global-dts branch from be8f36d to d4b1924 Compare July 16, 2026 11:51
@steipete
steipete merged commit 1d54795 into main Jul 16, 2026
97 of 98 checks passed
@steipete
steipete deleted the perf/ci-build-skip-global-dts branch July 16, 2026 11:54
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 17, 2026
…penclaw#108949)

* perf(ci): skip global declaration emission in the CI artifacts build

Declaration emission is ~95% of the tsdown wall clock (measured 132.5s
with dts vs 6.0s without on the main graph; 224.7s in CI). PR CI's dist
consumers only execute runtime JS, so the ciArtifacts profile now skips
global dts and the plugin-sdk export gate validates self-built scoped
declarations (write-plugin-sdk-entry-dts non-canonical mode, 45s local).
The step cache is dropped in self-build mode because its outputs depend
on the SDK source graph the canonical cache inputs do not cover.
Release and docker packaging builds keep canonical declarations.
Local end-to-end: build:ci-artifacts 92s with all gates green.

* fix(ci): pin gateway suites to the proven 2-worker Vitest budget

gateway-core and gateway-methods flaked at 6 workers (hook timeouts,
mock-state res.setHeader TypeError, waitForAssertion misses) on the
first run after the worker-budget raise while passing on two prior
validation runs — the same intermittent contention class media-ui
showed. Pin both like the other timing-sensitive groups.
zooqueen pushed a commit to zooqueen/openclaw that referenced this pull request Sep 11, 2026
…penclaw#108949)

* perf(ci): skip global declaration emission in the CI artifacts build

Declaration emission is ~95% of the tsdown wall clock (measured 132.5s
with dts vs 6.0s without on the main graph; 224.7s in CI). PR CI's dist
consumers only execute runtime JS, so the ciArtifacts profile now skips
global dts and the plugin-sdk export gate validates self-built scoped
declarations (write-plugin-sdk-entry-dts non-canonical mode, 45s local).
The step cache is dropped in self-build mode because its outputs depend
on the SDK source graph the canonical cache inputs do not cover.
Release and docker packaging builds keep canonical declarations.
Local end-to-end: build:ci-artifacts 92s with all gates green.

* fix(ci): pin gateway suites to the proven 2-worker Vitest budget

gateway-core and gateway-methods flaked at 6 workers (hook timeouts,
mock-state res.setHeader TypeError, waitForAssertion misses) on the
first run after the worker-budget raise while passing on two prior
validation runs — the same intermittent contention class media-ui
showed. Pin both like the other timing-sensitive groups.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR scripts Repository scripts size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant