Skip to content

[Feature] ⚡ Parallel Scenario Execution with Browser Pool #2

Description

@khaledbourghida

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?

  • Browser Executor
  • Code Analyst
  • Route Navigator
  • Selector Expert
  • Scenario Writer
  • Script Writer
  • Verifier / Step Fixer
  • Cache / SQLite layer
  • UI / Client
  • Configuration / Settings
  • Other: server/browser.js — BrowserPool class

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions