ci: refresh the model catalog daily via scheduled workflow - #1633
ci: refresh the model catalog daily via scheduled workflow#1633eliebak wants to merge 2 commits into
Conversation
Adds a scheduled workflow (05:17 UTC daily, plus workflow_dispatch) that runs `npm run generate-models` in packages/ai and opens a PR on bot/update-model-catalog when the committed snapshot drifted from the live catalogs. Reruns force-push the same branch, so at most one refresh PR is open at a time. Because generate-models exits 0 when a source fetch fails and most sources fall back to an empty list rather than the snapshot, the job refuses to open a PR when the regenerated catalog lost more than 10% of its models versus the committed file. Bot-authored PRs already pass the contribution gate (bots are allowed automatically) and skip the changelog-fragment check. Known caveat: PRs opened with the default GITHUB_TOKEN do not trigger CI; push to the branch or close/reopen the PR, or swap in a PAT/App token. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 8c7c938. Configure here.
sethkarten
left a comment
There was a problem hiding this comment.
Design and implementation reviewed. A human-reviewed scheduled snapshot refresh is a sound lower-risk fit for the checked-in fallback catalog. Commit 6365b24 fixes both review findings by always checking out the default branch and refreshing an existing PR's body. The default workflow token's CI limitation is explicit: a maintainer must close/reopen each generated PR before merge, avoiding an unprovisioned PAT/App credential. Local root checks and the fresh CI suite passed; both review threads are resolved.
|
daily might be too frequently. ideally we have a more dynamic way of doing this that doesn't require human review |

Part of ENG-5435.
Context
The committed
packages/ai/src/models.generated.tssnapshot only updates when someone manually runsnpm run generate-modelsand opens a PR (#1445, #1481, and now #1632). Release builds regenerate from live catalogs anyway, so the checked-in snapshot silently drifts between manual refreshes. This automates the existing habit without removing human review.Changes
New scheduled workflow
.github/workflows/update-model-catalog.yml:workflow_dispatch), regenerates the catalog, and opens a PR when the snapshot drifted. Reruns force-push the fixedbot/update-model-catalogbranch, so at most one refresh PR is open at a time; a stale open PR just gets updated.generate-modelsexits 0 when a source fetch fails, and every source except Prime Inference falls back to an empty list rather than the committed snapshot. The job fails instead of opening a PR when the regenerated catalog lost more than 10% of its models versus the committed file, so a flaky fetch can't produce a "removed 300 models" PR.xai/->spacexai/move in chore(ai): regenerate the model catalog from live provider catalogs #1632), and removals deserve eyeballs.Interactions with existing checks, verified against current workflow configs:
.github/VOUCHED.td, so the gate won't auto-close the bot PR.user.type != 'Bot'), so no fragment is required on the automated PRs.Validation
npm run generate-modelsflow validated in chore(ai): regenerate the model catalog from live provider catalogs #1632, where the guard condition (1260 vs 1252 committed, well above the 90% floor) passes.GITHUB_TOKENdon't triggerpull_requestCI. Push to the branch or close/reopen to run CI, or swap in a PAT/App token if you want CI green automatically.🤖 Generated with Claude Code
Note
Medium Risk
The workflow has contents and pull-requests write access and force-pushes a bot branch. Failures in generate-models can still produce incomplete catalogs unless the 10% drop guard fires.
Overview
Automates the previously manual refresh of
packages/ai/src/models.generated.tsso the checked-in snapshot does not drift between human PRs.A new scheduled workflow runs
npm run generate-modelsdaily (and on dispatch). If the catalog changed, it force-pushesbot/update-model-catalogand opens or updates a single PR for review. A guard fails the job if the regenerated file has fewer than 90% of the committed model count, which is meant to catch silent empty-list fallbacks from failed provider fetches.PRs still need a human merge. Default
GITHUB_TOKENPRs do not runpull_requestCI until close/reopen or a follow-up push.Reviewed by Cursor Bugbot for commit 6365b24. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add daily scheduled workflow to regenerate
models.generated.tsand open PRnpm run generate-modelsinpackages/ai.packages/ai/src/models.generated.tschanges, the workflow force-pushes branchbot/update-model-catalogand creates/updates a PR againstmain.satisfies Modelcount drops below 90% of the previous count.actions/checkout@v7.0.0andactions/setup-node@v7.0.0by SHA, runs onubuntu-latestwith a 20-minute timeout.GITHUB_TOKENwill not trigger downstream CI checks; the PR body notes this limitation.📊 Macroscope summarized 6365b24. 1 file reviewed, 1 issue evaluated, 1 issue filtered, 0 comments posted
🗂️ Filtered Issues
.github/workflows/update-model-catalog.yml — 0 comments posted, 1 evaluated, 1 filtered
generate-modelscatches source-fetch errors and returns[](for example, the Vercel AI Gateway fetch), so such a failure removes that provider's catalog yet still passes this test and opens/force-updates a PR containing the silent provider-wide deletion. Track or validate source/provider counts rather than only the global count. [ Failed validation ]