{
  "slug": "agent-browser-restores-validated-browser-state-by-stable-session-f9ff9e1bdb47",
  "title": "agent-browser restores validated browser state by stable session",
  "tools": [
    "agent-browser"
  ],
  "tags": [
    "agent"
  ],
  "introduced_at": "2026-06-25T19:40:17.000Z",
  "announced_at": "2026-06-25T19:40:17.000Z",
  "effective_at": null,
  "date_basis": "source-publication",
  "status": "unknown",
  "how": {
    "incantation": "For workflows that reuse an authenticated browser session across restarts, generate a stable worktree-scoped session ID and run commands with `--session <id> --restore`. Add a restore check to validate state before saving; `auto` skips autosave after failed restore or validation.",
    "examples": [
      "SESSION=\"$(agent-browser session id --scope worktree --prefix <prefix>)\"\nagent-browser --session \"$SESSION\" --restore --restore-check-text <text> open <url>"
    ],
    "gotchas": [
      "Version: v0.31.0",
      "--scope <scope> (required): For session ID generation, use `worktree` to scope to the Git worktree root when available, then Git root, then canonical current directory.",
      "--prefix <prefix> (required): Prefix for the generated stable session ID.",
      "--session <id> (required): Selects the session; with bare `--restore`, this is the persistence key.",
      "--restore (required): Automatically loads and saves session state; bare option uses the current session as the persistence key.",
      "--restore-check-text <text>: Validate that restored page text contains the specified text.",
      "--restore-check-url <glob>: Validate restored state against a URL pattern.",
      "--restore-check-fn <js>: Validate restored state against a truthy JavaScript expression.",
      "--restore-save <policy>: Autosave policy: `auto` (default; skips autosave after failed restore or validation), `always`, or `never`.",
      "--namespace <namespace>: Namespace for daemon sockets and restore-state directories.",
      "agent-browser session info --json: Displays daemon, launch, and restore status.",
      "Prerequisite: Install `agent-browser` and run `agent-browser install` to download Chrome, unless a supported existing Chrome, Brave, Playwright, or Puppeteer installation is detected.",
      "Restore validation can check a URL pattern, page text, or a truthy JavaScript expression.",
      "`--restore-save` policies are `auto`, `always`, or `never`.",
      "Auto-save avoids overwriting good state after failed restore or failed validation."
    ]
  },
  "why_it_matters": "When maintaining a repository workflow that reuses an authenticated browser session across restarts, persist and validate that session's state.",
  "sources": [
    "https://github.com/vercel-labs/agent-browser/releases/tag/v0.31.0",
    "https://github.com/vercel-labs/agent-browser/pull/1486",
    "https://github.com/vercel-labs/agent-browser/blob/v0.31.0/README.md"
  ],
  "rank": 0.97047,
  "judge": {
    "publish": true,
    "judge_model": "codex-cli/gpt-6-luna+typesafe/jev-1.13.0",
    "prompt_version": "extract-v7+enrich-v2+judge-v2x3+jev-publish-v1"
  },
  "review_state": "approved",
  "provenance": {
    "run_id": "wave2a-20261017",
    "verdict_id": "wave2a-20261017:wave2a-20261017-2880bd2fdb5bead0-0:gate",
    "evidence_hash": "dc808202c6b021d184c3882af9bdf9e47b37d5703a31a0481327d3f058811f1e"
  },
  "review": {
    "draft_hash": "83c272a2d2c7da70b7a7d5af70dffd389db21ab3438802aaaabe47dd9b67c6d4",
    "reviewer": "publication-gate",
    "reviewed_at": "2026-10-07T00:00:00.000Z",
    "decision": "wave2a-20261017:gate",
    "reason": "3 of 3 judge runs approved with p_yes >= 0.9 (mean 0.97 >= 0.9; 2 needed) and Jev gave 0.81 (>= 0.6 needed)."
  }
}
