Fix misleading host disconnect stop reason - #2514
Open
brsbl wants to merge 2 commits into
Open
Conversation
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.
Human comments
What was wrong
The server's daemon-disconnect grace callback classified every unrecovered host/session socket loss as
host-daemon-restarted, even when no new daemon instance had connected. That persisted reason flowed unchanged through the thread events API and timeline projection, so transient tunnel/session failures rendered as “Stopped — host daemon restarted.” A confirmed restart already has a separate stable signal:handleHostSessionOpenedobserves a changed daemoninstanceId.What changed
host-connection-lostand use it only when the daemon/session disconnect grace expires without a confirmed replacement instance.host-daemon-restartedfor the existing changed-instanceIdrestart path.0.4.22→0.4.23. No host-daemon wire shape changed,HOST_DAEMON_PROTOCOL_VERSIONis unchanged, and there are no CLI or documentation changes.How you verified
pnpm exec turbo run test --filter=@bb/server -- test/internal/background-task-reconciliation.test.tsfailed 1/11 because the disconnect-grace event washost-daemon-restartedinstead ofhost-connection-lost.pnpm exec turbo run test --filter=@bb/thread-view -- test/parse-operation-message.test.tspasses 9/9.pnpm exec turbo run typecheck --filter=@bb/domain --filter=@bb/thread-view --filter=@bb/server --filter=@bb/apppasses all 7 Turbo tasks.pnpm exec turbo run test --filter=@bb/server --filter=@bb/thread-view --filter=@bb/domainpasses all 9 Turbo tasks, including 2,048/2,048 server tests (213 files pass, 1 corpus file skipped).node packages/plugin-sdk/scripts/check-npm-version-guard.mjspasses because@get-bb/plugin-sdk@0.4.23is unpublished; focused SDK/domain typecheck and tests pass all 8 Turbo tasks (219 SDK and 172 domain tests).pnpm exec oxfmt --checkon all six changed files andgit diff --checkpass.2d4894d97b0930905c9aca027b717c3558b01470, including checks, package/server/app/integration suites, Ubuntu and macOS package smoke tests, and Node 24/26 compatibility on Ubuntu and macOS.Before — PR #2472 head
79a9e0d273833790f75693d5ebb8b01a3fc4ed1eBoth the confirmed restart and unconfirmed disconnect render as a daemon restart.
After — child head
2d4894d97b0930905c9aca027b717c3558b01470The confirmed restart remains unchanged; the unconfirmed disconnect is labeled as a lost host connection.
BB-Thread-ID: thr_sjdd7gudiq