-
Notifications
You must be signed in to change notification settings - Fork 134
🤖 feat: validated make update-models refresh + full catalog in Treat as #3930
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+21,198
−13,596
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
6fa65fb
feat: validated make update-models flow + full Treat-as catalog (#3727)
ibetitsmike e84d314
chore: refresh models.json from LiteLLM via make update-models
ibetitsmike dda73bb
review: address Codex findings on update flow and catalog
ibetitsmike aa5110e
review: share lookup keys, add catalog build prereq, drop mux secret …
ibetitsmike 4e04f5c
review: expose only round-tripping catalog rows, guard priced coverage
ibetitsmike 07dd882
review: track usable and per-field priced coverage in the shrink guard
ibetitsmike 673c0d8
review: extend priced-coverage guard to responses-mode entries
ibetitsmike 430c0fb
review: per-mode coverage baselines and shared curated lookup keys
ibetitsmike 70578c3
review: reject catalog-wide price magnitude collapse
ibetitsmike 382ca0e
review: generalize refresh validation to per-field coverage and numer…
ibetitsmike 67ccf59
review: bound per-entry numeric shifts against the vendored baseline
ibetitsmike c95ee88
review: compare refresh entries by runtime identity; attribute automa…
ibetitsmike File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| # Weekly refresh of the vendored LiteLLM model catalog | ||
| # (src/common/utils/tokens/models.json) via scripts/update_models.ts, which | ||
| # validates pricing shape and curated-model coverage before writing (#3727). | ||
| # Opens or updates a bot PR only when the data changed. | ||
| # SETUP: reuses the auto-cleanup GitHub App credentials (XUM_APP_ID and | ||
| # XUM_APP_PRIVATE_KEY) so the PR triggers CI. | ||
|
|
||
| name: Update Models | ||
|
|
||
| on: | ||
| schedule: | ||
| - cron: "0 6 * * 1" # Weekly, Mondays 6 AM UTC | ||
| workflow_dispatch: {} | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
|
|
||
| concurrency: | ||
| group: update-models | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| update-models: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Check required secrets | ||
| id: precheck | ||
| env: | ||
| XUM_APP_ID: ${{ secrets.XUM_APP_ID }} | ||
| XUM_APP_PRIVATE_KEY: ${{ secrets.XUM_APP_PRIVATE_KEY }} | ||
| run: | | ||
| if [ -z "$XUM_APP_ID" ] || [ -z "$XUM_APP_PRIVATE_KEY" ]; then | ||
| echo "Skipping (missing XUM_APP_ID / XUM_APP_PRIVATE_KEY)." | ||
| echo "enabled=false" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "enabled=true" >> "$GITHUB_OUTPUT" | ||
| fi | ||
|
|
||
| - uses: actions/create-github-app-token@d72941d797fd3113feb6b93fd0dec494b13a2547 # v1.12.0 | ||
| id: app-token | ||
| if: ${{ steps.precheck.outputs.enabled == 'true' }} | ||
| with: | ||
| # Use a GitHub App token so PR events trigger CI. PRs opened via | ||
| # GITHUB_TOKEN intentionally do not trigger other workflows. | ||
| app-id: ${{ secrets.XUM_APP_ID }} | ||
| private-key: ${{ secrets.XUM_APP_PRIVATE_KEY }} | ||
|
|
||
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | ||
| if: ${{ steps.precheck.outputs.enabled == 'true' }} | ||
| with: | ||
| # Pin to main so a workflow_dispatch from a feature branch cannot leak | ||
| # unrelated commits into the shared bot/update-models branch. | ||
| ref: refs/heads/main | ||
| token: ${{ steps.app-token.outputs.token }} | ||
|
|
||
| - uses: oven-sh/setup-bun@b7a1c7ccf290d58743029c4f6903da283811b979 # v2.1.0 | ||
| if: ${{ steps.precheck.outputs.enabled == 'true' }} | ||
| with: | ||
| bun-version: 1.3.5 | ||
|
|
||
| - name: Update models.json | ||
| if: ${{ steps.precheck.outputs.enabled == 'true' }} | ||
| # Go through the Makefile target (which installs dependencies first) so | ||
| # automation and local refreshes share one entry point. | ||
| run: make update-models | ||
|
|
||
| - name: Push branch and open PR if changed | ||
| if: ${{ steps.precheck.outputs.enabled == 'true' }} | ||
| env: | ||
| GH_TOKEN: ${{ steps.app-token.outputs.token }} | ||
| run: | | ||
| if git diff --quiet -- src/common/utils/tokens/models.json; then | ||
| echo "models.json already up to date; no PR needed." | ||
| exit 0 | ||
| fi | ||
|
|
||
| git config user.name "mux-bot[bot]" | ||
| git config user.email "264182336+mux-bot[bot]@users.noreply.github.com" | ||
| git checkout -B bot/update-models | ||
| git add src/common/utils/tokens/models.json | ||
| # Attribution footer per .xum/skills/pull-requests: automation | ||
| # commits use the workflow marker instead of model/thinking/cost. | ||
| footer="--- | ||
|
|
||
| _Automated by the \`update-models\` workflow (GitHub Actions)._ | ||
|
|
||
| <!-- xum-attribution: workflow=update-models -->" | ||
| git commit -m "🤖 chore: refresh models.json from LiteLLM" -m "$footer" | ||
| git push --force origin bot/update-models | ||
|
|
||
| open_prs=$(gh pr list --head bot/update-models --state open --json number --jq length) | ||
| if [ "$open_prs" = "0" ]; then | ||
| gh pr create \ | ||
| --title "🤖 chore: refresh models.json from LiteLLM" \ | ||
| --body "Automated weekly refresh of the vendored LiteLLM model catalog via \`make update-models\` (#3727). | ||
|
|
||
| $footer" \ | ||
| --base main \ | ||
| --head bot/update-models | ||
| else | ||
| echo "Existing open PR for bot/update-models updated by push." | ||
| fi | ||
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.