agent: warn when session model override is silently dropped by allowlist#37502
Closed
echoVic wants to merge 1 commit intoopenclaw:mainfrom
Closed
agent: warn when session model override is silently dropped by allowlist#37502echoVic wants to merge 1 commit intoopenclaw:mainfrom
echoVic wants to merge 1 commit intoopenclaw:mainfrom
Conversation
When sessions_spawn sets a google/gemini-* model override, modelApplied=true is returned (the patch to the session store succeeds). But at agent run time, if the model is not in the configured models.allowed set and models.allowAny is false, the override is silently dropped and the agent runs on the default Anthropic model instead. Add log.warn() calls at both drop points in agentCommand so that the reason is visible in gateway logs: once when the stored override is cleared from the session entry, and once when the stored override is read but ignored at provider/model assignment time. Fixes openclaw#36134
Contributor
Greptile SummaryThis PR adds
Confidence Score: 5/5
Last reviewed commit: 5cd5e43 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
sessions_spawntargetinggoogle/gemini-*models returnsmodelApplied: truebut the sub-agent actually runs on the default Anthropic model. The model override is silently ignored with no log output, making this impossible to diagnose.Root cause: In
agentCommand(commands/agent.ts), there are two separate places where a stored session model override can be discarded if the model is not inallowedModelKeysandallowAnyModel=false:ifcondition fails, soprovider/modelstay as default — no log.Both drops are silent, so callers see
modelApplied: truefrom thesessions.patchcall (which only validates against the model catalog, not the runtime allowlist) but the agent runs on the wrong model.Fix: Add
log.warn()at both drop points with a message that identifies the model and points to the config keys needed to allow it (models.allowed/models.allowAny).Fixes #36134