Fix local browser startup ECONNREFUSED in CI

Merged
MO
7mo ago
+175-10

Why

Local Chromium startup in CI intermittently fails with ECONNREFUSED before tests ever reach their real assertions. The failures reproduce on a clean branch off main, so this PR is focused only on hardening local browser/session startup.

What changed

  • retries the full local V3.init() launch-and-connect path for transient startup failures instead of failing immediately on the first refused connection
  • adds failure-only launch diagnostics so if the flake returns we capture Chrome stdout/stderr plus devtools endpoint state
  • limits the retry logic to local browser startup so Browserbase-backed sessions are unaffected

Summary by cubic

Hardens CI by retrying and verifying local Chromium startup to reduce ECONNREFUSED flakes. Enables strict structured outputs across supported AI SDK providers.

  • Bug Fixes

    • Retries local browser init once in CI on ECONNREFUSED/ECONNRESET and CDP-connect errors; waits and cleans up between attempts.
    • Installs stable Chrome via browser-actions/setup-chrome and runs a preflight launch check before server-v3 integration and local E2E tests, passing CHROME_PATH to the verifier.
  • New Features

    • Enables strict structured outputs: sets strict: true in OpenAIClient json_schema and adds provider options for openai, azure, google, vertex, anthropic, groq, cerebras, and mistral.
    • Adds unit tests for AI SDK provider options; publishes a patch to @browserbasehq/stagehand.