fix(mac): false "not connected" error on every cold launch - #460
Merged
Conversation
…ected" banner MultiDeviceModel.start() kicked off a settings/keybindings sync in a parallel task the instant it started the local backend. That load reached LiveBackend.settings() before the sidecar had even spawned, threw notConnected, and report() turned the guaranteed-to-lose race into a visible error banner on every cold launch — while the toolbar pill correctly said "Launching Server…". Nothing cleared the banner once the connection came up. Drop the eager sync: the global-settings coordinator already reruns the sync from every model's onConnectionReady, which is the first moment it can succeed. Treat a notConnected settings load as the retryable transient it is instead of reporting it, so mid-reconnect loads stay quiet too. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Every app launch showed a "not connected" error banner while the app was still booting normally.
MultiDeviceModel.start()(added in the settings-mesh work,2c069ae09) firedsyncGlobalSettings()in a parallel task at the same instant it started the local backend. The settings RPC reachedLiveBackend.settings()before the sidecar process had spawned, threwLiveBackendError.notConnected, andAppModel.report(_:)rendered it as an error banner on the empty-state view / composer. The race loses every time — a Node sidecar boot takes seconds, the failing guard takes microseconds — and nothing clearedlastErrorwhen the connection subsequently reached.ready.Fix
MultiDeviceModel.start()no longer loads settings eagerly. The first sync ridesonConnectionReady(installed byinstallGlobalSettingsCoordinatoron every model), which is the earliest moment it can succeed. Same for keybindings.AppModel.loadSettings()treats anotConnectedfailure as the retryable transient it is (the coordinator reloads on ready) instead of reporting it — covers loads racing a reconnect as well.Error.isNotConnectedhelper covers both shapes (LiveBackendError.notConnected,T3Error.notConnected).Tests
pnpm run verifypass.🤖 Generated with Claude Code