-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Describe the bug
When the CLI process on the target device exits unexpectedly (e.g., terminal closed abruptly or Ctrl-C pressed twice to exit), the session remains shown as online in both the app and web client. Attempts to manually clean up the session via the UI result in errors.
Steps to reproduce
- Start a session via the CLI on a target device and connect via the app or web client.
- On the target device, either:
- Close the terminal window abruptly, or
- Press
Ctrl-Ctwice to exit the CLI process (first press interrupts the current task, second press exits the process)
- The session continues to appear as online in the app/web UI.
- Any messages sent receive no response.
- Open the session management panel (tap the session avatar in the session view).
- Tap "Archive Session" (described as "archive this session and stop it") → Error:
RPC call failed - Go back, tap "View Device", then attempt "Stop Daemon" in the sub-panel → Error:
failed to stop daemon. it may not be running
Expected behavior
- Either the session should automatically transition to offline/disconnected when the CLI process exits, or
- The "Archive Session" / "Stop Daemon" actions should handle the case where the CLI is already gone — gracefully marking the session as offline rather than returning an error.
Actual behavior
- Session is stuck in online state indefinitely.
- "Archive Session" fails with:
Error: RPC call failed - "Stop Daemon" fails with:
failed to stop daemon. it may not be running - No way to clear the zombie session from the UI.
Root cause hypothesis
Both "Archive Session" and "Stop Daemon" appear to attempt an RPC call to the CLI process on the target device. Since the process is already dead, the RPC naturally fails — but the error is surfaced to the user rather than being handled gracefully. The UI should detect that the target is unreachable and fall back to a local/server-side cleanup (e.g., force-marking the session as offline/archived without requiring a live RPC response).
Environment
| Item | Version |
|---|---|
| happy CLI version | 0.13.0 |
| Claude Code version | 2.1.50 |
| OS | Windows 11 Pro 25H2 (OS Build 26200.7840) |
| Client | App & Web (both affected) |