Problem Statement
Scenarios currently execute sequentially in a single browser context. A 10-scenario suite takes 10x the time of a single scenario. This is fine for demos but unusable for real test suites of 30+ scenarios.
Proposed Solution
Replace sequential execution with a Browser Pool that runs N scenarios concurrently using isolated browser contexts.
Architecture
Browser Pool (max N concurrent, default 4) ├─ Context A → Scenario 1 ├─ Context B → Scenario 2 ├─ Context C → Scenario 3 └─ Context D → Scenario 4 ↓ When one finishes, pull next scenario from queue
Implementation Notes
browser.js already uses a sessions Map with getBrowserForSession(). Extend this into a BrowserPool class.
- Use
browser.newContext() per scenario (cheap) — NOT a new browser per scenario (expensive).
- Use
Promise.allSettled with concurrency control (e.g. p-limit or manual semaphore).
- Critical: Each context needs its own
selectorDict copy. The learned_selectors SQLite cache is already keyed by page_url + original_selector and uses WAL mode, so concurrent writes are safe.
- Add
pool.maxConcurrency to settings.json (timeouts section or new execution section).
Which Agent / Component Does This Affect?
Problem Statement
Scenarios currently execute sequentially in a single browser context. A 10-scenario suite takes 10x the time of a single scenario. This is fine for demos but unusable for real test suites of 30+ scenarios.
Proposed Solution
Replace sequential execution with a Browser Pool that runs N scenarios concurrently using isolated browser contexts.
Architecture
Browser Pool (max N concurrent, default 4) ├─ Context A → Scenario 1 ├─ Context B → Scenario 2 ├─ Context C → Scenario 3 └─ Context D → Scenario 4 ↓ When one finishes, pull next scenario from queue
Implementation Notes
browser.jsalready uses asessionsMap withgetBrowserForSession(). Extend this into aBrowserPoolclass.browser.newContext()per scenario (cheap) — NOT a new browser per scenario (expensive).Promise.allSettledwith concurrency control (e.g.p-limitor manual semaphore).selectorDictcopy. Thelearned_selectorsSQLite cache is already keyed bypage_url + original_selectorand uses WAL mode, so concurrent writes are safe.pool.maxConcurrencytosettings.json(timeoutssection or newexecutionsection).Which Agent / Component Does This Affect?
server/browser.js— BrowserPool class