fix(tui): preserve detached sessions with active work - #49900
Conversation
|
Additional finding from issue #52089 (reported by a user experiencing this bug): Even when your This means the reaper fix alone (#49900) is necessary but not sufficient. The desktop app also needs to properly recover the session reference after WebSocket reconnection (#47297). |
|
Thanks for the focused lifecycle fix. Current main still has the relevant gap: The proposed guards align with the established policy in the longer-lived reapers, which already spare pending and not-ready sessions ( Automated hermes-sweeper review. |
Summary
Why
A disconnected desktop/TUI WebSocket transport should not cause active or resumable work to be closed by the orphan reaper. The reaper should only close sessions that are detached and have no active turn, build, or pending user input.
Tests
uv run python -m pytest tests/test_tui_gateway_server.py -q -o 'addopts=' -k 'ws_orphan_reap'4 passed, 278 deselected