fix: prevent duplicate tmux panes from rapid arrow key navigation#138
Merged
fix: prevent duplicate tmux panes from rapid arrow key navigation#138
Conversation
The startResumableSession function was requiring a worktree path, which prevented resuming sessions for tasks that use the main project directory. Now it uses getWorkdir() which falls back to the project directory when no worktree exists. Also improved the file-based session lookup fallback to use getWorkdir() instead of only checking WorktreePath, ensuring compatibility with both worktree-based and non-worktree tasks. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
When using arrow keys quickly to navigate between tasks in detail view, multiple task transitions could happen simultaneously, causing tmux pane cleanup and creation operations to interleave. This resulted in duplicate/overlapping panes. The fix adds a taskTransitionInProgress flag that: - Ignores arrow key presses while a transition is in progress - Gets set when starting a task switch (on arrow key press) - Gets reset when the new task is fully loaded (taskLoadedMsg handler) This ensures only one task transition occurs at a time, preventing the race condition that caused duplicate panes. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
taskTransitionInProgressflag to prevent concurrent task transitionsProblem
When arrow keys were pressed rapidly to change tasks, multiple task transition operations could happen simultaneously. This caused tmux pane cleanup (
breakTmuxPanes()) and creation (joinTmuxPanes()) operations to interleave, resulting in duplicate or overlapping panes.The race condition occurred because:
Solution
Added a
taskTransitionInProgressboolean flag to theAppModelthat:truewhen starting a task switch (on Up/Down arrow key press)falsewhen the new task is fully loaded (intaskLoadedMsghandler)This ensures only one task transition occurs at a time, eliminating the race condition.
Changes
internal/ui/app.go: AddedtaskTransitionInProgressflag and guard checks in arrow key handlersTest plan
🤖 Generated with Claude Code