[BUG] Browser Agent ignores settings.json overrides (e.g., maxTurns)
What happened?
The Browser Agent completely ignores any configuration overrides provided in the global or project-level settings.json. While the AgentRegistry correctly reads and merges these settings during initialization, the BrowserAgentInvocation and 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, setting maxTurns: 0 in settings.json should 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 AgentRegistry where 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.ts
The Browser Agent is explicitly branched out of the standard flow that uses LocalSubagentInvocation:
if (definition.name === BROWSER_AGENT_NAME) {
return new BrowserAgentInvocation(this.config, ...);
}
-
packages/core/src/agents/browser/browserAgentInvocation.ts
The execute method calls createBrowserAgentDefinition, passing the config object but omitting the merged definition from the registry.
-
packages/core/src/agents/browser/browserAgentFactory.ts
The factory re-runs the BrowserAgentDefinition constructor, which returns hardcoded defaults (e.g., maxTurns: 50):
const baseDefinition = BrowserAgentDefinition(config, !visionDisabledReason);
Suggested Fix
Update browserAgentFactory.ts to attempt to retrieve the existing definition from the AgentRegistry before falling back to creating a fresh one.
[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.