Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
275 changes: 275 additions & 0 deletions .github/workflows/model-bump.yml

Large diffs are not rendered by default.

52 changes: 52 additions & 0 deletions .github/workflows/model-registry-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Model registry check

# G1 for any pull request that touches the registry (SPEC-v9 §B.2). On the bot branch it also enforces the
# bot-writable allowlist, so a force-push that smuggled in a human-owned edit (constraints, reviewed, roles,
# regex, transports) or removed an entry fails here.

on:
pull_request:
paths:
- models.yaml
- models/**
- schemas/nodeplatform.models.v1.schema.json
- src/lib/model-*.mjs
- src/lib/models-cli.mjs
- .github/workflows/model-*.yml

permissions: {}

jobs:
g1:
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
env:
BASE_REF: ${{ github.base_ref }}
HEAD_REF: ${{ github.head_ref }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 22
cache: npm
- run: npm ci --ignore-scripts
- name: Validate the registry (schema, references, hygiene, eligibility)
run: node src/cli.mjs models validate --stage full
- name: Bot branch only - allowlist of what the bot may change
if: env.HEAD_REF == 'automation/model-registry'
run: |
git show "origin/$BASE_REF:models.yaml" > "$RUNNER_TEMP/base.yaml"
git diff --name-only "origin/$BASE_REF...HEAD" > "$RUNNER_TEMP/changed.txt"
node src/cli.mjs models validate --stage full --base "$RUNNER_TEMP/base.yaml" --changed-files "$RUNNER_TEMP/changed.txt"
# The allowlist says which FIELDS may change; replay says the change is the one selection produces. It re-runs
# B.4 over the snapshots committed on this branch, from the registry on the base branch and the clock recorded
# in models/selection-input.json, and must reproduce models.yaml byte for byte. A move with no trigger, an
# edited release date or a proposal older than the base branch's registry therefore fails here.
- name: Bot branch only - replay selection (B.2.3)
if: env.HEAD_REF == 'automation/model-registry'
run: node src/cli.mjs models replay --input-registry "$RUNNER_TEMP/base.yaml"
92 changes: 92 additions & 0 deletions .github/workflows/model-registry-refresh.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Model registry refresh

# Weekly, proposal-only (SPEC-v9 §B.6, brief 2026-10-16). Reads four public, keyless catalogs, runs the
# registry's own gates, and opens or updates ONE pull request on automation/model-registry when the decision
# set differs from main. A human merges; nothing here merges, and no provider key or paid call is involved.
#
# Needs the repo setting "Allow GitHub Actions to create and approve pull requests" (Settings > Actions >
# General). Without it the PR step fails loudly; the rest of the run is still valid evidence.

on:
schedule:
- cron: "47 13 * * 1"
workflow_dispatch:
inputs:
dry_run:
description: Run every gate and print the proposal body, but push nothing and open no PR.
type: boolean
default: true

permissions: {}

concurrency:
group: model-registry-refresh
cancel-in-progress: false

jobs:
refresh:
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: write
pull-requests: write
env:
BRANCH: automation/model-registry
# No GH_TOKEN here: `npm ci`, the catalog parsers and `git commit` run in this job, and the token is an `env:` on
# only the steps that talk to GitHub (the closed-PR guard and the push), as in model-bump.yml.
# A scheduled run is never a dry run; a manual run is one unless the input says otherwise.
DRY_RUN: ${{ github.event_name == 'workflow_dispatch' && inputs.dry_run || 'false' }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 22
cache: npm
- run: npm ci --ignore-scripts
- name: Start the evaluation clock
run: echo "AT=$(date -u +%Y-%m-%dT%H:%M:%S.000Z)" >> "$GITHUB_ENV"
- name: Snapshot the public catalogs (a fetch or structure failure fails the run)
run: node src/cli.mjs models snapshot
- name: Input validation (G1, B.2.1)
run: node src/cli.mjs models validate --stage inputs --max-age-days 14 --evaluated-at "$AT"
- name: Keep the input registry for the diff and the replay
run: cp models.yaml "$RUNNER_TEMP/models.input.yaml"
- name: Select (B.4)
id: select
run: node src/cli.mjs models select --write --evaluated-at "$AT" --ref "$GITHUB_SHA" --body-out "$RUNNER_TEMP/body.md" --github-output "$GITHUB_OUTPUT"
- name: Eligibility, merge rule and bot-diff allowlist (G1, B.2.2)
run: node src/cli.mjs models validate --stage full --evaluated-at "$AT" --base "$RUNNER_TEMP/models.input.yaml"
- name: Replay (B.2.3)
run: node src/cli.mjs models replay --input-registry "$RUNNER_TEMP/models.input.yaml"
- name: Closed-PR guard
id: guard
if: steps.select.outputs.changed == 'true'
env:
GH_TOKEN: ${{ github.token }}
DECISION_SHA: ${{ steps.select.outputs.decisionSetSha256 }}
run: |
gh pr list --state closed --head "$BRANCH" --json number,body,mergedAt,closedAt --limit 5 > "$RUNNER_TEMP/closed.json"
node src/cli.mjs models pr-guard --closed-prs "$RUNNER_TEMP/closed.json" --hash "$DECISION_SHA" --github-output "$GITHUB_OUTPUT"
- name: Show the proposal
if: steps.select.outputs.changed == 'true'
run: cat "$RUNNER_TEMP/body.md" >> "$GITHUB_STEP_SUMMARY"
- name: Commit the proposal
if: steps.select.outputs.changed == 'true' && steps.guard.outputs.suppress != 'true' && env.DRY_RUN != 'true'
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git checkout -B "$BRANCH"
git add models.yaml models
git commit -m "chore(models): refresh the model registry"
- name: Open or update the proposal PR
if: steps.select.outputs.changed == 'true' && steps.guard.outputs.suppress != 'true' && env.DRY_RUN != 'true'
env:
GH_TOKEN: ${{ github.token }}
run: |
AUTH="$(printf 'x-access-token:%s' "$GH_TOKEN" | base64 -w0)"
git -c "http.https://github.com/.extraheader=AUTHORIZATION: basic $AUTH" fetch origin "$BRANCH:refs/remotes/origin/$BRANCH" || true
git -c "http.https://github.com/.extraheader=AUTHORIZATION: basic $AUTH" push --force-with-lease origin "$BRANCH"
gh pr create --head "$BRANCH" --base "${GITHUB_REF_NAME}" --title "chore(models): refresh the model registry" --body-file "$RUNNER_TEMP/body.md" \
|| gh pr edit "$BRANCH" --body-file "$RUNNER_TEMP/body.md"
48 changes: 48 additions & 0 deletions CHANGELOG/library/model-registry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Changelog - model registry (`src/lib/model-*.mjs`, `nodekit models`)

> **Surface**: the reviewed list of exact model ids, its weekly proposal-only refresh, and the consumer lock.
>
> **Append rule**: New entries go at the top and released entries are never rewritten.

## 2026-10-16 - Fix the pilot after adversarial review (round 2)

The consumer's own install and test commands no longer share a job with the write token: `model-bump.yml` is a read-only
`check` job (the gate is its last step) and a `write` job that runs none of the consumer's code, recomputes the lock and
refuses to push unless it is the one the gate ran on. The weekly refresh no longer stops when the data it produced is
incomplete: a replacement without a release date (or, on an OpenRouter line, a price and context) is held with a row
naming the gap, and a bad OpenRouter row cannot stop an Anthropic-only line; a human can now record a price or context
window under the transport's name. `watch` judges a consumer's frozen ids on the catalogs fetched now. The Anthropic
history table and every OpenAI model row are checked, not just the page. A date crossing the 90 or 30-day line changes
the decision set (`horizon` on dated deprecation rows). A replacement that itself retires is held in the same run. The
G1 check on the bot branch replays selection. The refresh job puts `GH_TOKEN` on the steps that need it only, and
the consumer PR body carries release and per-transport lifecycle facts.

**Commit**: `this commit`. **Author**: Claude.
**Touches**: `docs/MODEL_REGISTRY.md`

## 2026-10-16 - Fix the pilot after adversarial review (round 1)

The consumer workflow no longer hands its write token to the consumer's own install and test commands: `GH_TOKEN`
is set per step, the gate runs without it, and the pull request is committed and pushed from a fresh repository.
Lint rule (a) now compares the lock with the registry at the commit the lock pins, so it can fail on a pull request.
A reformatted OpenAI page that loses its model ids is refused (`minIdRows`). `watch` checks a consumer's frozen ids
against the registry's snapshots. A consumer lock carries only its own transport's availability and price. A hand
edit of a bot-owned derived field fails validation (baseline integrity). A merged move no longer leaves a
status-only follow-up PR, a replacement is held to the 30-day eligibility test, a row that stops giving a price
clears the OpenRouter price, and the consumer PR body quotes the snapshot hashes from the fetched `index.json`.
The removed `proposed-deprecation` status and the unreachable snapshot-shrink check in `validateModels` are gone.

**Commit**: `this commit`. **Author**: Claude.
**Touches**: `docs/MODEL_REGISTRY.md`

## 2026-10-16 - Add the model registry pilot (Part B v1)

Adds `models.yaml`, four public catalog snapshots, `nodekit models snapshot | validate | select | replay |
pr-guard | sync | lint | watch`, a weekly proposal-only refresh workflow, a G1 check and a reusable consumer
workflow. The first consumer is NodeRL (`models.lock.json`). Every parser throws on an unrecognised page so a
layout change fails the run instead of reading as "nothing is deprecated". Scenario tests cover a retired
incumbent, a newly released successor, a missing catalog field, an unchanged catalog on a new date, network
failure, a hostile redirect, scale, 52 sustained weekly cycles and the closed-PR guard.

**Commit**: `this commit`. **Author**: Claude.
**Touches**: `docs/MODEL_REGISTRY.md`
Loading
Loading