← Back to PRs

#19533: fix: allow forward-compat models in buildAllowedModelSet

by Anthony-g-dev open 2026-02-17 22:54 View on GitHub →
agents size: S
## 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