Skip to content

fix: stale model pins resolve or fail with a named error (#1282) - #2186

Open
jacktrnr wants to merge 1 commit into
mainfrom
fix/1282-stale-model-pins
Open

jacktrnr wants to merge 1 commit into
mainfrom
fix/1282-stale-model-pins

Conversation

@jacktrnr

Copy link
Copy Markdown
Contributor

Closes #1282

What

1. Audit: every shipped model ID now resolves against the provider catalog. The engine resolves provider/model IDs against the models.dev catalog (baked into the binary at build time, refreshed at runtime). The audit used a snapshot of that catalog taken 2026-11-22, stored in packages/extension/test/fixtures/model_catalog.json. To refresh it, run node packages/extension/scripts/snapshot_model_catalog.mjs.

Stale pins found and fixed:

Where Was Problem Now
onboarding, GitHub Copilot github-copilot/gpt-5.6 not in catalog github-copilot/gpt-5.6-sol
onboarding, Bedrock amazon-bedrock/anthropic.claude-sonnet-4-5-v2 not in catalog amazon-bedrock/anthropic.claude-sonnet-4-6
onboarding, OpenCode anthropic/claude-opus-5, anthropic/claude-sonnet-5, openai/gpt-5.6-sol resolve against providers an OpenCode-key user never authed, so the pick is silently ignored opencode/claude-opus-5, opencode/claude-sonnet-5, opencode/gpt-5.6-sol
model routing strongest-reasoner anthropic/claude-opus-4-1 gone from the anthropic provider anthropic/claude-opus-5

Checked and still resolving: the amicode.distillerModel default opencode/big-pickle, the other onboarding and model-class IDs, and the RUNBOOK examples. The extension bakes no chat default (resolveModelPin() returns undefined), and no kimi-k3 literal remains in the engine source.

2. A stale pin that still reaches the engine now fails with a named error.

  • The HTTP error middleware (server/routes/instance/httpapi/middleware/error.ts, now in the overlay) used to turn every ProviderModelNotFoundError into the generic Unexpected server error 500. It now returns a named 400 in the {name: "ProviderModelNotFoundError", data: {providerID, modelID, suggestions, message}} shape that the app's error renderer already formats.
  • ProviderModelNotFoundError.message now names the fix: Model not found: p/m. Model "m" is not available from provider "p"; pick another model in the model picker or update the pinned model in your config. Did you mean: …?. The session error event published from SessionPrompt.getModel reuses this message. The old Model not found: p/m prefix is kept, so the existing matchers (dead-pick INVALID, tests) still apply.

Out of scope: the hub-side boot gate and warning (hub is paid-side).

Tests (written first, RED, then GREEN)

  • packages/extension/test/shipped_model_pins.test.ts (new). It checks four things against the snapshot: every onboarding template ID resolves, each template belongs to the provider it is offered under, every model-class candidate resolves, and the distiller default resolves and matches the source fallbacks. The first RED run had 3 failures, listing exactly the pins above.
  • overlay/.../test/server/httpapi-error-middleware.test.ts: new case "returns a stale model pin as a named, actionable model error". It was RED (500) before the fix.
  • onboarding_panel.test.ts: the Bedrock probe test now expects the new second model ID.

Gates: pnpm --filter amicode test passes, engine typecheck gate is OK, drift_gate passes. Manifest refreshed.

🤖 Generated with Claude Code

Audit every model ID Amicode ships against the provider catalog the
engine resolves IDs against (models.dev, snapshotted in
packages/extension/test/fixtures/model_catalog.json):

- onboarding: github-copilot/gpt-5.6 (gone) -> github-copilot/gpt-5.6-sol
- onboarding: amazon-bedrock/anthropic.claude-sonnet-4-5-v2 (never in the
  catalog) -> amazon-bedrock/anthropic.claude-sonnet-4-6
- onboarding: the OpenCode provider offered anthropic/... and openai/...
  IDs, which resolve against providers the user never authed -> opencode/...
- model routing: strongest-reasoner anthropic/claude-opus-4-1 (gone from
  the anthropic provider) -> anthropic/claude-opus-5

A stale pin that still reaches the engine now fails loudly: the HTTP
error middleware returns ProviderModelNotFoundError as a named 400
("Model X is not available from provider Y; pick another model...")
instead of the generic "Unexpected server error" 500, and the session
error event carries the same actionable message.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1459d51c-e8fc-400a-868b-8499aef8fd35
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@jacktrnr
jacktrnr marked this pull request as ready for review November 23, 2026 22:27
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.

Stale model pins break prompt paths silently — baked defaults + config templates must resolve or fail loudly

1 participant