Skip to main content

Module browser_session_close

Module browser_session_close 

Source
Expand description

When a background browser session closes by itself (docs/specs/SPEC_BACKGROUND_BROWSER_SESSIONS_2026_11_28.md ยง4 item 9): its agent was stopped, the agent has done nothing for an hour, or the app restarted. A session has no window the person sees, so one nobody closes would hold a page, its memory and its sign-in for as long as the app runs. A pane the person Showed is a pane, not a session, and none of this touches it.

Constantsยง

IDLE_LIMIT_MS ๐Ÿ”’
How long the agent can do nothing before its sessions close: its transcript has not been written for this long.
RESTART_CLOSE_DELAY ๐Ÿ”’
How long after srv starts the sessions the last run left are closed: the workspace is loaded by then.

Staticsยง

STOPPED ๐Ÿ”’
The agent panes whose agent was stopped, whose sessions the next sweep closes.

Functionsยง

close_due ๐Ÿ”’
The sessions that are due to close: those of an agent that was stopped, and of one that has done nothing for an hour. Called every minute and when an agent is stopped.
close_for_stop ๐Ÿ”’
The agent in the pane agent_block was stopped: its sessions close with it, at once (the sweep is woken). A Stop docks only the floating panes the person sees, so nothing else would end them. Not closed here: the teardown that calls this is itself part of closing a pane, and a close from inside it would be a cycle.
close_left_by_the_last_run ๐Ÿ”’
The sessions the last run left close: a session is not restored.
close_one ๐Ÿ”’
Close the session s for why, now: the person is not asked to keep it (a tab the agent closes itself has that window; a session has no window to ask in, and one that was kept would be asked about again every minute). The Audit row is written once the pane is closed, with the site read before it goes.
close_stopped ๐Ÿ”’
The sessions of the agents stopped since the last sweep close.
held_by ๐Ÿ”’
The sessions held by the agent pane agent_block.
idle_for_the_limit ๐Ÿ”’
Whether an agent last active at last_ms has been idle for the limit at now_ms.