-
Notifications
You must be signed in to change notification settings - Fork 13k
[Bug] BeforeModel hook ignores llm_request.model override #21847
Copy link
Copy link
Labels
area/agentIssues related to Core Agent, Tools, Memory, Sub-Agents, Hooks, Agent QualityIssues related to Core Agent, Tools, Memory, Sub-Agents, Hooks, Agent Qualityhelp wantedWe will accept PRs from all issues marked as "help wanted". Thanks for your support!We will accept PRs from all issues marked as "help wanted". Thanks for your support!priority/p1Important and should be addressed in the near term.Important and should be addressed in the near term.
Metadata
Metadata
Assignees
Labels
area/agentIssues related to Core Agent, Tools, Memory, Sub-Agents, Hooks, Agent QualityIssues related to Core Agent, Tools, Memory, Sub-Agents, Hooks, Agent Qualityhelp wantedWe will accept PRs from all issues marked as "help wanted". Thanks for your support!We will accept PRs from all issues marked as "help wanted". Thanks for your support!priority/p1Important and should be addressed in the near term.Important and should be addressed in the near term.
Type
Fields
Give feedbackNo fields configured for issues without a type.
What happened?
When attempting to override the model
llm_request.modelwithin theBeforeModelhook, no override happens.Minimal example to reproduce the error:
Setup BeforeModel Hook
Add
BeforeModelhook to .gemini/settings.jsonSetup BeforeModel Hook Logic
Create file
/path/to/.gemini/hooks/test_model_override.jsand add content:Execute test
gemini-cli/model set gemini-2.5-flash-lite/stats sessiongemini-2.5-flashhas 0 request albeit constant override.What did you expect to happen?
The request should have been executed by
gemini-2.5-flashinstead ofgemini-2.5-flash-lite, i.e. the model override inllm_request.modelshould have been respected.Client information
Client Information
Run
geminito enter the interactive CLI, then run the/aboutcommand.Login information
Google Account
Anything else we need to know?
No response