Skip to content

fix(browse): preserve live daemon during busy loads#2231

Open
time-attack wants to merge 1 commit into
garrytan:mainfrom
time-attack:time-attack/2219
Open

fix(browse): preserve live daemon during busy loads#2231
time-attack wants to merge 1 commit into
garrytan:mainfrom
time-attack:time-attack/2219

Conversation

@time-attack

Copy link
Copy Markdown

During a heavy page load, browse could mistake a busy browser daemon for a dead one and restart it. That discarded open tabs, cookies, and logged-in sessions.

Browse now preserves an unresponsive daemon while its process is still alive and asks the user to retry. Automatic restart happens only after the daemon process is actually gone.

Technical details

  • Treat an OS-live daemon as busy when its HTTP health endpoint temporarily times out.
  • Apply the safeguard during initial daemon discovery and command connection failures.
  • Preserve existing recovery behavior for processes that are actually dead.
  • Add regression coverage for live, dead, and missing daemon states.

Evidence

The same live CLI probe ran in five isolated baseline/candidate repo pairs:

  • gstack-auto: baseline failed; candidate passed
  • zotero-arxiv-daily: baseline failed; candidate passed
  • lacp: baseline failed; candidate passed
  • stagehand: baseline failed; candidate passed
  • plane: baseline failed; candidate passed

Every baseline killed the daemon and replaced its session state. Every candidate preserved the original PID and session token.

Secondary checks

  • 12 targeted tests passed
  • bun run build passed
  • Version and release files were not changed

Fixes #2219

@trunk-io

trunk-io Bot commented Jul 10, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

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.

browse: CLI kills a live-but-busy daemon during heavy page loads — ~7s health-probe window too short (follow-up to #1781); all session state lost

1 participant