#20122: Fix sonnet alias resolving to opus in OpenCode Zen model aliases
agents
size: XS
trusted-contributor
Cluster:
OpenAI Model Fixes and Updates
## Problem
The `sonnet` and `sonnet-4` aliases in `OPENCODE_ZEN_MODEL_ALIASES` incorrectly resolve to `claude-opus-4-6` instead of `claude-sonnet-4-6`.
Users typing `sonnet` expecting the cheaper/faster Sonnet model silently get Opus instead — wrong model, higher cost, no warning.
## Fix
- `sonnet` → `claude-sonnet-4-6`
- `sonnet-4` → `claude-sonnet-4-6`
- Added `sonnet-4.6` alias
- `haiku`/`haiku-3.5` legacy aliases now point to Sonnet (closer match than Opus)
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Fixes the `sonnet` and `sonnet-4` aliases in `OPENCODE_ZEN_MODEL_ALIASES` to correctly resolve to `claude-sonnet-4-6` instead of `claude-opus-4-6`, preventing users from being silently billed at Opus rates when requesting Sonnet. Also adds a `sonnet-4.6` alias and updates legacy `haiku`/`haiku-3.5` aliases to point to Sonnet instead of Opus.
- **Bug found**: The `OPENCODE_ZEN_MODEL_ALIASES` test block (lines 99-101) was not updated — it still asserts `sonnet` and `haiku` map to `claude-opus-4-6`, which will cause test failures.
- The source code changes in `opencode-zen-models.ts` are correct and consistent with the rest of the codebase (e.g., `model-selection.ts` and `live-model-filter.ts` already reference `claude-sonnet-4-6`).
<h3>Confidence Score: 2/5</h3>
- The source code fix is correct, but the test file has stale assertions that will fail — this PR should not be merged until the test is updated.
- The alias corrections in the source file are valid and address a real billing/correctness issue. However, the test file contains two assertions (lines 100-101) that contradict the source changes and will fail, indicating the PR was not fully validated before submission.
- `src/agents/opencode-zen-models.e2e.test.ts` — lines 99-101 have stale assertions that need updating to match the new alias mappings.
<sub>Last reviewed commit: 2c2e2e4</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#20123: Add Claude Sonnet 4.6 to OpenCode Zen model catalog
by Clawborn · 2026-02-18
80.3%
#19927: fix(agents): replace hardcoded Anthropic model IDs with pattern mat...
by Milofax · 2026-02-18
75.3%
#23250: feat: add Sonnet 4.6 forward compat for google-antigravity
by Oceanswave · 2026-02-22
74.8%
#19533: fix: allow forward-compat models in buildAllowedModelSet
by Anthony-g-dev · 2026-02-17
73.1%
#20049: fix(model-selection): resolve short-name alias keys correctly
by widingmarcus-cyber · 2026-02-18
70.6%
#20095: fix(model-forward-compat): extend claude-sonnet-4.6 forward-compat ...
by SeeYangZhi · 2026-02-18
69.8%
#10831: fix(agents): set Opus 4.6 context window to 1M in forward-compat fa...
by slawt · 2026-02-07
69.8%
#20080: fix: resolve model aliases correctly when keyed by short name
by kamal-ayman · 2026-02-18
69.5%
#20104: Fix Anthropic 1M model ID: strip -1m suffix before API call
by Clawborn · 2026-02-18
69.3%
#16104: fix: implement model aliases for /model command
by MisterGuy420 · 2026-02-14
69.1%