Skip to content

Fix executor switch: kill old session and restart with new executor#512

Merged
bborn merged 1 commit intomainfrom
task/2069-preserve-session-content-when-switching
Mar 18, 2026
Merged

Fix executor switch: kill old session and restart with new executor#512
bborn merged 1 commit intomainfrom
task/2069-preserve-session-content-when-switching

Conversation

@bborn
Copy link
Owner

@bborn bborn commented Mar 18, 2026

Summary

  • When switching executors on a task in the TUI, the old tmux window was being reused (same Claude pane, just with a new title). Now Refresh() detects executor changes and kills the old window, clears stale state, and starts a fresh session with the new executor.
  • Exports KillAllWindowsByNameAllSessions for use from the UI package.

What was happening

  1. User edits task, changes executor from Claude to Codex
  2. startResumableSession finds existing task-{ID} window and reuses it
  3. Pane title updates to "Codex" but the running process is still Claude

What happens now

  1. Refresh() detects prevTask.Executor != m.task.Executor
  2. Kills the old tmux window
  3. Clears cached pane IDs and stale session ID
  4. Starts fresh session with new executor (including previous session context from Preserve session content when switching executors #511)

Test plan

  • All executor and UI tests pass
  • go vet and golangci-lint clean
  • Manual: switch executor on running task, verify old pane is killed and new executor starts

🤖 Generated with Claude Code

When switching executors on a task in the TUI, the old tmux window was
being reused (same Claude pane, just with a Codex title). Now Refresh()
detects executor changes and:
1. Kills the old tmux window
2. Clears cached pane state and stale session ID
3. Starts a fresh session with the new executor

Also exports KillAllWindowsByNameAllSessions for use from the UI package.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@bborn bborn merged commit 8b47449 into main Mar 18, 2026
3 of 4 checks passed
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