#14508: fix(models): allow forward-compat models in allowlist check
agents
stale
size: S
Cluster:
Model Management Enhancements
## Summary
This PR fixes issue #14502 where the model allowlist blocks forward-compat fallback models like `anthropic/claude-opus-4-6`.
## Root Cause
In `buildAllowedModelSet()`, models from `agents.defaults.models` are only allowed if:
1. `isCliProvider()` returns true, OR
2. `catalogKeys.has(key)` returns true, OR
3. `configuredProviders[providerKey] != null`
For `anthropic/claude-opus-4-6`, none of these are true because:
- Anthropic is a built-in provider (not in `models.providers`)
- `opus-4-6` isn't in the Pi SDK catalog (only `opus-4-5`)
- The forward-compat fallback runs AFTER the allowlist check
## Solution
Added a check for **native providers** - providers that are natively supported via environment variables and don't require explicit configuration. This includes: `anthropic`, `openai`, `google`, `groq`, `xai`, `cerebras`, `mistral`, `openrouter`, `together`, `voyage`, `deepgram`, etc.
The new logic adds an `else if (isNativeProvider(providerKey))` branch that allows models from native providers to be added to the allowlist even when they're not in the catalog.
## Changes
- Added `NATIVE_PROVIDERS` set with all providers that work via env vars
- Added `isNativeProvider()` helper function (exported for external use)
- Updated `buildAllowedModelSet()` to allow native provider models
- Added tests for `isNativeProvider()` and the new allowlist behavior
## Testing
All existing tests pass, plus new tests for:
- `isNativeProvider()` recognizes built-in providers
- `buildAllowedModelSet()` allows native provider models not in catalog
- Unknown providers are still blocked (unless explicitly configured)
Fixes #14502
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This change updates the model allowlist construction so that models from "native" providers (providers that can be authenticated/configured via built-in environment-variable or built-in auth handling) are considered allowlist-able even when they are not present in the curated Pi SDK model catalog. Concretely, `buildAllowedModelSet()` now adds allowlisted keys when `isNativeProvider(providerKey)` is true, which unblocks forward-compat fallback model IDs like `anthropic/claude-opus-4-6` before they appear in the catalog.
The PR also adds `isNativeProvider()` (based on a `NATIVE_PROVIDERS` set) and corresponding Vitest coverage for both the helper and the new allowlist behavior. This fits into the existing model-selection pipeline where config allowlists are normalized and checked before model resolution/fallbacks happen downstream.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk.
- The change is narrowly scoped to allowlist construction and is covered by new unit tests. The native-provider set aligns with existing built-in env/auth resolution paths, and unknown providers remain blocked unless explicitly configured.
- No files require special attention
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#9583: fix(models): allow models in agents.defaults.models even if not in ...
by hotzen100 · 2026-02-05
88.2%
#7570: fix: allow models from providers with auth profiles configured
by DonSqualo · 2026-02-03
85.3%
#6673: fix: preserve allowAny flag in createModelSelectionState for custom...
by tenor0 · 2026-02-01
84.2%
#11349: fix(agents): do not filter fallback models by models allowlist
by liuxiaopai-ai · 2026-02-07
84.0%
#9822: fix: allow local/custom model providers for sub-agent inference
by stammtobias91 · 2026-02-05
83.4%
#19533: fix: allow forward-compat models in buildAllowedModelSet
by Anthony-g-dev · 2026-02-17
82.8%
#18697: fix: include forward-compat models in model catalog for allowlist val…
by dmitry-orabey · 2026-02-17
81.7%
#21882: feat(gateway): filter models.list by agents.defaults.models allowlist
by kckylechen1 · 2026-02-20
81.1%
#13119: fix: add forward-compat for google-antigravity claude-opus-4-6 models
by sdb001 · 2026-02-10
80.5%
#13626: fix(model): propagate provider model properties in fallback resolution
by mcaxtr · 2026-02-10
80.3%