Repository navigation
Poll daemon-status steady-state so a mid-session restart re-fires onDaemonReconnect (#1678) - #1683
Merged
mstomar125 merged 1 commit intoJul 17, 2026
Merged
Conversation
…aemonReconnect (#1678) The backend emits daemon-status only from its one-shot startup task, so a daemon that dies and is relaunched while the app is running pushes no healthy signal and every reconnect consumer (schemas, collections, children-tree, pane hydration) stays wedged until an app restart. Add a low-frequency steady-state poll of check_daemon_status (which probes the socket live) so the healthy -> not_running -> healthy cycle is observed and applyStatus re-fires onDaemonReconnect. Reconnect callbacks fire only on the not-healthy -> healthy edge, so steady healthy polls are no-ops. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Contributor
Author
|
APPROVE (adversarial self-review) Went looking for ways this breaks:
Pre-push gate green (test:all + cargo build + e2e), twice. Minimal, correct, tested. Merging. |
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.
Summary
Fixes #1678. The shared daemon-status service fans a reconnect signal to every daemon-dependent store (schemas, collections, children-tree, pane hydration) via
onDaemonReconnect, fired on a not-healthy → healthy transition. That signal was reliable for the initial boot, but a mid-session daemon restart emitted nothing: alldaemon-statusemit sites live in the backend's one-shot startup task (src-tauri/src/lib.rs), so a daemon that dies and is relaunched while the app is running pushes nohealthyevent and no consumer retries — a wedged pane/store stays wedged until an app restart.Fix
Add a low-frequency steady-state poll of
check_daemon_status(which probes the socket live each call) indaemon-status.ts, started after the listener wires up. Ahealthy → not_running → healthycycle is now observed andapplyStatusre-firesonDaemonReconnect. Reconnect callbacks fire only on the not-healthy → healthy edge, so steady healthy polls are no-ops. Also addsstopDaemonStatusListener(test teardown; production never calls it) and.unref()s the interval so it can't keep a process alive on its own.Why it matters for #1672
This closes one of the two plausible root causes of the journal "Loading…" hang: the case where the daemon's
healthytransition is never observed by the frontend (the push fires before the webview registers its listener, and the single pull-on-subscribe caughtstarting), so the pane'sonDaemonReconnectretry never runs. With the steady-state poll the daemon is re-observed and the pane self-heals.Tests
re-probes daemon health on a steady-state interval after startre-fires onDaemonReconnect when a steady-state poll observes a healthy → not_running → healthy restart(the [bug] daemon-status emits no healthy signal after a mid-session daemon restart — reconnect consumers never retry #1678 scenario, driven purely by the poll — no push)Relates: #1672, #1644, #1677.