Skip to content

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

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

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

Conversation

@time-attack

Copy link
Copy Markdown
Contributor

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

@time-attack

time-attack commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor Author

@time-attack Please rewrite daemon recovery so busy sessions remain protected while a live but permanently wedged daemon can still be replaced safely.

@capy-ai

capy-ai Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Thank you for this fix! The bug it addresses (#2219) has since been fixed on main and the issue is closed, so I'm closing this PR as done. Re-verified against current main (v1.91.12.0). If you think part of your change is still missing, reply and we'll reopen. Really appreciate the contribution.

@capy-ai capy-ai Bot closed this Oct 1, 2026
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