Skip to content

WebChat/TUI should resume prior session after reconnect instead of silently starting a new one #53375

Description

@nanami-he

Problem

Local WebChat/TUI sessions seem too tightly bound to the current WebSocket / attached connection.

If my Mac sleeps, the frontend disconnects, or the page reconnects, OpenClaw often creates a new session instead of resuming the previous one. This makes local conversation continuity unreliable.

Why it matters

For laptop usage, sleep/wake is normal. A brief transport interruption should not silently create a fresh conversation and discard context.

This affects many users, not just edge cases:

  • Laptop sleep/wake — lid close, walk away, come back → new session
  • Gateway restart — config change, update, openclaw gateway restart → new session
  • Power outage / crash recovery — Gateway restarts → session gone
  • Desktop users who shut down at night — next morning = fresh start every time
  • Web UI page refresh — reconnect → new session

In all these cases, the service recovers fine, but the session does not.

Core argument

I am not arguing that OpenClaw should not run as a long-lived service. For agents, bots, and automation, a persistent gateway is a reasonable expectation.

The issue is: session continuity should not require uninterrupted runtime.

OpenClaw can run as a persistent service — but local users should not have to depend on 24/7 uninterrupted uptime just to preserve conversation continuity.

The questions worth considering:

  1. Should there be a continuity / resume mechanism for local users after a brief interruption?
  2. Should session identity be more persistent than the WebSocket connection?
  3. Should the system clearly tell the user: "you are resuming your previous session" vs "you are starting a new one"?

The gap is not in service availability — it is in session identity persistence. A stable session identity, tied to the user rather than the live socket, would make brief interruptions transparent.

Reproduction

  1. Run OpenClaw locally on macOS
  2. Keep Gateway running as LaunchAgent
  3. Start a conversation in WebChat or TUI
  4. Put the Mac to sleep (or trigger a frontend/WebSocket disconnect, refresh, or reconnect)
  5. Resume and reconnect
  6. Observe that a new session is often created instead of continuing the previous one

Current behavior

  • WebChat/TUI session continuity appears to depend heavily on the current WebSocket / attached connection
  • After disconnect/reconnect, the session may be discarded or replaced
  • Reconnected users are effectively treated as a new conversation

Expected behavior

A short disconnect, page refresh, frontend reconnect, or sleep/wake cycle should not create a new conversation by default.

Instead, WebChat/TUI should try to:

  • Resume the prior active session for that local user/client
  • Preserve conversation continuity across brief transport interruptions
  • Separate session identity from transient WebSocket connection state

Why Telegram feels better

Telegram seems more robust because the session key is tied to a stable identity (chat ID / user ID), not just a live socket.

That makes it much more resilient to temporary gateway pauses or reconnects.

It would be great if local WebChat/TUI could offer a similar continuity model.

Suggested improvement directions

  1. Bind WebChat/TUI to a stable local client identity instead of a single live WebSocket connection
  2. On reconnect, attempt to resume the most recent active session rather than silently creating a new one
  3. Add an explicit "resume previous session" behavior for local clients
  4. Persist session identity across sleep/wake, refresh, and brief reconnects
  5. Make the UI clearly indicate whether the user is rejoining an existing session or starting a new one

Environment

  • Local macOS usage
  • Gateway running as LaunchAgent
  • WebChat / TUI frontend
  • Issue is especially visible after sleep/wake or reconnect scenarios

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions