Skip to content

[bug] Pro live-status stream stays wedged after in-place channel recovery (sync pill doesn't auto-resume) #1879

Closed

Description

@mstomar125

Context

Follow-up to the wedged-channel self-heal (#1672). That fix rebuilds the shared gRPC channel in place when it wedges under sync load, and recovers:

  • the node data plane + WatchNodes watcher (the P0 journal-hang),
  • the ai-chat token stream (now interrupted by the db_generation bump and re-subscribed on the fresh channel),
  • all unary Pro cloud-sync calls (ProClient::rebind points the cached client at the new channel).

Gap

The live-status WatchSyncStatus forwarding task (commands/pro_sync.rs::pro_subscribe_sync_status) is not recovered. It is a die-and-respawn task (no internal reconnect loop): it ends → resets STREAM_SPAWNED → emits sync:status disconnected → the frontend re-subscribes. But on a wedge, stream.next().await hangs forever, so:

  • the task never ends → STREAM_SPAWNED stays true → a respawn is blocked, and
  • the frontend pro-sync store only re-subscribes at init / on pro:tier-detected, not on onDaemonReconnect.

Net: after an automatic channel recovery the sync pill's live status stays stale until a full app restart, even though everything else recovered.

Fix direction (coordinated 3-point change)

  1. Give ProClient a generation signal (or reuse GrpcClient's), bumped by ProClient::rebind, and have the forwarding task tokio::select! on it (biased) — mirror the node watcher, so a rebuild drops the wedged stream and lets the task end (resetting STREAM_SPAWNED + emitting disconnected).
  2. Ensure the respawn re-fetches pro.client() after rebind so it subscribes on the new channel (order the generation bump after the rebind to avoid the race).
  3. Wire onDaemonReconnect(() => invoke('pro_subscribe_sync_status')) in the pro-sync store so a recovery re-subscribes automatically.

Acceptance

  • After an automatic wedge recovery (no restart), the sync pill's live status resumes updating within a couple of seconds.
  • No double-spawn / STREAM_SPAWNED race on rapid reconnect.

Found by adversarial review of the #1672 fix (finding #1, stream half).

Activity

  1. self-assigned this
    on Aug 1, 2026
  2. mstomar125 commented on Aug 1, 2026

    @mstomar125
    ContributorAuthor

    Resolved in #1890 (merged). The Pro WatchSyncStatus forwarding task is now a self-healing loop that re-subscribes on the current channel when ProClient::rebind bumps a generation signal after a wedged-channel recovery — so the sync pill's live status recovers automatically instead of freezing until an app restart. This completes the #1672 wedge-recovery across every surface (node watcher, ai-chat token stream, unary Pro calls, and now the live-status stream). Adversarial review caught + fixed a free-tier regression (community Unimplemented is terminal, not a 2s retry loop) and bounded the re-subscribe with a timeout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions