Skip to content

feat(models): read the default model from a lock a weekly robot proposes changes to (Part B v1 pilot) - #9

Open
HomenShum wants to merge 9 commits into
mainfrom
claude/model-lock-pilot
Open

HomenShum wants to merge 9 commits into
mainfrom
claude/model-lock-pilot

Conversation

@HomenShum

@HomenShum HomenShum commented Oct 16, 2026 •

Copy link
Copy Markdown
Owner

Summary

Part B v1 pilot, consumer side (SPEC-v9 §B.5-B.6): NodeRL stops typing its default model and reads it from models.lock.json, which NodeKit's weekly proposal-only robot proposes changes to. Homen's goal: "all these app's top default models need to be updated too (and should be auto updated by release dates and performance)".

The situation. NodeRL's reasoning step defaults to one model (claude-haiku-5-5, set by the merged Part A refresh, #6/#8). A default typed into code is never re-read, so when the vendor announces a retirement nobody notices until requests fail. Now the default is the reasoner role in a lock file; a weekly job compares the lock with NodeKit's reviewed registry and, if something this repo uses changed (the id, its request constraints, its lifecycle dates, its price), opens one pull request on automation/model-defaults. A person merges. It never merges itself, uses no provider key and makes no paid call.

Behaviour change: none. The default is still claude-haiku-5-5; the request shape is unchanged. The existing request-shape tests now read the lock instead of naming the id (see the review section): they assert the same request for today's default and keep passing when the default moves. Callers can still pass any model id to aiSdkReasoner(id); an id the registry has not reviewed comes back as override-unknown and keeps today's routing (providerFor).

Depends on HomenShum/NodeKit#47 (its verify check currently fails on a missing Evolution Ledger event that needs Homen's reviewer approval). Merge that first: this PR's workflow reads NodeKit's models.yaml and tooling, pinned to that PR's head commit b2e86cadd9160969d089cada65b9364052f5ba0a. After NodeKit merges, bump the pin (the three uses: refs and platform_sha) to the merge commit in a one-line reviewed PR.

What is in it

Path What
models.config.json this repo's declaration: role reasoner = line anthropic.haiku on transport anthropic; frozen: []; exclude: []; the gate (npm ci, npm test && npm run typecheck); the raw-id allowlist
models.lock.json generated by nodekit models sync from NodeKit c2cc149 (unchanged by the re-pins to cac830b, d6cb103 and b2e86ca: sync rewrites the lock only when a decision field changes, so registryRef stays at the commit that last changed it, which still exists on NodeKit#47's branch); pins claude-haiku-5-5, its wire ids per transport, constraints and lifecycle on its own transport (Anthropic: Active; floor 2027-10-07, advisory only). It carries no price: only OpenRouter priced it and this role routes through Anthropic, so an OpenRouter-only change cannot open a PR here
packages/nodetrace/src/models.ts lookup-only accessor: resolveModel(role, override?) (sources lock, override, override-incompatible, override-unknown) and wireId (throws instead of constructing an id)
packages/nodetrace/src/reasoning.ts DEFAULT_REASONING_MODEL = resolveModel("reasoner").id (was a literal)
.github/workflows/model-defaults.yml Tuesday 14:23 UTC watch then bump; lint on every pull request (no path filter). permissions: {} at top; read for lint, issues: write for watch, contents: write + pull-requests: write for bump. Calls NodeKit's reusable workflow by 40-hex SHA
tests models.test.ts (+6), test/model-defaults-workflow.test.ts (+5)
docs docs/model-defaults.md; docs/codebase/INTEGRATIONS.md (the line-20 citation became line 21 because of the new import, which test/citations.test.ts caught)

The check the spec defines (G2 lint + G3)

nodekit models lint runs on every PR (a path filter would let a raw model id added outside packages/ merge unlinted and then block the next weekly bump, because rule (b) scans the whole repo), comparing the lock with NodeKit's models.yaml fetched as data at the commit the lock itself pins: (b) no raw model id in code outside the allowlist, (b2) the role's transport is one its line offers and has a wire id, (c) the pinned id is not retired/unlisted and not within 30 days of an announced retirement on the transport in use (a floor is never a finding; an unverified transport warns). (a) the lock must equal what the registry gives for this repo's config; it fails on a PR that hand-edits the lock (observed: a lock edited to claude-opus-5-5 exits 1, the same lock unedited passes). On the weekly run the lock is also regenerated from the current registry first. G3 is this repo's own npm test && npm run typecheck plus the request-shape tests, which read the lock: the model string must equal the lock's wire id and the lock's constraints (sampling/prefill/budget_tokens forbidden) are asserted against the real request body. This repo's install and test commands run in NodeKit's read-only check job (contents: read), as its last step. The pull request is opened by a separate write job that runs none of this repo's code: it starts from a fresh checkout, recomputes the lock from the same registry commit, and pushes nothing unless that lock's hash equals the one the gate ran on. (Round 1 said the commands ran "with no GitHub token". That was literally true and not enough: they shared a job with the push step and could change what was pushed; see round 2.)

REA + ORX (decision D5)

Reverse-engineered before building: LiteLLM's and models.dev's catalog sync guards, Renovate's stateless "immortal PR" behaviour, Dependabot/Renovate cooldown and no-automerge defaults, GitHub's GITHUB_TOKEN PR run policy and the 60-day schedule auto-disable. Facts adopted/rejected, with links and fetch dates, are in the NodeKit PR and D:/VSCode Projects/model-defaults/_scratch/partb-research/brief.md. Primary sources (fetched 2026-10-16, keyless): Anthropic model-deprecations .md, OpenAI deprecations .md, Google deprecations, OpenRouter GET /api/v1/models.

Round-1 adversarial review: what was found and fixed here

  • P1, the pilot could never deliver a changed default. models.test.ts asserted DEFAULT_REASONING_MODEL === "claude-haiku-5-5" and the same literal in the request body. The weekly bump runs npm test before it opens its PR, so the first legitimate registry move (a reviewed successor) would have failed that gate every week and no PR would ever open. Reproduced: a lock moved to a successor made npm test 37 of 38. Fixed: the test reads the id, the wire string (wireId) and the effort from the lock. Re-run with a temporary lock moved to a successor, both with and without "low" in its efforts: 39 of 39 each time (the lock was restored afterwards).
  • Related, effort: "low" went to whatever id the lock named. providerOptionsFor (now exported) sends it only to the lock's default, and only when the lock's constraints.efforts list low. New test covers a successor with and without it, no constraints, and a caller-supplied id.
  • P2, lint rule (a) was skipped on PRs (WARN (a) skipped in run 38894610385). Fixed in NodeKit's reusable workflow; the lock is now compared with the registry at the commit it pins. Observed locally: a hand-edited lock fails, the real one passes, sync --check is clean.
  • P1, consumer commands ran with a write token. Round 1 moved the token off the gate's step; round 2 showed that was not enough (see below). gate.install is still plain npm ci.
  • Re-pinned to NodeKit c2cc149 in round 1 and regenerated the lock; the lock no longer carries another transport's availability or the OpenRouter price.

Round-2 adversarial review: what was found and fixed here

A second independent review (plus a Codex review) judged head 4f37a64 and returned FAIL. The two findings that concern this repo:

  • P1, this repo's own npm ci and npm test could still change what the bot pushes and capture the write token. They ran in the same job as the push step; the push step re-read the staged lock from the runner's temp directory without checking it again, and a fresh git init still reads the user's global git config, so a hook set by npm test ran on the push step's commit with the token in its environment. The reviewers ran the real push step after a simulated test step and got exit 0, a bot-branch commit with attacker-chosen content, and the token captured. NodeRL main is unprotected, the default workflow permission is read and ci.yml only gets contents: read, so the pilot would have added a write path that did not exist. Fixed in NodeKit#47 (cac830b): the bump is two jobs, a read-only check that runs this repo's gate last and a write that runs none of this repo's code and pushes only a lock it recomputed itself. This PR re-pinned the three uses: refs and platform_sha to cac830b (and, after round 3, to d6cb103); models sync leaves the lock unchanged, and lint passes against both the registry the lock pins and the new one.
  • P3, lint ran on only some paths, but rule (b) scans the whole repo. The pull_request trigger was filtered to the lock, the config and packages/**, so a raw model id added under test/, experiments/ or promotion/ passed its own PR and then blocked the next weekly bump at the lint step. Fixed: the filter is removed, and test/model-defaults-workflow.test.ts fails if a paths, paths-ignore or branches filter returns.
  • Wrong claims corrected. "Installs run with no GitHub token" (above). The previous report's "one required check red" was wrong for NodeKit: its main has no branch protection or rulesets, so verify is red by that repo's policy, not as a GitHub requirement. Heads and counts in the earlier report were stale.

Round-3 adversarial review: what changed here

A third independent review judged NodeKit#47 cac830b and this PR at de60e40 and returned FAIL. Its eight defects are all in NodeKit (parsers that skipped notice tables, a replacement the robot's own validation rejects, setup-node running consumer-controlled code before the write job, workflow paths no test executed, untested guards, replay without the second clock, role dates read from main, stale claims); see NodeKit#47's round-3 table. What this PR needed:

  • Re-pin the three uses: refs and platform_sha to NodeKit d6cb103. The lock is unchanged: nodekit models sync --check against d6cb103 prints "lock unchanged", models lint passes, npm test 40 of 40, npm run typecheck clean. test/model-defaults-workflow.test.ts (all references are the same 40-hex commit) passes unchanged.
  • Stale text corrected. The review noted the job is lint / check, not lint / run (already so below), and that the Actions setting named in blocker 1 is now ON.
  • Not changed: the Part A live receipt (blocker 2). The default and the request are unchanged and no paid call was made.

Round-4 adversarial review: what changed here

A fourth independent review judged NodeKit#47 d6cb103 and this PR at 66f7c38 and returned FAIL. Five of its eight defects are in NodeKit (see its round-4 table). Two are here:

  • P2, the gate test crashed on a valid successor. models.test.ts read role.constraints.efforts without a default, and two of the three reviewed ids (claude-sonnet-5-5, claude-opus-5-5) carry no efforts. Removing efforts from the locked role gave 9 pass and 1 fail (TypeError), so the weekly bump's own gate (G3) failed and the robot could never deliver that successor. Fixed: the expectation is (efforts ?? []).includes("low"), in one helper, with a test that a role with no efforts, or no constraints, is handled. Checked by removing efforts from the lock: 11 of 11 pass in that file (was 9 and 1).
  • P2, the consumer workflow could be switched off silently. Forcing dry_run: true on the scheduled watch or bump left every test green; every scheduled run would then stay green while the URGENT issue (including the "registry refresh not running" alarm) and the proposal PR never opened. Fixed: test/model-defaults-workflow.test.ts evaluates both dry_run values for the scheduled event (must act), a default manual run (must not push) and a manual run with the box unticked (must act). Checked by knockout: forcing either job's dry_run to true now fails the file (4 pass, 1 fail each).
  • Re-pin the three uses: refs and platform_sha to NodeKit b2e86ca. The lock is unchanged: models sync --check prints "lock unchanged", models lint passes.
  • Stale text corrected: the file table said the workflow test file adds 3 tests (it had 4, now 5).

Verification (observed 2026-10-17, head 38afa86)

  • npm test: 42 of 42 pass at 38afa86 (was 31 before the pilot; +6 in models.test.ts, +5 workflow-contract tests); npm run typecheck: clean.
  • nodekit models lint --registry <NodeKit models.yaml> PASS; nodekit models sync --check unchanged; a hand-edited lock fails rule (a).
  • Knockouts, round 4: forcing dry_run: true on watch, on bump (each fails the workflow test), and the lock with efforts removed (the gate test passes). Earlier, in a throwaway copy: 12 mutants of the accessor and the workflow (effort sent to any id, override transport or constraints taken from the role, an unknown override resolved as the lock, wireId constructing an id, actions: write on bump, a diverging platform_sha or uses: ref, bump no longer needing watch, a path filter back on lint, write on the lint job). 11 are killed by the tests. The twelfth, a typed literal default, is not meant to be caught by a test: lint rule (b) blocks it (observed MODELS LINT BLOCKED ... raw model id "claude-haiku-5-5" at packages/nodetrace/src/reasoning.ts). The literal assertions are gone, so a moved default no longer fails the tests.
  • Observed on GitHub Actions at head 38afa86: lint / check passed, lint / write, watch and bump were skipped by design, source-checks and GitGuardian passed (the two-job workflow in lint mode, called by NodeKit b2e86ca, whose setup-node now runs before the consumer checkout with its cache off). Earlier, at de60e40 (run 38991826347) the same job passed against cac830b. At the earlier head 4f37a64 (run 38961030868, lint / run) NodeKit's model-bump.yml in lint mode resolved the lock's registryRef to a 40-hex commit, fetched models.yaml and index.json from raw.githubusercontent.com at that commit, validated it against the schema, ran models lint --registry ... and printed MODELS LINT PASS with no (a) skipped warning.

Observed about the cross-repo read the weekly watch does: NodeKit is public and its commits endpoint answers an unauthenticated request (200), so the registry-commit lookup does not depend on NodeRL's token. The workflow-runs endpoint it uses for liveness answers 404 today because model-registry-refresh.yml is not on NodeKit's default branch yet. After NodeKit#47 merges, the first Tuesday watch will therefore raise the URGENT issue "registry refresh not running" until the NodeKit refresh has had one successful run (any successful run counts, including a dry-run workflow_dispatch). That is the intended honest answer, not a false alarm; dispatch NodeKit's refresh once right after merging to clear it.

Not observed: the watch and bump paths have not run on GitHub Actions (a schedule or workflow_dispatch needs the file on the default branch); the first workflow_dispatch (dry run by default) after both PRs merge is the proof. Whether GitHub shows an "Approve workflows to run" banner on a GITHUB_TOKEN-created PR is also unobserved (brief D-9): the bump token has no actions: write, so a bot PR shows no CI until a human approves its runs.

Needs Homen / blockers

  1. Merge NodeKit#47 first (its verify check is red on a missing Evolution Ledger event that needs your reviewer approval; that repo has no branch protection, so the check is red by its policy and nothing technically stops a merge). The repo setting Settings > Actions > General > Allow GitHub Actions to create and approve pull requests is now ON in both repos (can_approve_pull_request_reviews: true, read after the round-3 push); an earlier version of this text said OFF. I changed no repo setting.
  2. The Part A live receipt (evidence/model-refresh-20261015/receipt.json) is bound to testedCommit ba8f2ed and the old reasoning.ts blob hash. This PR changes that file without changing the default value or the request, and makes no paid call, so the receipt is not regenerated. A fresh keyed receipt is Homen's call (SPEC §C.1).
  3. Open PRs owned by others: none in NodeRL. No file of the Codex replay lane is edited.

🤖 Generated with Claude Code

HomenShum and others added 9 commits October 16, 2026 04:11
…ses changes to (Part B v1 pilot)

NodeRL stops typing its default model. DEFAULT_REASONING_MODEL is now the
reasoner role in models.lock.json, generated by NodeKit's `nodekit models sync`
from its reviewed registry. A weekly workflow opens ONE proposal PR when a
decision-relevant fact changes; a human merges; no provider key, no paid call.

- models.config.json: role reasoner = anthropic.haiku on the anthropic transport
- models.lock.json: pins claude-haiku-5-5 with wire ids, constraints, lifecycle,
  price (priced by openrouter, valid only there)
- packages/nodetrace/src/models.ts: lookup-only resolveModel / wireId
- request-shape tests now read the lock and assert its constraints against the
  real request body; all four resolveModel sources are covered
- .github/workflows/model-defaults.yml: weekly watch + bump, lint on PRs,
  NodeKit tooling pinned by 40-hex SHA, least-privilege permissions per job

No behaviour change: the default is still claude-haiku-5-5 and the request is
unchanged. Depends on HomenShum/NodeKit claude/model-registry-pilot.

Source: SPEC-v9 Part B (B.5, B.6) and the REA + ORX brief (2026-10-16).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
NodeKit's seed registry digest was recomputed (provenance only; the decision
set is unchanged, so every locked role, id and constraint is identical). The
lock's registryRef/decisionDigest and the three workflow pins follow.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…5309cb)

Only the NodeKit entry-point routing and generated repo map changed there;
the registry and its decision set are identical, so the locked role, id and
constraints are unchanged. Lock registryRef and the three workflow pins follow.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
… to the reviewed fixes

- models.test.ts: the default id, its wire string and the effort option are asserted against
  models.lock.json (and wireId) instead of the literal claude-haiku-5-5. The weekly bump runs
  npm test before it opens its PR, so the literal made every legitimate default change fail
  at that gate and no PR could ever open. Verified by temporarily moving the lock to a
  reviewed successor, with and without "low" in its efforts: 39/39 both times.
- reasoning.ts: effort "low" is sent only when the lock's constraints for the default list
  it (providerOptionsFor is exported and tested), instead of to whatever id the lock names.
- Re-pin NodeKit (uses refs and platform_sha) to c2cc149, which fixes the token exposure to
  this repo's install and test commands and makes lint rule (a) fail on a PR, and regenerate
  the lock: a role now carries its own transport's availability and no OpenRouter price.
- docs: describe the lint-against-pinned-registry and the token-free gate.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…-2 fixes

- model-defaults.yml: drop the `pull_request` path filter. Lint rule (b) scans the whole repo
  for raw model ids, so a raw id added outside packages/ used to merge unlinted and then block
  the next weekly bump at the lint step. A test fails if a filter comes back.
- Re-pin NodeKit (the three `uses:` refs and `platform_sha`) to bb85e06. That commit splits
  NodeKit's bump workflow into a read-only job that runs this repo's `npm ci` and `npm test`
  (as its last step) and a write job that runs none of this repo's code, so the consumer's
  own commands can no longer reach the token that opens the pull request. The lock is
  unchanged by `models sync`; lint passes against both the registry it pins and the new one.
- docs: describe the two jobs.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The only change since bb85e06 is a comment in a NodeKit test; the three uses refs and platform_sha
move together so they name the PR head. The lock is unchanged.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Both uses refs and platform_sha move together. The lock is unchanged:
`models sync --check` against NodeKit d6cb103 reports it unchanged, lint passes,
npm test 40/40 and typecheck clean. No paid call.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…sumer pilot

- The gate test read `efforts` off the locked role without a default, so a reviewed successor that carries none
  (sonnet-5-5 and opus-5-5 do not) crashed it and the weekly bump's own gate could never deliver that successor.
  The expectation now tolerates a role with no efforts, and a test pins that.
- A test now evaluates watch's and bump's dry_run for the scheduled event (must act) and a default manual run (must
  not push). Forcing either to true used to leave every test green and every scheduled run silently inert.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant