fix(opencode): respect HARNESS_MODEL in baked-in opencode.json (small_model path)#24
Merged
Merged
Conversation
The baked-in opencode.json hardcoded both model and small_model to a
literal kimi-k2.5 string, so OpenCode's small_model path (used for
session titles and prompt compaction) silently bypassed whatever
HARNESS_MODEL the deployer set on Railway. Per-call -m on `opencode run`
already pins the main model from HARNESS_MODEL via the Python harness
provider; this aligns the small_model path the same way.
OpenCode supports {env:VAR} interpolation in string fields. Switch
model and small_model to {env:HARNESS_MODEL} so they track the env var
the rest of the pr-af stack already reads. The Dockerfile already sets
HARNESS_MODEL=openrouter/moonshotai/kimi-k2.5 as the image default, so
fresh containers without overrides still have a value to interpolate.
Also drops the now-redundant `models` registration block — OpenCode
auto-handles unknown model names from a configured provider, and pinning
a specific name there broke the moment HARNESS_MODEL changed.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
The baked-in `~/.config/opencode/opencode.json` hardcoded both `model` and `small_model` to a literal `openrouter/moonshotai/kimi-k2.5`. The main model is fine — the Python harness provider passes `-m $HARNESS_MODEL` to `opencode run`, which overrides config. But OpenCode's `small_model` (used for session titles, summarization, prompt compaction) reads from config, not the CLI flag. Result: a deployer setting `HARNESS_MODEL=X` on Railway gets X for the main model and `kimi-k2.5` for small_model — env var silently bypassed.
OpenCode supports `{env:VAR}` interpolation in string fields. This PR switches `model` and `small_model` to `{env:HARNESS_MODEL}` so both paths read from the same env var the rest of the pr-af stack already respects.
What changes
```diff
```
The Dockerfile already sets `HARNESS_MODEL=openrouter/moonshotai/kimi-k2.5` as the image default, so a fresh container with no env overrides still has a value to interpolate. Railway / docker-compose env injection wins because it lands after the image's ENV layer.
The `models` registration block was dropped — OpenCode auto-handles unknown model names from a configured provider, and pinning a specific name there broke the moment `HARNESS_MODEL` changed.
Why this isn't the same as #23 (closed)
#23 was bumping the literal `kimi-k2.5` → `kimi-k2.6` in the same files. That was cosmetic — env vars already overrode the main-model path. This PR fixes the actual env-var bypass: the small_model field that env vars couldn't override at all.
Test plan
🤖 Generated with Claude Code