Skip to content

Commit 8f71c77

Browse files
committed
fix: limit parallel browser instances and reject concurrent persistent sessions
- Persistent/existing mode: throw error when instance is already in-use, instructing the model to run browser tasks sequentially. This prevents Chrome profile lock conflicts from concurrent --userDataDir usage. - Isolated mode: allow parallel instances up to MAX_PARALLEL_INSTANCES (5). Throw when the limit is exceeded to prevent resource exhaustion. - Update integration test to use isolated mode for concurrent browser agents. - Add 3 new unit tests for persistent/existing rejection and max limit.
1 parent 40c5709 commit 8f71c77

4 files changed

Lines changed: 298 additions & 191 deletions

File tree

integration-tests/browser-agent.test.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ describe.skipIf(!chromeAvailable)('browser-agent', () => {
308308
await run.expectText('successfully written', 15000);
309309
});
310310

311-
it('should handle concurrent browser agents with persistent session mode', async () => {
311+
it('should handle concurrent browser agents with isolated session mode', async () => {
312312
rig.setup('browser-concurrent', {
313313
fakeResponsesPath: join(__dirname, 'browser-agent.concurrent.responses'),
314314
settings: {
@@ -320,9 +320,10 @@ describe.skipIf(!chromeAvailable)('browser-agent', () => {
320320
},
321321
browser: {
322322
headless: true,
323-
// Persistent mode is the default — the regression scenario.
324-
// Two concurrent calls should each get a separate browser.
325-
sessionMode: 'persistent',
323+
// Isolated mode supports concurrent browser agents.
324+
// Persistent/existing modes reject concurrent calls to prevent
325+
// Chrome profile lock conflicts.
326+
sessionMode: 'isolated',
326327
},
327328
},
328329
},

0 commit comments

Comments
 (0)