improve(ci): cut warm startup metadata build time#109863
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f13c705f6d
ℹ️ 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".
| reusableExisting && | ||
| reusableExisting.browserHelpSourceSignature === browserHelpSourceSignature && | ||
| typeof reusableExisting.browserHelpText === "string" && | ||
| reusableExisting.browserHelpText.length > 0 | ||
| ? reusableExisting.browserHelpText |
There was a problem hiding this comment.
Refresh command help when build identity changes
On warm builds that restore a previous cli-startup-metadata.json, this reuses browserHelpText (and the analogous command snapshots below) when only the command source signature matches. However command help includes the global banner from src/cli/program/help.ts:130-136, and that banner embeds the current version/commit via formatCliBannerLine (src/cli/banner.ts:50-65). So a build where only dist/build-info.json changes refreshes root help but ships stale precomputed openclaw browser|secrets|nodes|doctor... --help banners from the cached seed.
Useful? React with 👍 / 👎.
|
Merged via squash.
|
What Problem This Solves
Warm CI builds restore declaration outputs but not
dist/cli-startup-metadata.json, so every fresh job still launches the CLI help renderers. That costs roughly 6 seconds of an otherwise 16–22 second warm build.Why This Change Was Made
The existing build-all artifact now carries a 44 KB startup-metadata seed. Each cache hit restores the seed, runs the existing exact signature validator, and refreshes the cached output if validation regenerates anything. Partial changes reuse unaffected command-help snapshots; commit/version changes rerender root help only.
The normal build job already persists Node's compile cache. A controlled cold/warm comparison showed no measurable additional build gain, so this PR does not add another Node cache path or change shard/workflow layout.
User Impact
No product behavior changes. CI producers spend less time regenerating identical CLI startup metadata, including after partial source changes.
Evidence
6.13scold,116msafter deleting the dist copy and restoring only.artifacts/build-all-cache; warm CI-artifact build16.5s; seed44 KB.13.62sdisabled,13.46scold cache,13.42swarm cache (noise-level difference); cache8.2 MB.node scripts/run-vitest.mjs test/scripts/build-all.test.ts test/scripts/write-cli-startup-metadata.test.ts: 63 tests passed.pnpm check:changed -- scripts/build-all.d.mts scripts/build-all.mjs scripts/write-cli-startup-metadata.ts test/scripts/build-all.test.ts test/scripts/write-cli-startup-metadata.test.ts: green on Blacksmith Testbox.AI-assisted: implementation and validation performed with Codex; maintainer understands the change.