fix(api): follow the live view to the 2FA page during connect sign-in

Merged
TO
3mo ago
+89-1

Makes the connect flow's 2FA take-over actually usable. Two related fixes:

1. The live view didn't follow to the 2FA page

After the AI signs in and the vendor shows a 2FA prompt, the panel says "Your turn — enter the code", but the iframe stayed on the pre-submit login tab (empty fields). streamActiveLiveView was called before the sign-in but never again after it, so the iframe never followed to where the 2FA field is. Fix: re-emit the live view right after signInAndClassify, at the same tab the classifier judged.

2. The session died after ~2 min ("Debugging connection was closed")

The connect session was created without a timeout, so it used the project's short default and Browserbase auto-ended it (~2 min) — killing the live view while the user was still fetching their authenticator / typing the code. Fix: give human-facing sessions an explicit 15-minute timeout; headless capture runs keep the short default (no human waiting).

Verification

  • +tests: live view re-emitted on the needs_2fa path; session timeout forwarded only for interactive sessions.
  • 179 browserbase tests pass, typecheck clean.

Note

Backend fixes (emit the right live-view URL + keep the session alive). Worth a quick confirm on stage that the iframe visibly follows to the 2FA page and stays connected through a slow take-over — Browserbase can't be reproduced locally.