Skip to content

fix(browse): clean stale SingletonLock in handoff() before relaunch#2311

Open
jasonm-max wants to merge 1 commit into
garrytan:mainfrom
jasonm-max:fix/browse-handoff-singleton-lock
Open

fix(browse): clean stale SingletonLock in handoff() before relaunch#2311
jasonm-max wants to merge 1 commit into
garrytan:mainfrom
jasonm-max:fix/browse-handoff-singleton-lock

Conversation

@jasonm-max

Copy link
Copy Markdown

Summary

  • handoff() hand-rolled its own chromium-profile path and skipped the stale-lock cleanup that launchHeaded() already does via resolveChromiumProfile() + cleanSingletonLocks().
  • A prior hard-killed/crashed headed session leaves SingletonLock/SingletonSocket/SingletonCookie pointing at a dead PID. Chromium's ProcessSingleton then silently hands startup off to the dead/zombie process instead of launching cleanly, and the new process exits within seconds — Playwright reads that as a clean disconnect and takes the whole daemon down with it.
  • Fix: handoff() now calls resolveChromiumProfile() + cleanSingletonLocks(), matching the existing pattern in launchHeaded().

Test plan

  • Reproduced the crash-loop against a profile with a stale lock from a hard-killed prior session
  • Confirmed handoff → login → subsequent commands survive without the daemon dying, after the fix
  • bun build --compile browse/src/cli.ts --outfile browse/dist/browse compiles clean

🤖 Generated with Claude Code

handoff() hand-rolled its own chromium-profile path and skipped the
stale-lock cleanup that launchHeaded() already does. A prior
hard-killed/crashed headed session leaves SingletonLock/Socket/Cookie
pointing at a dead PID; Chromium's ProcessSingleton then silently hands
startup off to the dead process instead of launching cleanly, and the
new process exits within seconds — read as a clean disconnect, taking
the whole daemon down with it. Now uses resolveChromiumProfile() +
cleanSingletonLocks(), matching launchHeaded().

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@trunk-io

trunk-io Bot commented Jul 20, 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.

1 participant