fix(ai): build from the committed model catalog instead of refetching it - #2038
Open
snimu wants to merge 2 commits into
Open
fix(ai): build from the committed model catalog instead of refetching it#2038snimu wants to merge 2 commits into
snimu wants to merge 2 commits into
Conversation
`npm run build` in packages/ai ran `generate-models` on every build, fetching the live model catalog and rewriting `src/models.generated.ts` in place. When an upstream source drops a model that the repo still references (currently claude-sonnet-4.5, 28 references), every CI run fails `Build and check` and `Test (ai)` regardless of the PR's content, and release builds (build-binaries.yml) ship a catalog nobody reviewed. Build now compiles the committed catalog only. Refreshing the catalog stays an explicit, reviewed step: `npm run generate-models`. The generated file is the script's only output and is committed, so clean checkouts build and test without network access to the catalog sources. Linear: RES-1269
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.
Problem
packages/ainpm run buildwasnpm run generate-models && tsgo ...: every build (CIBuild and check, everyTest (*)job, and releasebuild-binaries.yml— all runnpm run build) fetched the live model catalog and rewrotesrc/models.generated.tsin place.Upstream removed
claude-sonnet-4.5from the catalog sources, but the committedmodels.generated.tsand 28 in-repo references (includingpackages/aitests) still use it. So on every CI run the Build step silently swapped in a catalog without that model, and the subsequentnpm run check/Test (ai)failed with e.g.:Every PR fails
Build and check,Test (ai), andbuild-check-testregardless of content (example: run 33854776241 on #1947).Fix
Build compiles the committed catalog only:
packages/aibuildis now justtsgo -p tsconfig.build.json.npm run generate-modelsstays as the explicit, reviewed refresh step (it is the existing documented command in AGENTS.md, README, and the generated-file header; no new alias added).src/models.generated.tsis the generator's only output and is committed (not gitignored), so clean checkouts build and test with no network fetch of the catalog. This PR deliberately does NOT regenerate the catalog — removingclaude-sonnet-4.5references is a separate reviewed refresh.Callers audited
generate-modelshad exactly one caller: thepackages/aibuildscript. Rootbuild,prepublishOnly(npm publish),ci.yml(Build and check+ all test jobs), andbuild-binaries.yml(release/beta binaries) all funnel through it, so all now build from the committed catalog. No other workflow, script, or hook invokesgenerate-models.Verification (clean checkout in a Prime sandbox, source-only sync +
npm ci)npm run build: exit 0;models.generated.tsmd5 identical before/after;generate-modelsnever invoked.npm run check: exit 0 (biome, root tsgo--noEmit, installer check, browser smoke).packages/ainpm test: 50 files passed / 22 skipped, 341 tests passed / 720 skipped, 0 failures.Linear: RES-1269
Note
Low Risk
Build-script-only change;
generate-modelsremains available for intentional catalog refreshes with no auth or runtime behavior changes.Overview
Stops implicit model-catalog refresh on every
packages/aibuild so CI and local builds use the committedmodels.generated.tsinstead of rewriting it from live upstream data.The
buildscript no longer runsgenerate-modelsbeforetsgo; catalog updates stay on the explicitnpm run generate-modelsstep. A changelog note documents that workflow.Reviewed by Cursor Bugbot for commit f6b2059. Bugbot is set up for automated code reviews on this repo. Configure here.
LOC
Total src: +0/−0 (net +0); tests: +0/−0 (net +0).
Note
Stop refetching model catalog during
npm run buildinpackages/aiRemoves the
generate-modelsstep from thepackages/aibuild script so builds compile against the committedmodels.generated.ts. Runnpm run generate-modelsexplicitly when the catalog needs refreshing.Macroscope summarized f6b2059.