google-gemini / google-gemini/gemini-cli
bug: approval-mode routing can select an unavailable model
- Dominant language
- TypeScript
- Stars
- 107k
- Forks
- 14.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 45
Description
### What happened?
`FallbackStrategy` runs before `ApprovalModeStrategy` and checks availability of the resolved requested model.
For an `auto` request this can be Pro. If Pro is available, fallback passes.
`ApprovalModeStrategy` can then replace that decision with Flash when an approved plan exists, but it does not check Flash availability.
This means a session can have:
- Auto resolves to Pro
- Pro is available
- FallbackStrategy returns null
- approved-plan routing selects Flash
- Flash is unavailable
- the router nevertheless returns Flash
The same defensive issue exists for the Pro selection in PLAN mode.
### Expected behavior
Approval-mode routing should only return its preferred Pro or Flash model when that resolved model is currently available. If unavailable, the strategy should return null and allow the remaining routing strategies to choose a usable model.
### Suggested fix
Check `config.getModelAvailabilityService().snapshot(model).available` before returning the approval-mode decision.
Found by source audit on current main.
Contributor guide
Research direction
Start with the FallbackStrategy and ApprovalModeStrategy entry points, then trace how the resolved model and config.getModelAvailabilityService().snapshot(model).available are used. Verify both AUTO/approved-plan Flash routing and PLAN-mode Pro routing, including the unavailable-model cases. Done means unavailable preferred models return null so later strategies can select a usable model.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- ai, cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 74/100