Skip to content

Harden pane hydration + poll daemon readiness until healthy (relates #1672) - #1677

Merged
mstomar125 merged 1 commit into
NodeSpaceAI:mainfrom
mstomar125:issue-1672-journal-hydrate-retry
Jul 16, 2026
Merged

mstomar125 merged 1 commit into
NodeSpaceAI:mainfrom
mstomar125:issue-1672-journal-hydrate-retry

Conversation

@mstomar125

@mstomar125 mstomar125 commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

What this is

Hardening of the pane-hydration path plus a persistent daemon-readiness poll. It relates to #1672 (the fresh-install "Daily Journal Loading… forever" P0) and is the most likely fix, but the root cause is not yet confirmed on a live device, so #1672 stays open until the fresh-install validation leg runs (round-2, on the validation Mac). Do not auto-close #1672 on this merge.

Why it's framed as hardening, not a confirmed fix

The round-1 report notes "reload does not fix it" and "no WatchNodes activity" across the hung session — both consistent with a failure at or below the app→daemon transport (e.g. a wedged lazy gRPC channel) rather than a swallowed one-shot fetch alone. A frontend re-invoke can only heal the latter. This PR fixes a real terminal-failure path (a hydration fetch that fails during the daemon boot window is never retried) and closes the signal hole that would defeat that retry — but confirming it resolves the user-visible hang needs a live fresh-install run, which can't be done headlessly.

Changes

  • pane-content.svelte: retry the active tab's hydration when the daemon becomes healthy (guarded by store-presence; not-found→close-tab semantics unchanged).
  • daemon-status.ts: poll check_daemon_status until the daemon is first observed healthy, then stop and let the push channel carry later transitions. Previously the "healthy" signal came only from the backend's one-shot readiness emit (bounded by a fixed timeout) — a slower fresh-install boot would emit a single non-healthy status and never emit healthy, so onDaemonReconnect (this retry, and the sidebar stores) would wait forever. This makes the signal reliable for every consumer.

Tests

  • daemon-status.test.ts (+2): a boot where the push never carries healthy but a later poll observes it still fires onDaemonReconnect; the poll stops once healthy (no further pulls).
  • pane-content-hydration.test.ts (+1): a hydration that fails then succeeds on the reconnect retry.
  • Full frontend suite green (4063).

Addresses the review

  • F1 — reframed to hardening; [P0][bug] Daily Journal hangs on "Loading…" forever on a fresh empty DB (clean install, signed out) #1672 kept open for live validation (this comment + title).
  • F2 — the persistent readiness poll removes the one-shot-emit dependency. (The mid-session-daemon-restart-emits-nothing case is a broader daemon-status gap filed separately — see the follow-up issue.)
  • F3 — added tests that pin the actual daemon-status poll wiring (the load-bearing new behavior), not just the hydrate mirror.
  • F4 — the readiness poll logs each retry distinctly; the hydrate retry rides the existing error log.

🤖 Generated with Claude Code

…1672)

A pane's hydration fetch runs once per tab change; when the first fetch
races the daemon's boot window (fresh install: the webview renders while
the sidecar is still seeding its DB and binding the socket) the invoke
rejects with a transport error, hydrateNode swallows it, and the pane
sits on "Loading..." forever — the sidebar populates because every other
daemon-dependent load already retries on the healthy transition.

Register the same onDaemonReconnect retry idiom in pane-content: on a
not-healthy → healthy transition, re-run hydrateNode for the active
tab's node if it is still absent from the store. The store-presence
guard keeps it a no-op after successful hydration.

Co-Authored-By: Claude Fable 5 <[email protected]>
@mstomar125

Copy link
Copy Markdown
Contributor Author

REQUEST CHANGES (adversarial review of 215b898d)

The 19-line retry is legitimate hardening of a real terminal-failure path and is correctly built (registration order, initial-fire semantics, cleanup, multi-pane behavior all check out). But:

  • F1 (blocker): the PR claims "Fixes [P0][bug] Daily Journal hangs on "Loading…" forever on a fresh empty DB (clean install, signed out) #1672" on an unvalidated root-cause theory that the round-1 evidence itself contradicts — the issue records "reload does not fix it" (a reload re-runs hydration against a then-healthy daemon and would heal without this fix), and the report records zero WatchNodes activity across the hung session (the watcher rides the same channel), both pointing at a failure below the webview (e.g. a wedged Rust-side lazy channel) that a frontend re-invoke cannot heal. Requires live fresh-install validation before it may close [P0][bug] Daily Journal hangs on "Loading…" forever on a fresh empty DB (clean install, signed out) #1672; until then this is hardening.
  • F2 (should-fix): the retry hinges on onDaemonReconnect, but "healthy" is emitted at most once, from a one-shot 30s-bounded startup task (src-tauri/src/lib.rs:277 is the only emit). A fresh-install boot >30s emits "not_running" and no healthy ever follows — the retry never fires; mid-session daemon restarts emit nothing at all (which also invalidates the PR's [bug] Pro build with the multi-database switcher crash-loops at launch (stable single-DB build unaffected) #1644 claim). The healthy signal needs to be persistent (poll until healthy + keep observing after).
  • F3 (should-fix): the new test is a hand-rolled mirror that imports neither the component nor daemon-status — deleting the entire onMount registration leaves the suite green.
  • F4 (nit): a failed retry is as silent as the original failure; log attempt/outcome distinctly so device logs can distinguish "never retried" from "retried and failed".

Fix direction: persistent daemon-status polling so the reconnect signal is reliable for every consumer; retitle to hardening with "Relates #1672"; pin the actual wiring in tests; distinct retry logs. #1672 stays open pending the live fresh-install leg.

@mstomar125 mstomar125 changed the title Retry pane hydration on daemon-healthy transition — fixes the fresh-install journal Loading hang (#1672) Harden pane hydration + poll daemon readiness until healthy (relates #1672) Jul 16, 2026
@mstomar125

Copy link
Copy Markdown
Contributor Author

Addressed the review; merging as hardening with #1672 kept open for the live fresh-install validation leg (round-2):

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.

[P0][bug] Daily Journal hangs on "Loading…" forever on a fresh empty DB (clean install, signed out)

1 participant