Skip to content

feat(browser): ask before closing an idle session browser - #995

Merged
omartelo merged 1 commit into
mainfrom
feat/browser-idle-ask
Oct 30, 2026
Merged

omartelo merged 1 commit into
mainfrom
feat/browser-idle-ask

Conversation

@omartelo

Copy link
Copy Markdown
Collaborator

Summary

The reaper closed a session's headless browser after five minutes with no pane showing it and no use. Working in another session or project for five minutes was enough to lose the page, its tabs and its login, without the person ever choosing that.

Now the reaper never closes a browser on its own:

  • After the idle window it sets idle on the browser's state (browser-state, and browser.Running for a window catching up), once.
  • The window raises a toast in the bottom-right toaster: "Close Claude 3's unused browser?", with the page and the project under it.
  • Close calls browser.Close. Keep open, or swiping the toast away, calls the new browser.Keep: the browser stays and is asked about again after another idle window.
  • Unanswered, the toast stays up and the browser stays open; nothing is asked again (a person away at lunch for an hour comes back to the page they left).
  • Any use of the browser, by the person or the agent, withdraws the question and takes the toast down.
  • ui.Toast gains OnDismiss, sonner's: it runs on a swipe out, not on its buttons, its timer or Dismiss.

Headed windows are still never asked about, and closing the card still closes the browser.

Contract

  • api.BrowserState.Idle and browser.Keep(SessionIDOptions) None; contract.golden updated.
  • TestIdleReaperClosesUnused and TestReaperLeavesAWatchedBrowserUntilDetach change because the contract changed: they asserted the browser closed on its own. docs/ceilings.md and docs/browser-tab.md move with it.

Test plan

  • Backend: reaper asks once and never closes, Keep withdraws and re-arms, agent use withdraws, Keep without a browser fails, Running carries the question.
  • Native: the question goes up and down only on change and with the browser, the toast's swipe and Keep open keep and Close closes, toaster swipe runs OnDismiss and buttons and Dismiss do not.
  • -shot with -toasts idle in dark and light.
  • Local gate: backend and native/ gofmt, vet and tests.

The reaper closed a headless browser no pane showed after five minutes
unused, so working in another session for five minutes lost the page,
its tabs and its login. It now marks the browser idle in its state and
the window asks with a toast: Close closes it, Keep open (or a swipe)
keeps it for another idle window, and unanswered it stays open and is
not asked about again. Any use withdraws the question, and a window
that reopens reads it from browser.Running.

Three reaper tests change because the contract changed: they asserted
the browser closed on its own.
@omartelo
omartelo merged commit b0a3576 into main Oct 30, 2026
7 checks passed
@omartelo
omartelo deleted the feat/browser-idle-ask branch October 30, 2026 15:08
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