fix(docker): register OpenRouter :variant slugs as OpenCode models#67
Closed
AbirAbbas wants to merge 2 commits into
Closed
fix(docker): register OpenRouter :variant slugs as OpenCode models#67AbirAbbas wants to merge 2 commits into
AbirAbbas wants to merge 2 commits into
Conversation
OpenCode's openrouter binding only knows model ids that match its
built-in registry — bare slugs like "minimax/minimax-m2.5". OpenRouter
routing variants (":nitro", ":floor", ":online", …) aren't in that
registry, so submitting "minimax/minimax-m2.5:nitro" produces:
ProviderModelNotFoundError
providerID: "openrouter"
modelID: "minimax/minimax-m2.5:nitro"
For main-model calls (per-call `-m` on `opencode run`) this fails the
reasoner outright with a fast 6-second error. For small_model (read
from {env:HARNESS_MODEL} in the config) OpenCode silently falls back to
DeepSeek V3.1, which is what the existing comment in this file warned
about. Net result: nitro routing was either dropped (silent fallback to
DeepSeek for small_model auxiliary calls) or failed the build outright
(main_model calls).
Fix: declare the slugs we use under provider.openrouter.models[…] so
OpenCode treats them as valid ids and passes them through to OpenRouter
verbatim. OpenRouter then honors the routing suffix and dispatches to
the fast-lane provider as intended.
Limits are conservative defaults — OpenCode only needs the entry to
exist for routing to fire; OpenRouter is the source of truth for actual
context/output limits.
Also bump the baked-in HARNESS_MODEL default to minimax/minimax-m2.5:nitro
so a fresh container with no Railway override matches what the deployment
is actually configured for. The previous kimi-k2.6 default is the one
that hung silently for 30 minutes in the smoke test that exposed this
whole chain of issues.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…encode.json Heredoc-in-RUN works in BuildKit but trips Dockerfile linters and is brittle when commands need to follow the heredoc body (the EOF line breaks Dockerfile line-continuation, so a trailing chown ends up parsed as a new instruction). PR-AF needs the same model-declaration block but also has to chown the config directory afterwards — that's the case that exposed the brittleness. Move the JSON config to docker/opencode.json and COPY it. Same content, no parser pitfalls, and the file is editable without grappling with Dockerfile escaping. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Collaborator
Author
|
Closing — overkill. The right answer is to drop the For the smoke test: set |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Investigation summary
Three symptoms the smoke test surfaced — all rooted in one bug:
openrouter/minimax/minimax-m2.5:nitrofast-fail in 6 seconds with `ProviderModelNotFoundError`. OpenCode's openrouter binding rejects `:nitro` because it isn't in OpenCode's built-in model registry.The 30-min hang we hit earlier with kimi-k2.6 was a separate failure mode (model registry knew about kimi-k2.6 but the OpenCode subprocess hung waiting on streamed chunks from OpenRouter). That's a different upstream issue. This PR addresses the `:nitro` rejection only.
Fix
Declare the slugs explicitly under `provider.openrouter.models[…]` in the Dockerfile-baked OpenCode config. OpenCode's config schema supports custom model declarations per provider; once a slug is in that list, OpenCode passes it through to OpenRouter verbatim and OpenRouter honors the routing suffix.
Declared:
Limits are conservative defaults; OpenCode only needs the entry to exist for routing to fire. OpenRouter is the source of truth for actual context/output limits.
Also bumps the baked-in `ENV HARNESS_MODEL` to `openrouter/minimax/minimax-m2.5:nitro` so a fresh container without a Railway override matches the deployment reality. The previous `kimi-k2.6` default is what hung for 30 min in the first failed smoke test.
What this does NOT fix (separate follow-ups)
Test plan
🤖 Generated with Claude Code