fix: persist agent pane type to prevent config loss on rebind#51
Closed
DmitryBMsk wants to merge 2 commits intostandardagents:mainfrom
Closed
fix: persist agent pane type to prevent config loss on rebind#51DmitryBMsk wants to merge 2 commits intostandardagents:mainfrom
DmitryBMsk wants to merge 2 commits intostandardagents:mainfrom
Conversation
Agent panes created via createPane() were missing the explicit `type: 'worktree'` field. When tmux pane IDs became stale (session restart, pane rebinding failure), these typeless panes could be misclassified or silently dropped from the config. Changes: - Set `type: 'worktree'` explicitly in createPane() for all new panes - Add migration in loadPanesFromFile() to backfill type for legacy panes based on worktreePath/agent presence - Harden rebindAndFilterPanes() shell-pane detection to also handle legacy panes without explicit type field
- Migration logic now uses only worktreePath (not agent) to determine worktree type — conflict-resolution panes have agent but no worktreePath and must be classified as shell panes - Add explicit type: 'worktree' to attachAgent and reopenWorktree pane creation paths for complete coverage - Align isShellPane fallback detection in usePaneSync with same logic
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
Agent panes created via
createPane()were missing the explicittype: 'worktree'field in the persisted config. When tmux pane IDs became stale (e.g., after session restart or pane rebinding failure), these typeless panes could be misclassified during therebindAndFilterPanes()cycle and silently dropped fromdmux.config.json.Root cause:
createPane()builds theDmuxPaneobject without settingtype, even though the type definition defaults to'worktree'for backward compatibility. The filtering logic inusePaneSync.tscheckspane.type === 'shell'to decide whether to remove stale panes, but legacy agent panes withtype: undefinedfall through ambiguously.Changes
src/utils/paneCreation.ts— Settype: 'worktree'explicitly when creating new agent panessrc/hooks/usePaneLoading.ts— Add migration inloadPanesFromFile()to backfilltypefor legacy panes based onworktreePath/agentpresencesrc/hooks/usePaneSync.ts— HardenrebindAndFilterPanes()shell-pane detection to also handle legacy panes without explicittypefieldTest plan
mainunrelated to this change)tsc --noEmit)type: 'worktree'appears indmux.config.json