fix(desktop): keep and recover interrupted chats across update/restart - #81319
Conversation
…opping After backend restart, restore_undelivered_completions requeues durable pending child results; a non-owner session poller was dropping them so parents went silent. Park orphans and let the owning tab claim on resume. Also raise background_review max_iterations 16→48 so skill self-improve thrash cannot burn the whole budget and strand a parent mid-wave.
Update handoff and tui_shutdown used to conclude in-flight turns cleanly, which retired crash markers — so auto-continue had nothing to resume after refresh. Preserve markers on process/update teardown, and on gateway.ready cold-resume every fresh marker (not only the focused tab).
|
The shutdown-preservation half of this is a real fix, and the diagnosis is right:
The other one is about the boot scan rather than the code. |
Summary
After a desktop update/refresh, in-flight chats were dying and not coming back.
Root cause: update handoff /
tui_shutdownconcluded turns cleanly, which retired crash markers ininterrupted_turns.json. Auto-continue only runs onsession.resume, and lazy tabs don't resume until clicked — so multi-chat work stayed dead after refresh.Changes
tui_shutdown, compute-host reasons, etc.) via_preserve_turn_marker_for_shutdown. User-initiated Stop/close still clears markers._ensure_interrupted_turn_recoveryatgateway.ready): cold-resume every fresh marker (cap 12), not only the focused tab.list_turn_markers, optionalcause/keep_started_atonrecord_turn_start.async_delegationcompletions (prior local fix on this install).Test plan
uv run --python 3.11 pytest tests/tui_gateway/test_auto_continue.py -q→ 19 passed