Skip to content

Self-heal the Pro live-status stream after an in-place channel recovery (closes #1879) - #1890

Merged
mstomar125 merged 1 commit into
mainfrom
issue-1879-pro-stream-respawn
Aug 1, 2026
Merged

mstomar125 merged 1 commit into
mainfrom
issue-1879-pro-stream-respawn

Conversation

@mstomar125

Copy link
Copy Markdown
Contributor

Summary

Completes the #1672 wedged-channel recovery for the last surface it missed: the Pro WatchSyncStatus live-status stream (the sync pill). #1672 rebuilds the shared gRPC channel and ProClient::rebind re-points cloud-sync calls, but the long-lived forwarding task stayed blocked on the dead stream, so the pill's live status froze until an app restart.

Change

  • ProClient gains a generation watch signal, bumped by rebind() after the new client is installed (so a woken task re-fetches the rebound client, never the old one) + subscribe_generation().
  • The forwarding task becomes a self-healing loop (mirrors the node watcher + token stream from [P0][bug] Daily Journal hangs on "Loading…" forever on a fresh empty DB (clean install, signed out) #1672): a biased select! on generation.changed() vs the stream drops a wedged/ended stream and re-subscribes on the current channel — a rebuild re-subscribes at once; a plain end greys the pill, backs off, retries.

All app-side (the task + ProClient run in the Tauri process), so the channel rebuild's generation bump self-heals the stream and the webview recovers via the resumed sync:status events — no frontend change.

Adversarial review — findings fixed

  • Free-tier regression (found in review): a community daemon returns Unimplemented for WatchSyncStatus; the loop would have retried it every 2s forever on every free install (against 'free users unaffected'). Now terminal — Unimplemented exits the task.
  • Residual wedge window: the re-subscribe call is now bounded by a SUBSCRIBE_TIMEOUT, so a wedge landing exactly during re-subscribe can't hang outside the generation select.
  • Review confirmed sound: no busy-loop, correct generation/rebind happens-before, no deadlock, no spurious DISCONNECTED flash on rebuild.

Full pre-push gate green.

Co-Authored-By: Claude Opus 4.8 [email protected]

…ry (closes #1879)

Completes the #1672 wedged-channel recovery for the last surface it missed: the
Pro WatchSyncStatus live-status stream (the sync pill). #1672 rebuilds the shared
gRPC channel and ProClient::rebind re-points cloud-sync calls, but the long-lived
WatchSyncStatus forwarding task stayed blocked on the dead stream, so the pill's
live status stopped updating until an app restart.

- ProClient gains a  watch signal, bumped by rebind() AFTER the new
  client is installed (so a woken task re-fetches the rebound client, never the
  old one) + subscribe_generation().
- The forwarding task becomes a self-healing loop (mirrors the node watcher +
  token stream from #1672): a biased select on generation.changed() vs the stream
  drops a wedged/ended stream and re-subscribes on the current channel — a rebuild
  re-subscribes at once; a plain end greys the pill, backs off, and retries.

No frontend change: it is all app-side (ProClient + the task run in the Tauri
process), so the rebuild's generation bump self-heals the stream and the webview
recovers via the resumed sync:status events. Removes the STREAM_SPAWNED reset —
one forwarding task now runs for the process lifetime.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@mstomar125

Copy link
Copy Markdown
Contributor Author

APPROVE (self-review + adversarial review addressed).

Review confirmed the core mechanics sound (self-healing loop, generation watch semantics, rebind happens-before, no busy-loop, no deadlock, no spurious DISCONNECTED flash on rebuild). Two findings fixed in 7249d7f:

  • Free-tier regression: Unimplemented (community daemon) is now terminal — the task exits instead of retrying every 2s for the process lifetime. Preserves 'free users unaffected'.
  • Residual wedge window: the (re)subscribe is bounded by SUBSCRIBE_TIMEOUT, closing the narrow case where a wedge during re-subscribe (outside the generation select) could hang.

Full gate green.

@mstomar125
mstomar125 merged commit c3f3007 into main Aug 1, 2026
2 checks passed
@mstomar125
mstomar125 deleted the issue-1879-pro-stream-respawn branch August 1, 2026 11:49
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