#16838: fix: include configured fallbacks in model allowlist
docs
channel: slack
agents
stale
size: S
## Problem
When `agents.defaults.models` is set (enabling the model allowlist), models listed in `agents.defaults.model.fallbacks` are silently dropped if they aren't also present as keys in `agents.defaults.models`.
This causes `All models failed (1)` errors when the primary provider enters cooldown (rate limit) — the configured fallback is never attempted despite being explicitly configured.
### Reproduction
1. Set `agents.defaults.model.primary = 'anthropic/claude-opus-4-6'`
2. Set `agents.defaults.model.fallbacks = ['openai/gpt-5.2']`
3. Set `agents.defaults.models = { 'anthropic/claude-opus-4-6': {} }` (common for aliases/params)
4. Trigger Anthropic rate limit (cooldown)
5. Expected: OpenAI fallback is attempted
6. Actual: `All models failed (1): anthropic/claude-opus-4-6: Provider anthropic is in cooldown`
### Root Cause
`buildConfiguredAllowlistKeys()` in `model-selection.ts` only includes models from the `agents.defaults.models` map as allowlist entries. Configured fallbacks not listed there are filtered out by `resolveFallbackCandidates()`.
### Fix
`buildConfiguredAllowlistKeys()` now includes all models explicitly referenced in config:
- `agents.defaults.model.primary` + `.fallbacks[]`
- `agents.defaults.imageModel.primary` + `.fallbacks[]`
- `agents.list[].model` and `agents.list[].subagents.model`
### Test
Added e2e test that reproduces the exact scenario: primary provider in cooldown + allowlist enabled + fallback not in allowlist → verifies fallback is still attempted.
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
This PR contains two distinct changes bundled together:
**1. Model allowlist fix** (`model-selection.ts`, `model-fallback.e2e.test.ts`): Fixes a bug where configured fallback models were silently dropped when `agents.defaults.models` (the model allowlist) was present but didn't include the fallback entries. `buildConfiguredAllowlistKeys()` now also collects models referenced in `agents.defaults.model.primary/fallbacks`, `agents.defaults.imageModel`, and `agents.list[].model/subagents.model`. A well-structured e2e test reproduces the exact failure scenario.
**2. Slack thread inheritance default change** (`provider.ts`, system-prompt, docs, tests): Changes `thread.inheritParent` default from `false` to `true`, making thread replies route to the parent session by default. System prompt updated to tell agents not to use reply tags by default, deferring to user-configured `replyToMode`.
- The new Slack test (`"disables thread inheritance when inheritParent is false"`) has **missing imports** for `waitForSlackEvent`, `getSlackHandlers`, and `flush` — this test will fail at runtime with `ReferenceError`. Either add the missing imports or refactor to use the `runSlackMessageOnce` helper like the other tests in the file.
<h3>Confidence Score: 3/5</h3>
- The core model-selection fix is sound, but the Slack test has missing imports that will cause a runtime failure.
- The model allowlist fix in `model-selection.ts` is well-implemented with defensive type handling and a solid e2e test. The Slack `inheritParent` default change is consistent across docs, schema help, provider code, and system prompt. However, the new Slack test ("disables thread inheritance when inheritParent is false") uses `waitForSlackEvent`, `getSlackHandlers`, and `flush` without importing them, which will cause a `ReferenceError` at test runtime. This is a clear syntax/import issue that needs to be fixed before merge.
- `src/slack/monitor.tool-result.threads-top-level-replies-replytomode-is-all.test.ts` — missing imports for `waitForSlackEvent`, `getSlackHandlers`, and `flush` in the new test case.
<sub>Last reviewed commit: d60e560</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#11349: fix(agents): do not filter fallback models by models allowlist
by liuxiaopai-ai · 2026-02-07
86.5%
#22064: fix(failover): bypass models allowlist for configured fallback models
by winston-bepresent · 2026-02-20
85.1%
#9583: fix(models): allow models in agents.defaults.models even if not in ...
by hotzen100 · 2026-02-05
84.6%
#23816: fix(agents): model fallback skipped during session overrides and pr...
by ramezgaberiel · 2026-02-22
83.4%
#21963: fix(cli): models fallbacks add now includes primary model in allowlist
by ashiabbott · 2026-02-20
83.3%
#6673: fix: preserve allowAny flag in createModelSelectionState for custom...
by tenor0 · 2026-02-01
82.8%
#13626: fix(model): propagate provider model properties in fallback resolution
by mcaxtr · 2026-02-10
82.5%
#13658: fix: silent model failover with fallback notification
by taw0002 · 2026-02-10
81.9%
#20712: fix(subagents): prioritize agent runtime default model over global ...
by sourcesavant · 2026-02-19
81.7%
#16766: fix(model): apply provider baseUrl/headers override to registry-fou...
by dzianisv · 2026-02-15
81.7%