mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-24 20:14:44 -07:00
fix(browser): remove premature browser cleanup after subagent invocation (#24753)
This commit is contained in:
@@ -229,6 +229,51 @@ describe.skipIf(!chromeAvailable)('browser-agent', () => {
|
||||
assertModelHasOutput(result);
|
||||
});
|
||||
|
||||
it('should keep browser open across multiple browser_agent invocations', async () => {
|
||||
rig.setup('browser-persistent-session', {
|
||||
fakeResponsesPath: join(
|
||||
__dirname,
|
||||
'browser-agent.persistent-session.responses',
|
||||
),
|
||||
settings: {
|
||||
agents: {
|
||||
overrides: {
|
||||
browser_agent: {
|
||||
enabled: true,
|
||||
},
|
||||
},
|
||||
browser: {
|
||||
headless: true,
|
||||
sessionMode: 'isolated',
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const result = await rig.run({
|
||||
args: 'Browse to example.com twice: first get the page title, then check for links.',
|
||||
});
|
||||
|
||||
const toolLogs = rig.readToolLogs();
|
||||
const browserCalls = toolLogs.filter(
|
||||
(t) => t.toolRequest.name === 'browser_agent',
|
||||
);
|
||||
|
||||
// Both browser_agent invocations must succeed — if the browser was
|
||||
// incorrectly closed after the first call (regression #24210),
|
||||
// the second call would fail.
|
||||
expect(
|
||||
browserCalls.length,
|
||||
'Expected browser_agent to be called twice',
|
||||
).toBe(2);
|
||||
expect(
|
||||
browserCalls.every((c) => c.toolRequest.success),
|
||||
'Both browser_agent calls should succeed',
|
||||
).toBe(true);
|
||||
|
||||
assertModelHasOutput(result);
|
||||
});
|
||||
|
||||
it('should handle tool confirmation for write_file without crashing', async () => {
|
||||
rig.setup('tool-confirmation', {
|
||||
fakeResponsesPath: join(
|
||||
|
||||
Reference in New Issue
Block a user