Repository navigation
fix(mobile): single-pane Focus mode + instant in-session window switching (FW6-FOCUS) - #93
Conversation
…(migration 039; applied to prod) — settings cloud sync was failing Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…t in-session switching) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…hing, mobile Focus mode (a62bef5)
…ce (literal byte made the file binary to git) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
📝 WalkthroughWalkthroughThis PR introduces a ChangesTerminal Navigate Protocol and Focus Feature
Estimated code review effort: 4 (Complex) | ~75 minutes Sequence Diagram(s)sequenceDiagram
participant Dashboard
participant ControlPlane
participant Agentd
participant TerminalManager
participant tmux
Dashboard->>ControlPlane: navigate {op, window_index/pane_id/on}
ControlPlane->>ControlPlane: check operator permission
ControlPlane->>Agentd: terminal.navigate {channel_id, op, ...}
Agentd->>TerminalManager: Navigate(channelID, navigation)
TerminalManager->>TerminalManager: unzoomViewerLocked(viewer)
TerminalManager->>tmux: SelectWindow/SelectPane/SetZoom
tmux-->>TerminalManager: result
TerminalManager-->>Agentd: error/nil
Agentd-->>ControlPlane: (ack via idle timeout reset)
sequenceDiagram
participant TmuxMobileShell
participant SettingsStore
participant TerminalController
participant TerminalHostStore
TmuxMobileShell->>SettingsStore: read autoFocusPane
TmuxMobileShell->>TmuxMobileShell: getMobileFocusNavigation(topology, focusRequested)
TmuxMobileShell->>TerminalController: navigate({op:'zoom', on})
TerminalController->>TerminalHostStore: navigateWithinAttachment(...)
TerminalHostStore-->>TerminalController: true/false
TerminalController-->>TmuxMobileShell: sent(boolean)
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.12.2)level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies" Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (2)
tests/journeys/controlPlaneMock.ts (1)
413-421: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueClean up closed WebSockets from the topology broadcast set.
To prevent potential errors when broadcasting topology updates to stale connections, consider removing the socket from the
topologySocketsset when it closes.♻️ Proposed refactor
await page.routeWebSocket(/\/v1\/ui\/stream\?ticket=/, (socket) => { topologySockets.add(socket); + socket.onClose(() => topologySockets.delete(socket)); let topologySent = false; socket.onMessage(() => {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/journeys/controlPlaneMock.ts` around lines 413 - 421, Update the WebSocket setup in the topology route handler to remove each socket from topologySockets when it closes. Keep the existing onMessage behavior unchanged and attach the cleanup to the socket’s close lifecycle event.tests/journeys/command-center.journey.spec.ts (1)
96-96: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider using a synchronous assertion for unchanged values.
Using
expect.pollto assert that a value has not changed will pass instantly, as the initial condition is already met, which bypasses the intent of polling. Since the test already awaits thenavigatemessage and the visibility of the new terminal, a standard synchronous assertion is sufficient and clearer.♻️ Proposed refactor
- await expect.poll(() => recorder.terminalWebSocketUrls.length).toBe(terminalWebSocketCount); + expect(recorder.terminalWebSocketUrls).toHaveLength(terminalWebSocketCount);🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/journeys/command-center.journey.spec.ts` at line 96, Replace the expect.poll assertion on recorder.terminalWebSocketUrls.length with a synchronous expect assertion, preserving the terminalWebSocketCount comparison after the navigate message and new-terminal visibility checks.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@agents/agentd/cmd/agentd/main.go`:
- Around line 5485-5521: Update handleTerminalNavigate so the validated
a.terminalManager.Navigate call is dispatched in a goroutine, keeping the
synchronous tmux operation out of the WebSocket read loop. Preserve the existing
channel ID, navigation payload, and error logging within the asynchronous
operation, similar to handleTerminalAttach.
In `@agents/agentd/internal/tmux/terminal.go`:
- Around line 749-811: Refactor TerminalManager.Navigate and the zoom-cleanup
flow so synchronous tmux calls never run while m.mu is held. Capture the
required viewer/bridge state, release the lock before SelectWindow, SelectPane,
or SetZoom, and briefly reacquire it only to update zoomApplied safely; adjust
unzoomViewerLocked and callers such as Sweep, MarkChannelsStale, Detach, and
Close to clear state under lock and defer collected SetZoom(false) calls until
after unlocking.
In `@agents/agentd/internal/tmux/viewer_pty.go`:
- Around line 329-356: Update selectWindowLocked so b.windowTarget is assigned
to target immediately after select-window succeeds, before any letterbox pinning
or resizing steps. Preserve the existing rollback attempts and error returns for
set-option and resize-window failures while ensuring subsequent calls observe
the actual selected window.
---
Nitpick comments:
In `@tests/journeys/command-center.journey.spec.ts`:
- Line 96: Replace the expect.poll assertion on
recorder.terminalWebSocketUrls.length with a synchronous expect assertion,
preserving the terminalWebSocketCount comparison after the navigate message and
new-terminal visibility checks.
In `@tests/journeys/controlPlaneMock.ts`:
- Around line 413-421: Update the WebSocket setup in the topology route handler
to remove each socket from topologySockets when it closes. Keep the existing
onMessage behavior unchanged and attach the cleanup to the socket’s close
lifecycle event.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 713f3521-b3fb-468e-9b45-c51f438ab73d
📒 Files selected for processing (42)
agents/agentd/cmd/agentd/main.goagents/agentd/cmd/agentd/main_terminal_test.goagents/agentd/internal/protocol/messages.goagents/agentd/internal/protocol/terminal.goagents/agentd/internal/tmux/pty_bridge_test.goagents/agentd/internal/tmux/terminal.goagents/agentd/internal/tmux/viewer_pty.goagents/agentd/internal/ws/protocol_fixtures_test.goapps/dashboard/src/components/TerminalView.tsxapps/dashboard/src/components/terminal/PersistentTerminalHost.tsxapps/dashboard/src/components/terminal/protocol.test.tsapps/dashboard/src/components/terminal/protocol.tsapps/dashboard/src/components/terminal/terminalHostStore.test.tsapps/dashboard/src/components/terminal/terminalHostStore.tsapps/dashboard/src/components/terminal/types.tsapps/dashboard/src/components/tmux/TmuxActionSheet.tsxapps/dashboard/src/components/tmux/TmuxMobileShell.tsxapps/dashboard/src/components/tmux/TmuxPaneControls.tsxapps/dashboard/src/components/tmux/TmuxTerminalWorkspace.tsxapps/dashboard/src/components/tmux/TmuxWindowStrip.tsxapps/dashboard/src/components/tmux/mobileFocus.test.tsapps/dashboard/src/components/tmux/mobileFocus.tsapps/dashboard/src/hooks/tmuxNavigation.test.tsapps/dashboard/src/hooks/tmuxNavigation.tsapps/dashboard/src/hooks/useTerminalConnection.tsapps/dashboard/src/hooks/useTmuxRosterData.tsapps/dashboard/src/stores/settings.test.tsapps/dashboard/src/stores/settings.tsmigrations/039_grant_legacy_settings_access.sqlpackages/ac-schema/src/message.tspackages/ac-schema/src/terminal.tspackages/ac-schema/tests/protocol-fixtures.test.tspackages/ac-schema/tests/terminal.test.tsservices/control-plane/src/routes/terminal.tsservices/control-plane/tests/terminalRoute.test.tstasks/2026-07-21-fw6-focus-brief.mdtasks/frontend-ux-handoffs/fw6-focus.mdtasks/frontend-ux-log.mdtests/fixtures/protocol/terminal-navigate.jsontests/journeys/command-center.journey.spec.tstests/journeys/controlPlaneMock.tstests/journeys/fw6-focus.journey.spec.ts
| func (a *Agent) handleTerminalNavigate(payload json.RawMessage) { | ||
| var req protocol.TerminalNavigatePayload | ||
| if err := json.Unmarshal(payload, &req); err != nil { | ||
| log.Printf("Failed to parse terminal.navigate: %v", err) | ||
| return | ||
| } | ||
|
|
||
| navigation := tmux.TerminalNavigation{Op: tmux.TerminalNavigationOp(req.Op)} | ||
| switch navigation.Op { | ||
| case tmux.NavigateSelectWindow: | ||
| if req.WindowIndex == nil { | ||
| log.Printf("Failed to parse terminal.navigate: select_window requires window_index") | ||
| return | ||
| } | ||
| navigation.WindowIndex = *req.WindowIndex | ||
| case tmux.NavigateSelectPane: | ||
| if strings.TrimSpace(req.PaneID) == "" { | ||
| log.Printf("Failed to parse terminal.navigate: select_pane requires pane_id") | ||
| return | ||
| } | ||
| navigation.PaneID = req.PaneID | ||
| case tmux.NavigateZoom: | ||
| if req.On == nil { | ||
| log.Printf("Failed to parse terminal.navigate: zoom requires on") | ||
| return | ||
| } | ||
| navigation.On = *req.On | ||
| default: | ||
| log.Printf("Failed to parse terminal.navigate: unsupported op %q", req.Op) | ||
| return | ||
| } | ||
|
|
||
| if err := a.terminalManager.Navigate(req.ChannelID, navigation); err != nil { | ||
| log.Printf("Failed to navigate terminal: %v", err) | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
🚀 Performance & Scalability | 🟠 Major | ⚡ Quick win
Run terminal navigation in a goroutine to prevent stalling the WebSocket read loop.
a.terminalManager.Navigate executes synchronous tmux shell-outs (blocking I/O). Calling it directly inside handleTerminalNavigate blocks the agent's sequential readPump, which delays the processing of all other incoming protocol messages.
Please dispatch the navigation call in a goroutine (similar to handleTerminalAttach).
⚡ Proposed fix
- if err := a.terminalManager.Navigate(req.ChannelID, navigation); err != nil {
- log.Printf("Failed to navigate terminal: %v", err)
- }
+ go func() {
+ if err := a.terminalManager.Navigate(req.ChannelID, navigation); err != nil {
+ log.Printf("Failed to navigate terminal: %v", err)
+ }
+ }()📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| func (a *Agent) handleTerminalNavigate(payload json.RawMessage) { | |
| var req protocol.TerminalNavigatePayload | |
| if err := json.Unmarshal(payload, &req); err != nil { | |
| log.Printf("Failed to parse terminal.navigate: %v", err) | |
| return | |
| } | |
| navigation := tmux.TerminalNavigation{Op: tmux.TerminalNavigationOp(req.Op)} | |
| switch navigation.Op { | |
| case tmux.NavigateSelectWindow: | |
| if req.WindowIndex == nil { | |
| log.Printf("Failed to parse terminal.navigate: select_window requires window_index") | |
| return | |
| } | |
| navigation.WindowIndex = *req.WindowIndex | |
| case tmux.NavigateSelectPane: | |
| if strings.TrimSpace(req.PaneID) == "" { | |
| log.Printf("Failed to parse terminal.navigate: select_pane requires pane_id") | |
| return | |
| } | |
| navigation.PaneID = req.PaneID | |
| case tmux.NavigateZoom: | |
| if req.On == nil { | |
| log.Printf("Failed to parse terminal.navigate: zoom requires on") | |
| return | |
| } | |
| navigation.On = *req.On | |
| default: | |
| log.Printf("Failed to parse terminal.navigate: unsupported op %q", req.Op) | |
| return | |
| } | |
| if err := a.terminalManager.Navigate(req.ChannelID, navigation); err != nil { | |
| log.Printf("Failed to navigate terminal: %v", err) | |
| } | |
| } | |
| func (a *Agent) handleTerminalNavigate(payload json.RawMessage) { | |
| var req protocol.TerminalNavigatePayload | |
| if err := json.Unmarshal(payload, &req); err != nil { | |
| log.Printf("Failed to parse terminal.navigate: %v", err) | |
| return | |
| } | |
| navigation := tmux.TerminalNavigation{Op: tmux.TerminalNavigationOp(req.Op)} | |
| switch navigation.Op { | |
| case tmux.NavigateSelectWindow: | |
| if req.WindowIndex == nil { | |
| log.Printf("Failed to parse terminal.navigate: select_window requires window_index") | |
| return | |
| } | |
| navigation.WindowIndex = *req.WindowIndex | |
| case tmux.NavigateSelectPane: | |
| if strings.TrimSpace(req.PaneID) == "" { | |
| log.Printf("Failed to parse terminal.navigate: select_pane requires pane_id") | |
| return | |
| } | |
| navigation.PaneID = req.PaneID | |
| case tmux.NavigateZoom: | |
| if req.On == nil { | |
| log.Printf("Failed to parse terminal.navigate: zoom requires on") | |
| return | |
| } | |
| navigation.On = *req.On | |
| default: | |
| log.Printf("Failed to parse terminal.navigate: unsupported op %q", req.Op) | |
| return | |
| } | |
| go func() { | |
| if err := a.terminalManager.Navigate(req.ChannelID, navigation); err != nil { | |
| log.Printf("Failed to navigate terminal: %v", err) | |
| } | |
| }() | |
| } |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@agents/agentd/cmd/agentd/main.go` around lines 5485 - 5521, Update
handleTerminalNavigate so the validated a.terminalManager.Navigate call is
dispatched in a goroutine, keeping the synchronous tmux operation out of the
WebSocket read loop. Preserve the existing channel ID, navigation payload, and
error logging within the asynchronous operation, similar to
handleTerminalAttach.
| // Navigate changes the current target of a grouped viewer without replacing | ||
| // its PTY bridge. The origin tmux session keeps its own current window. | ||
| func (m *TerminalManager) Navigate(channelID string, navigation TerminalNavigation) error { | ||
| m.mu.Lock() | ||
| defer m.mu.Unlock() | ||
| _, exists := m.channelToPane[channelID] | ||
| viewer := m.viewerByChannel[channelID] | ||
| var bridge *viewerPTYBridge | ||
| if viewer != nil { | ||
| bridge = viewer.bridge | ||
| } | ||
| if !exists { | ||
| return fmt.Errorf("channel %s not found", channelID) | ||
| } | ||
| if bridge == nil { | ||
| return fmt.Errorf("channel %s does not use a grouped viewer session", channelID) | ||
| } | ||
|
|
||
| switch navigation.Op { | ||
| case NavigateSelectWindow: | ||
| if navigation.WindowIndex < 0 { | ||
| return fmt.Errorf("window index must be non-negative") | ||
| } | ||
| if err := m.unzoomViewerLocked(viewer, "window switch"); err != nil { | ||
| return err | ||
| } | ||
| return bridge.SelectWindow(navigation.WindowIndex) | ||
| case NavigateSelectPane: | ||
| if strings.TrimSpace(navigation.PaneID) == "" { | ||
| return fmt.Errorf("pane id is required") | ||
| } | ||
| if err := m.unzoomViewerLocked(viewer, "pane switch"); err != nil { | ||
| return err | ||
| } | ||
| return bridge.SelectPane(navigation.PaneID) | ||
| case NavigateZoom: | ||
| if err := bridge.SetZoom(navigation.On); err != nil { | ||
| return err | ||
| } | ||
| viewer.zoomApplied = navigation.On | ||
| return nil | ||
| default: | ||
| return fmt.Errorf("unsupported terminal navigation op %q", navigation.Op) | ||
| } | ||
| } | ||
|
|
||
| func (m *TerminalManager) unzoomViewerLocked(viewer *terminalViewer, reason string) error { | ||
| if viewer == nil || !viewer.zoomApplied || viewer.bridge == nil { | ||
| return nil | ||
| } | ||
| if err := viewer.bridge.SetZoom(false); err != nil { | ||
| return fmt.Errorf("unzoom viewer during %s: %w", reason, err) | ||
| } | ||
| viewer.zoomApplied = false | ||
| return nil | ||
| } | ||
|
|
||
| func (m *TerminalManager) cleanupViewerZoomLocked(viewer *terminalViewer, reason string) { | ||
| if err := m.unzoomViewerLocked(viewer, reason); err != nil { | ||
| log.Printf("Failed to %v", err) | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift
Avoid holding the global TerminalManager lock during synchronous tmux I/O.
Navigate, unzoomViewerLocked, and cleanupViewerZoomLocked execute blocking shell-outs (e.g., bridge.SelectWindow, bridge.SetZoom) via the tmux runner. Because m.mu.Lock() is held here, and cleanupViewerZoomLocked is actively called by Sweep, MarkChannelsStale, Detach, and Close with the lock already held, this design stalls all terminal operations across the agent.
Please defer the blocking tmux commands until after m.mu is released:
- For
Navigate: look up the bridge and state, explicitly release the lock, and then invoke the navigation command. (You may need to re-acquire the lock briefly forNavigateZoomto updateviewer.zoomApplied). - For zoom cleanup: clear
viewer.zoomAppliedinside the lock, but collect the affected bridge references to invokeSetZoom(false)after the lock is released by the callers.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@agents/agentd/internal/tmux/terminal.go` around lines 749 - 811, Refactor
TerminalManager.Navigate and the zoom-cleanup flow so synchronous tmux calls
never run while m.mu is held. Capture the required viewer/bridge state, release
the lock before SelectWindow, SelectPane, or SetZoom, and briefly reacquire it
only to update zoomApplied safely; adjust unzoomViewerLocked and callers such as
Sweep, MarkChannelsStale, Detach, and Close to clear state under lock and defer
collected SetZoom(false) calls until after unlocking.
| func (b *viewerPTYBridge) selectWindowLocked(target string) error { | ||
| previous := b.windowTarget | ||
| if b.letterbox && previous != target { | ||
| if err := b.runner.Run("set-option", "-w", "-t", previous, "window-size", "latest"); err != nil { | ||
| return fmt.Errorf("release previous viewer window sizing: %w", err) | ||
| } | ||
| } | ||
| if err := b.runner.Run("select-window", "-t", target); err != nil { | ||
| return fmt.Errorf("select viewer window: %w", err) | ||
| } | ||
| if b.letterbox && previous != target { | ||
| if err := b.runner.Run("set-option", "-w", "-t", target, "window-size", "manual"); err != nil { | ||
| _ = b.runner.Run("set-option", "-w", "-t", target, "window-size", "latest") | ||
| return fmt.Errorf("pin selected viewer window sizing: %w", err) | ||
| } | ||
| if err := b.runner.Run( | ||
| "resize-window", | ||
| "-t", target, | ||
| "-x", fmt.Sprintf("%d", b.size.Cols), | ||
| "-y", fmt.Sprintf("%d", b.size.Rows), | ||
| ); err != nil { | ||
| _ = b.runner.Run("set-option", "-w", "-t", target, "window-size", "latest") | ||
| return fmt.Errorf("size selected viewer window: %w", err) | ||
| } | ||
| } | ||
| b.windowTarget = target | ||
| return nil | ||
| } |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
b.windowTarget goes stale if the letterbox pin/resize steps fail after select-window already succeeded.
select-window mutates the real tmux active window immediately, but b.windowTarget is only updated at the very end of the function. If the subsequent set-option ... manual or resize-window call fails, the function returns early: the previous window's pinning was already released to "latest" and is never restored, yet b.windowTarget still reports the old previous value. Future SelectWindow/SelectPane calls then compute previous from this stale value, causing further pin/release mismanagement (leaked un-pinned windows, no-op releases against a window that's no longer current).
🐛 Proposed fix: update windowTarget right after select-window succeeds
if err := b.runner.Run("select-window", "-t", target); err != nil {
return fmt.Errorf("select viewer window: %w", err)
}
+ b.windowTarget = target
if b.letterbox && previous != target {
if err := b.runner.Run("set-option", "-w", "-t", target, "window-size", "manual"); err != nil {
_ = b.runner.Run("set-option", "-w", "-t", target, "window-size", "latest")
return fmt.Errorf("pin selected viewer window sizing: %w", err)
}
if err := b.runner.Run(
"resize-window",
"-t", target,
"-x", fmt.Sprintf("%d", b.size.Cols),
"-y", fmt.Sprintf("%d", b.size.Rows),
); err != nil {
_ = b.runner.Run("set-option", "-w", "-t", target, "window-size", "latest")
return fmt.Errorf("size selected viewer window: %w", err)
}
}
- b.windowTarget = target
return nil
}None of the current tests exercise a failing Run() mid-pin, which is why this wasn't caught.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| func (b *viewerPTYBridge) selectWindowLocked(target string) error { | |
| previous := b.windowTarget | |
| if b.letterbox && previous != target { | |
| if err := b.runner.Run("set-option", "-w", "-t", previous, "window-size", "latest"); err != nil { | |
| return fmt.Errorf("release previous viewer window sizing: %w", err) | |
| } | |
| } | |
| if err := b.runner.Run("select-window", "-t", target); err != nil { | |
| return fmt.Errorf("select viewer window: %w", err) | |
| } | |
| if b.letterbox && previous != target { | |
| if err := b.runner.Run("set-option", "-w", "-t", target, "window-size", "manual"); err != nil { | |
| _ = b.runner.Run("set-option", "-w", "-t", target, "window-size", "latest") | |
| return fmt.Errorf("pin selected viewer window sizing: %w", err) | |
| } | |
| if err := b.runner.Run( | |
| "resize-window", | |
| "-t", target, | |
| "-x", fmt.Sprintf("%d", b.size.Cols), | |
| "-y", fmt.Sprintf("%d", b.size.Rows), | |
| ); err != nil { | |
| _ = b.runner.Run("set-option", "-w", "-t", target, "window-size", "latest") | |
| return fmt.Errorf("size selected viewer window: %w", err) | |
| } | |
| } | |
| b.windowTarget = target | |
| return nil | |
| } | |
| func (b *viewerPTYBridge) selectWindowLocked(target string) error { | |
| previous := b.windowTarget | |
| if b.letterbox && previous != target { | |
| if err := b.runner.Run("set-option", "-w", "-t", previous, "window-size", "latest"); err != nil { | |
| return fmt.Errorf("release previous viewer window sizing: %w", err) | |
| } | |
| } | |
| if err := b.runner.Run("select-window", "-t", target); err != nil { | |
| return fmt.Errorf("select viewer window: %w", err) | |
| } | |
| b.windowTarget = target | |
| if b.letterbox && previous != target { | |
| if err := b.runner.Run("set-option", "-w", "-t", target, "window-size", "manual"); err != nil { | |
| _ = b.runner.Run("set-option", "-w", "-t", target, "window-size", "latest") | |
| return fmt.Errorf("pin selected viewer window sizing: %w", err) | |
| } | |
| if err := b.runner.Run( | |
| "resize-window", | |
| "-t", target, | |
| "-x", fmt.Sprintf("%d", b.size.Cols), | |
| "-y", fmt.Sprintf("%d", b.size.Rows), | |
| ); err != nil { | |
| _ = b.runner.Run("set-option", "-w", "-t", target, "window-size", "latest") | |
| return fmt.Errorf("size selected viewer window: %w", err) | |
| } | |
| } | |
| return nil | |
| } |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@agents/agentd/internal/tmux/viewer_pty.go` around lines 329 - 356, Update
selectWindowLocked so b.windowTarget is assigned to target immediately after
select-window succeeds, before any letterbox pinning or resizing steps. Preserve
the existing rollback attempts and error returns for set-option and
resize-window failures while ensuring subsequent calls observe the actual
selected window.
Summary
Fixes the two remaining owner device-checklist findings (S25 Ultra, production):
autoFocusPanesetting, default on), with a visible maximize toggle in the status row whose pressed state mirrors tmux topology truth. tmux zoom is window-shared, so the desktop view of that window zooms too (accepted single-user trade-off); agentd tracks channel-owned zoom and force-unzooms on every teardown path (detach, supersede, stale connection, TTL sweep, manager close) so a dropped phone can never leave the desktop stuck zoomed.terminal.navigateprotocol (select_window/select_pane/zoom) executes against the per-viewer grouped session, so same-session switches keep the WebSocket, descriptor, and xterm instance — instant — and phone navigation no longer yanks the desktop's active window (grouped sessions have independent current-window). Cross-session targets keep the reattach path. The letterbox window-size pin migrates release→select→pin→resize across viewer window switches.Review chain
select_windowcommand path is unused.Deploy notes
terminal.navigateunion member); CP relay is operator-gated likeinput.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes