Skip to content

perf(sign-in): restore a saved sign-in over CDP instead of agent-browser's state load - #11

Merged
dohooo merged 1 commit into
mainfrom
perf/own-state-restore
Oct 15, 2026
Merged

dohooo merged 1 commit into
mainfrom
perf/own-state-restore

Conversation

@dohooo

@dohooo dohooo commented Oct 15, 2026

Copy link
Copy Markdown
Owner

v0.84.2's timings put a walk's sign-in restore at 3.0 to 3.2 s of its 6.5 to 8.4 s setup. agent-browser's
state load (v0.38.1, unchanged through v0.39.1) sets the cookies, then for every origin with storage navigates
the tab to the product's real root, sleeps a fixed 500 ms and writes one key per evaluate; the product then loads a
second time on open.

  • browser-state-restore.mjs restores the whole state itself, the way it already restored IndexedDB and the way
    Playwright restores a storage state: one Network.setCookies (the fields state load sent, no partition key),
    then each origin with localStorage, sessionStorage or IndexedDB is navigated to with the request answered by an
    empty document from Fetch interception, and its storages are written in one evaluate. Nothing reaches the
    product before it opens.
  • Every lane that called state load uses it: the product open shared by Suite walks and Activities, the sign-in
    check and the idle sign-in browser. A state that cannot be read or whose cookies the browser refuses throws as
    state load did; storage that did not go back is named in the existing restore outcome.
  • The Activity lane's restoreStatus (from a state load reply field v0.38.1 never sends) is gone with it.

Checks: typecheck, lint (biome + discipline), pi lane. Local stack: signed-in Verifications on all three eval
products (passed, a fault run failed correctly) and two signed-in walks (completed); those products sign in with
cookies only, so a headless Chromium check covered the storages: cookies, localStorage (including quotes and line
breaks) and sessionStorage were all there when the page opened in the same tab, the product server saw no request
before that open, and the restore took 157 ms.

https://claude.ai/code/session_01QXmSJBFujofueuHrdm6TdA

…ser's state load

v0.84.2's timings put a walk's sign-in restore at 3.0 to 3.2 s of its 6.5 to 8.4 s setup. agent-browser's
`state load` (v0.38.1, unchanged through v0.39.1) sets the cookies, then for every origin with storage navigates
the tab to the product's real root, sleeps a fixed 500 ms and writes one key per evaluate; the product then loads a
second time on open.

- `browser-state-restore.mjs` restores the whole state itself, the way it already restored IndexedDB and the way
  Playwright restores a storage state: one `Network.setCookies` (the fields `state load` sent, no partition key),
  then each origin with localStorage, sessionStorage or IndexedDB is navigated to with the request answered by an
  empty document from Fetch interception, and its storages are written in one evaluate. Nothing reaches the
  product before it opens.
- Every lane that called `state load` uses it: the product open shared by Suite walks and Activities, the sign-in
  check and the idle sign-in browser. A state that cannot be read or whose cookies the browser refuses throws as
  `state load` did; storage that did not go back is named in the existing restore outcome.
- The Activity lane's `restoreStatus` (from a `state load` reply field v0.38.1 never sends) is gone with it.

Checks: typecheck, lint (biome + discipline), pi lane. Local stack: signed-in Verifications on all three eval
products (passed, a fault run failed correctly) and two signed-in walks (completed); those products sign in with
cookies only, so a headless Chromium check covered the storages: cookies, localStorage (including quotes and line
breaks) and sessionStorage were all there when the page opened in the same tab, the product server saw no request
before that open, and the restore took 157 ms.

Claude-Session: https://claude.ai/code/session_01QXmSJBFujofueuHrdm6TdA
@dohooo
dohooo merged commit 084b13e into main Oct 15, 2026
3 checks passed
@dohooo
dohooo deleted the perf/own-state-restore branch October 15, 2026 04:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant