#19533: fix: allow forward-compat models in buildAllowedModelSet
agents
size: S
Cluster:
OpenAI Model Fixes and Updates
## Summary
- Forward-compat models (`claude-sonnet-4-6`, `claude-opus-4-6`, `gpt-5.3-codex`, etc.) are blocked with "Model not allowed" even when `resolveForwardCompatModel` can handle them
- `buildAllowedModelSet` checks the catalog snapshot, which does not include these models yet — so they never make it into `allowedKeys`
- Fix: add a pure `isForwardCompatModelId(provider, modelId)` function to `model-forward-compat.ts` (no registry needed, just ID pattern checks), then add one `else if` in `buildAllowedModelSet` to admit them
## Change Type
- [x] Bug fix (non-breaking)
- [ ] New feature
- [ ] Breaking change
- [ ] Refactor / cleanup
## Scope
- [x] Agent / model selection
## Linked Issues / PRs
Closes #11078 — GPT-5.3 Codex blocked by allowlist despite forward-compat fallback
Closes #16547 — Telegram /model rejects claude-opus-4-6 despite valid config
## Repro
1. Set `claude-sonnet-4-6` as active model
2. Start a session → `Error: Model "anthropic/claude-sonnet-4-6" is not allowed.`
3. After fix → resolves and runs normally via forward-compat
## Changes
- `model-forward-compat.ts`: new exported `isForwardCompatModelId(provider, modelId)` — pure, no side effects, covers all existing forward-compat patterns
- `model-selection.ts`: one extra `else if` in `buildAllowedModelSet` after the `configuredProviders` check
## Security Impact
- Grants new permissions? **No** — only models already handled by `resolveForwardCompatModel` are admitted
- Bypasses auth? **No**
- Exposes sensitive data? **No**
- Affects rate limits / billing controls? **No**
- Introduces new attack surface? **No**
## Human Verification
Tested locally with `claude-sonnet-4-6` and `claude-opus-4-6`, both work after the fix. Did not run the full test suite.
## Risks
Low — the new function is a pure ID check, no resolution logic changed.
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Adds forward-compat model detection for `claude-sonnet-4-6` and related models to allow them past the model allowlist before the catalog is updated. The PR correctly identifies the problem - forward-compat models were blocked by `buildAllowedModelSet` because they weren't in the catalog yet.
**Critical Issue Found:**
- `isForwardCompatModelId` was updated to recognize Sonnet 4.6 models, but no corresponding resolver was added to `resolveForwardCompatModel`
- This creates a mismatch: models will pass the allowlist check but fail during actual resolution with "Unknown model" error
- The fix is incomplete without either adding a Sonnet 4.6 resolver or removing the Sonnet checks from `isForwardCompatModelId`
**Changes Made:**
- Added `ANTHROPIC_SONNET_46_MODEL_ID` and `ANTHROPIC_SONNET_46_DOT_MODEL_ID` constants
- Updated `isForwardCompatModelId` to check for Sonnet 4.6 patterns alongside existing Opus checks
- Added `else if` branch in `buildAllowedModelSet` to admit forward-compat models to allowlist
<h3>Confidence Score: 1/5</h3>
- This PR has a critical logic bug that will cause runtime failures
- The PR introduces an incomplete forward-compat implementation for `claude-sonnet-4-6`. While it adds detection in `isForwardCompatModelId` to allow these models past the allowlist, it fails to add a corresponding resolver in `resolveForwardCompatModel`. This means users configuring `claude-sonnet-4-6` will experience "Unknown model" errors at runtime despite passing the allowlist check. The implementation is only half-complete and will not achieve the stated goal of allowing forward-compat models to work.
- src/agents/model-forward-compat.ts requires either a new Sonnet 4.6 resolver function or extension of the existing Opus resolver to handle Sonnet models
<sub>Last reviewed commit: 4bcc1e0</sub>
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#23250: feat: add Sonnet 4.6 forward compat for google-antigravity
by Oceanswave · 2026-02-22
85.8%
#14508: fix(models): allow forward-compat models in allowlist check
by jonisjongithub · 2026-02-12
82.8%
#20095: fix(model-forward-compat): extend claude-sonnet-4.6 forward-compat ...
by SeeYangZhi · 2026-02-18
82.7%
#18697: fix: include forward-compat models in model catalog for allowlist val…
by dmitry-orabey · 2026-02-17
82.2%
#13119: fix: add forward-compat for google-antigravity claude-opus-4-6 models
by sdb001 · 2026-02-10
81.1%
#12220: fix: forward-compat models now respect user-configured contextWindow
by Batuhan4 · 2026-02-09
80.7%
#16891: fix(models): generic opus-4-6 forward-compat for all providers
by battman21 · 2026-02-15
79.5%
#21181: fix(models): add gemini-3.1-pro-preview forward-compat for google-g...
by Mellowambience · 2026-02-19
78.7%
#10831: fix(agents): set Opus 4.6 context window to 1M in forward-compat fa...
by slawt · 2026-02-07
78.4%
#6673: fix: preserve allowAny flag in createModelSelectionState for custom...
by tenor0 · 2026-02-01
78.1%