A command whose idle timeout differs from the running session's daemon silently restarts the daemon and its browser, and every open page is lost:
$ agent-browser --session s --idle-timeout 10m open https://example.com
$ agent-browser --session s get title
[agent-browser] launched browser
$ # empty title: the session restarted on about:blankIt happens in both directions: launch without --idle-timeout and later send a command with it (or with AGENT_BROWSER_IDLE_TIMEOUT_MS set), or the reverse. With the same value on every command the session persists.
Reproduce
agent-browser --session s --idle-timeout 10m open https://example.com
agent-browser --session s get title # relaunches; empty title
agent-browser --session t open https://example.com
AGENT_BROWSER_IDLE_TIMEOUT_MS=600000 agent-browser --session t get title # relaunches tooSeen on agent-browser 0.39.1; the code is unchanged on main (dac13bb).
Cause
daemon_config_fingerprint in cli/src/connection.rs (~L592) hashes idle_timeout together with debug, action_policy, confirm_actions, default_timeout and no_auto_dialog. When a command's fingerprint differs from the one recorded for the session, daemon_config_status returns Different, the running daemon is not reused, and a new daemon and browser are launched. The only sign is the launched browser line on stderr.
Why this seems wrong for the idle timeout
The idle timeout is a lifetime setting for the daemon, not a property of the browser or its pages. A caller that changes it, or that simply omits it while another caller set it, should not discard the session's tabs. That makes it easy to lose state when several tools or scripts drive the same session and only some of them pass the flag.
Suggested behavior
- Leave
idle_timeoutout of the fingerprint. A command that carries a different value could update the running daemon's timer instead, or be ignored with a notice. - At minimum, warn clearly (and say which setting differed) when a configuration mismatch restarts a session that has open pages.
Some of the other fingerprinted settings (for example action_policy) may justify a restart. This issue is only about the idle timeout and the missing warning.
Workaround
Set the idle timeout once in the environment (AGENT_BROWSER_IDLE_TIMEOUT_MS) so every caller passes the same value.
Environment
- agent-browser 0.39.1 (native CLI)
Activity
0No activity yet.