Repository navigation
Fix host-connected broadcast racing observable host status - #539
Merged
Merged
Conversation
…erver) Renderer logs ws lifecycle, watermark invalidation, and host/provider query cache events, shipped to POST /api/v1/diag/renderer; server logs client WS registration/subscribes, host/system broadcasts with matched-socket counts, and GET /hosts responses. Everything lands ordered in server.N.log. Not for merge. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The host-connected event fired at daemon session open (HTTP), but GET /hosts reads "connected" only once the daemon's WebSocket registers in the hub ~60ms later. A client that refetched on the broadcast (exactly what the #538 watermark fix does) captured "disconnected" as fresh post-watermark data, and nothing ever invalidated it again — the stale "Host is offline" composer on desktop cold start. Emit the broadcast from NotificationHub.registerDaemon instead, where the state it advertises is actually observable. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…erer + server)" This reverts commit 92cee65.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Samuka007
added a commit
to Samuka007/bb
that referenced
this pull request
Oct 8, 2026
…ey 行(ApiKeyCredentialRow 同款 write-only 模式,brave 行泛化共享)+ engines.exa presence wire 形状
Samuka007
added a commit
to Samuka007/bb
that referenced
this pull request
Oct 8, 2026
…ilableEngines 词表后的链序断言 + 双 keyed 行 findAllBy 占位符
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
After #538, desktop cold starts still showed a stale "Host is offline" composer. An instrumented build proved why: the client-side watermark fix worked exactly as designed, but lost a server-side race.
The server broadcast
host-connectedwhen the daemon session opened (the HTTP call increateSession), butGET /hostsreports "connected" only once the daemon's WebSocket registers in the hub (getDaemonSessionIdForHost) — ~60–100ms later. Timeline from a real cold start:host-connected/hosts/hostswith "disconnected" (daemon WS not attached yet)The renderer caches "disconnected" as fresh post-watermark data and nothing ever invalidates it again. No client-side mitigation can win this: the event races the observable state it advertises.
Fix
Emit
host-connectedfromNotificationHub.registerDaemon— the moment the advertised state is actually observable — and drop the session-open broadcast. A daemon session without an attached socket reads "disconnected" everywhere, so staying silent there is correct;hostEventWaitersand re-registration after transient WS drops resolve at the same, now-consistent point.Tests
registerDaemonbroadcastshost-connectedtohost-listsubscribers.turbo run typecheck test --filter=@bb/app --filter=@bb/server --filter=@bb/db --force— 320 db + 955 server + 1299 app tests pass.turbo run test --filter=@bb/integration-tests --force— 54 pass (incl. daemon crash/restart flows)./hostsreturning "connected" 1ms later, and the composer comes up healthy on cold start.Notes
The two DIAGNOSTIC commits in this branch add and then fully revert the instrumentation used to capture the timeline; they are net-zero in the squash.
🤖 Generated with Claude Code