Skip to content

Fix misleading host disconnect stop reason - #2514

Open
brsbl wants to merge 2 commits into
bb/thr_fdabesxhdrfrom
bb/fix-misleading-host-disconnect-reason-thr_sjdd7gudiq
Open

Fix misleading host disconnect stop reason#2514
brsbl wants to merge 2 commits into
bb/thr_fdabesxhdrfrom
bb/fix-misleading-host-disconnect-reason-thr_sjdd7gudiq

Conversation

@brsbl

@brsbl brsbl commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

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: handleHostSessionOpened observes a changed daemon instanceId.

What changed

  • Added the additive persisted interruption reason host-connection-lost and use it only when the daemon/session disconnect grace expires without a confirmed replacement instance.
  • Preserved host-daemon-restarted for the existing changed-instanceId restart path.
  • Added lifecycle failure copy and the timeline title “Stopped — connection to host was lost.”
  • Added regressions at the server lifecycle boundary and thread-view parser boundary that prove lost connections and confirmed restarts remain distinguishable.
  • The additive public reason changes the packed plugin SDK, so the established release guard requires the coherent patch bump 0.4.220.4.23. No host-daemon wire shape changed, HOST_DAEMON_PROTOCOL_VERSION is unchanged, and there are no CLI or documentation changes.

How you verified

  • Red proof before the implementation: pnpm exec turbo run test --filter=@bb/server -- test/internal/background-task-reconciliation.test.ts failed 1/11 because the disconnect-grace event was host-daemon-restarted instead of host-connection-lost.
  • Green focused regressions: the same server file passes 11/11; pnpm exec turbo run test --filter=@bb/thread-view -- test/parse-operation-message.test.ts passes 9/9.
  • pnpm exec turbo run typecheck --filter=@bb/domain --filter=@bb/thread-view --filter=@bb/server --filter=@bb/app passes all 7 Turbo tasks.
  • pnpm exec turbo run test --filter=@bb/server --filter=@bb/thread-view --filter=@bb/domain passes 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.mjs passes because @get-bb/plugin-sdk@0.4.23 is unpublished; focused SDK/domain typecheck and tests pass all 8 Turbo tasks (219 SDK and 172 domain tests).
  • pnpm exec oxfmt --check on all six changed files and git diff --check pass.
  • Exact final-head CI run 33030937107 passed all 13 jobs at 2d4894d97b0930905c9aca027b717c3558b01470, including checks, package/server/app/integration suites, Ubuntu and macOS package smoke tests, and Node 24/26 compatibility on Ubuntu and macOS.
  • Exact branch web-app QA in Chrome for Testing 152.0.7977.64 passed at 390×844, 768×900, 1440×900, and 3440×1440. The real thread route passed initial render, client navigation, hard reload, responsive inspection, and console/runtime checks with the same deterministic fixture. The confirmed-restart row stayed unchanged while the disconnect row changed to the truthful text.

Before — PR #2472 head 79a9e0d273833790f75693d5ebb8b01a3fc4ed1e

Both the confirmed restart and unconfirmed disconnect render as a daemon restart.

Before: both fixture rows say Stopped — host daemon restarted

After — child head 2d4894d97b0930905c9aca027b717c3558b01470

The confirmed restart remains unchanged; the unconfirmed disconnect is labeled as a lost host connection.

After: confirmed restart and lost host connection are distinct

BB-Thread-ID: thr_sjdd7gudiq

AGENT GENERATED

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