Skip to content

Set the desktop app name before awaiting host toolchain discovery - #6389

Merged
ymichael merged 1 commit into
mainfrom
bb/fix-server-connection-persistence-thr_hd2udn5vff
Oct 27, 2026
Merged

ymichael merged 1 commit into
mainfrom
bb/fix-server-connection-persistence-thr_hd2udn5vff

Conversation

@ymichael

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

#6194 changed the start of runDesktopApp (apps/desktop/src/main.ts) from a synchronous PATH fixup to await hostToolchain.refresh(), and that await ran before app.setName(DESKTOP_RELEASE_INFO.applicationName). The refresh spawns a login shell, so Electron reached ready while it ran. Electron then locked the profile directory to the default name from the packaged package.json, @bb/desktop. Updated nightlies started with an empty profile at ~/Library/Application Support/@bb/desktop/ instead of bb Nightly/. That profile has no saved server (server-target.json), no Connect credential (log shows connect server sync skipped (no-credential)) and no window state, so the app fell back to This Mac with no other servers listed. The real profile is untouched: bb Nightly/server-target.json still holds the user's saved target. Stable 0.47.1 predates #6194 and is not affected.

What changed

  • apps/desktop/src/main.ts: runDesktopApp now sets the app name, installs the About panel, takes the single-instance lock and registers app/process handlers before any await. The packaged host toolchain refresh moved to just before await app.whenReady(), so the profile name is fixed however long discovery takes. Child processes still receive the discovered environment before anything is spawned.

When this build is installed, existing users go back to their original bb Nightly / bb profile, so nothing needs migrating. Anything chosen in the interim @bb/desktop profile stays behind.

There are no wire, CLI, or doc changes.

How you verified

  • Confirmed on an affected machine: after the update to 0.47.2-nightly.40533619938.1, a new ~/Library/Application Support/@bb/desktop/ profile appeared, holding the SingletonLock and no server-target.json. The old bb Nightly/ profile still has target: "custom", last written Oct 21.
  • pnpm exec turbo run typecheck lint test --filter=@bb/desktop: passes (599 tests passed, 1 skipped).
  • There is no automated regression test. The packaged smoke test always passes --user-data-dir, so it cannot catch the default profile path. A packaged nightly with this change has not been launched yet.

AGENT GENERATED

🤖 Generated with Claude Code

runDesktopApp awaited hostToolchain.refresh() before app.setName(), so
Electron reached ready with its default name and locked the profile to
~/Library/Application Support/@bb/desktop. Updated nightlies lost the
saved server, Connect credential and window state and fell back to
This Mac. Name the app, take the single-instance lock and register
handlers first, then await discovery just before whenReady().

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ymichael
ymichael merged commit 7125b90 into main Oct 27, 2026
26 checks passed
@ymichael
ymichael deleted the bb/fix-server-connection-persistence-thr_hd2udn5vff branch October 27, 2026 19:00
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