Skip to content

Custom executable path silently disables --session-name state restore (save works, restore doesn't) #1441

@navidemad

Description

@navidemad

Summary

When a custom browser binary is set via AGENT_BROWSER_EXECUTABLE_PATH (or --executable-path), --session-name state persistence half-works: the state file is written correctly on close, but it is never restored on the next launch. The same commands with the default auto-managed engine restore fine.

Because the save path keeps working, the failure is silent and destructive: the next close overwrites the previously saved (good) state file with the empty context.

Environment

  • agent-browser 0.27.2 (Homebrew, macos aarch64)
  • macOS (Darwin 25.5.0), Apple Silicon
  • Engines tested: Chrome for Testing 149.0.7827.115 (default, works), Google Chrome 149.0.7827.103 (fails), Brave 149.1.91.171 (fails)

Repro

Pass case, default engine:

agent-browser --session s1 --session-name t1 open https://example.com
agent-browser --session s1 --session-name t1 eval "localStorage.setItem('k','v'); document.cookie='c=v; max-age=86400'; 1"
agent-browser --session s1 --session-name t1 close
sleep 2
agent-browser --session s2 --session-name t1 open https://example.com
agent-browser --session s2 --session-name t1 eval "localStorage.getItem('k') + ' / ' + document.cookie"
# => "v / c=v"

Fail case, identical commands with a custom executable (fresh name, daemons killed first):

export AGENT_BROWSER_EXECUTABLE_PATH="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
agent-browser --session s3 --session-name t2 open https://example.com
agent-browser --session s3 --session-name t2 eval "localStorage.setItem('k','v'); document.cookie='c=v; max-age=86400'; 1"
agent-browser --session s3 --session-name t2 close
sleep 2
agent-browser --session s4 --session-name t2 open https://example.com
agent-browser --session s4 --session-name t2 eval "localStorage.getItem('k') + ' / ' + document.cookie"
# => "null / "

What I checked

  • The save side is fine in the fail case: after the first close, ~/.agent-browser/sessions/t2-s3.json contains 1 cookie and 1 origin (localStorage). Only the restore is skipped.
  • Same result with the Brave binary, and with --executable-path instead of the env var.
  • Same result whether the second run reuses the same --session or a fresh one.
  • Removing the custom executable (falling back to the auto-managed Chrome for Testing) makes the exact same commands pass.

Possibly related to #1335, which is about the env-var form of --session-name not restoring; this one reproduces with the CLI flag itself, and the trigger is the custom executable path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions