-
Notifications
You must be signed in to change notification settings - Fork 13k
[BUG] Browser Agent ignores settings.json overrides (e.g., maxTurns) #22267
Copy link
Copy link
Open
Labels
area/agentIssues related to Core Agent, Tools, Memory, Sub-Agents, Hooks, Agent QualityIssues related to Core Agent, Tools, Memory, Sub-Agents, Hooks, Agent Qualitypriority/p2Important but can be addressed in a future release.Important but can be addressed in a future release.workstream-rollupLabel used to tag epics and features that are associated with one of the three primary workstreamsLabel used to tag epics and features that are associated with one of the three primary workstreams🔒 maintainer only⛔ Do not contribute. Internal roadmap item.⛔ Do not contribute. Internal roadmap item.
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 Qualitypriority/p2Important but can be addressed in a future release.Important but can be addressed in a future release.workstream-rollupLabel used to tag epics and features that are associated with one of the three primary workstreamsLabel used to tag epics and features that are associated with one of the three primary workstreams🔒 maintainer only⛔ Do not contribute. Internal roadmap item.⛔ Do not contribute. Internal roadmap item.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Projects
Status
No status
[BUG] Browser Agent ignores
settings.jsonoverrides (e.g.,maxTurns)What happened?
The Browser Agent completely ignores any configuration overrides provided in the global or project-level
settings.json. While theAgentRegistrycorrectly reads and merges these settings during initialization, theBrowserAgentInvocationand its factory (browserAgentFactory.ts) skips the registry and recreate the agent definition from scratch with hardcoded defaults.What did you expect to happen?
The Browser Agent should respect settings overrides like
maxTurns,maxTimeMinutes, etc., just like other sub-agents (e.g.,codebase_investigator). For example, settingmaxTurns: 0insettings.jsonshould cause the agent to terminate immediately upon invocation.Client information
Client Information
Platform: Linux (Ubuntu 22.04)
Gemini CLI Version: 0.35.0-nightly.20260311.657f19c1f
Login information
Google Account (OAuth)
Anything else we need to know?
Root Cause
The Browser Agent's unique invocation flow skips the
AgentRegistrywhere settings overrides are maintained. Instead of using the pre-merged definition from the registry, it re-instantiates a fresh definition using hardcoded defaults.Relevant Files & Code Snippets:
packages/core/src/agents/subagent-tool-wrapper.tsThe Browser Agent is explicitly branched out of the standard flow that uses
LocalSubagentInvocation:packages/core/src/agents/browser/browserAgentInvocation.tsThe
executemethod callscreateBrowserAgentDefinition, passing theconfigobject but omitting the merged definition from the registry.packages/core/src/agents/browser/browserAgentFactory.tsThe factory re-runs the
BrowserAgentDefinitionconstructor, which returns hardcoded defaults (e.g.,maxTurns: 50):Suggested Fix
Update
browserAgentFactory.tsto attempt to retrieve the existing definition from theAgentRegistrybefore falling back to creating a fresh one.