Skip to content

fix(sessions): preserve session state across screen detach/reattach - #1

Open
twall wants to merge 1 commit into
masterfrom
fix/session-state-persistence
Open

fix(sessions): preserve session state across screen detach/reattach#1
twall wants to merge 1 commit into
masterfrom
fix/session-state-persistence

Conversation

@twall

@twall twall commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Summary

  • Session history preserved: launch_session now detects existing claude_session_id and routes to resume_session, preventing a new session from overwriting the DB reference and losing conversation history
  • Current task survives detach: _snapshot was calling query_one(TaskPanel) during SIGHUP teardown — widget tree may already be gone, causing silent failure and state not saved; now falls back to _last_selected_id cached on each selection event
  • CLI launch command: adds planner.cli launch <id> [--cwd <path>] for launching sessions outside the TUI

Test plan

  • Launch a task session, detach from screen, reattach — verify same task is selected
  • Launch a task with existing claude_session_id — verify it resumes the old conversation (not a blank new session)
  • planner.cli launch <id> launches session and prints full_name

- launch_session now routes to resume_session when task has claude_session_id,
  preventing conversation history loss when relaunching an existing task
- _snapshot falls back to _last_selected_id if widget tree is torn down during
  SIGHUP (screen detach), fixing "current task resets on detach"
- Track _last_selected_id on every TaskSelected event as a safe teardown fallback
- Add `planner.cli launch` command for launching sessions from the CLI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant