Skip to content

Mobile: first message after reconnect can be lost during session restore #450

@PureWeen

Description

@PureWeen

Summary

When the desktop app restarts and mobile reconnects via WsBridge, the first message sent from mobile may be lost if sessions are still restoring.

Repro

  1. Desktop is running with active sessions, mobile connected
  2. Relaunch desktop (relaunch.sh)
  3. Mobile auto-reconnects (bridge port retry fix from PR Fix mobile streaming throttle and stale IsProcessing state #449)
  4. Immediately send a message from mobile before tapping refresh
  5. Message is lost — server returns "Session is already processing a request"

Expected

Messages sent during restore should be queued and delivered once the session is ready.

Workaround

Tap the refresh/sync button on mobile after reconnect, then send the message. This forces a full state sync and the session becomes responsive.

Root Cause

The WsBridge server accepts client connections during restore but sessions aren't fully initialized yet. The client's send_prompt arrives before RestorePreviousSessionsAsync completes, hitting a session in a half-loaded state.

Possible Fix

Queue incoming send_prompt messages during the IsRestoring window and replay them once restore completes, similar to how sessions_list broadcast is deferred.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions