Repository navigation
Improve take back all terminals - #8200
Conversation
Previously a failed resize during reclaimTerminalForDesktop left the override/lock in place (#7588 semantics), but for an explicit "take back all terminals" gesture that could strand banners on background panes whose resize can't converge. Now the take-back unconditionally releases the driver and clears any held fit-override via a new releaseDesktopTakeBack helper, while auto-restore and phone-initiated paths keep the original keep-lock-on-failure behavior. Also extract the local mapWithConcurrency helper out of workspace-cleanup.ts into a shared, tested src/shared/map-with-concurrency.ts and use it to bound concurrent desktop-fit reclaims in terminal-fit-restore.ts.
📝 WalkthroughWalkthroughDesktop terminal reclamation now consistently releases the mobile driver lock and fit override, including failed-resize and stale-lock cases, while emitting desktop-fit notifications and resetting display mode. Runtime tests were updated for these outcomes. A shared 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
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.
🧹 Nitpick comments (1)
src/main/runtime/mobile-presence-lock.test.ts (1)
634-648: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider asserting desktop-fit event emissions in Scenario 5b for consistency.
Scenarios 4 and 5 both verify
desktop-fitevents on notifier and listener channels after a failed-resize take-back. Scenario 5b checks the same state invariants (driver, override, mode) but omits the event emission assertions. If the production code is expected to emitdesktop-fitin all take-back paths, adding the same event checks here would strengthen the regression coverage.♻️ Optional: add event assertions to Scenario 5b
it('failed take-back leaves no stranded override or lock', async () => { - const { runtime, setResizeSucceeds } = createRuntime() + const { runtime, setResizeSucceeds, fitOverrideEvents } = createRuntime() await runtime.handleMobileSubscribe('pty-1', 'phone-A', { cols: 45, rows: 20 }) setResizeSucceeds(false) + const notifierBefore = fitOverrideEvents.length + const listenerBefore = listenerEvents.length expect(await runtime.reclaimTerminalForDesktop('pty-1')).toBe(true) expect(runtime.getDriver('pty-1')).toEqual({ kind: 'desktop' }) expect(runtime.getTerminalFitOverride('pty-1')).toBeNull() expect(runtime.getMobileDisplayMode('pty-1')).toBe('auto') + expect(fitOverrideEvents.slice(notifierBefore).some((e) => e.mode === 'desktop-fit')).toBe(true) + expect(listenerEvents.slice(listenerBefore).some((e) => e.mode === 'desktop-fit')).toBe(true)
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 8c3387e4-deae-4d2a-b754-d8b4bf54a9fd
📒 Files selected for processing (6)
src/main/runtime/mobile-presence-lock.test.tssrc/main/runtime/orca-runtime.tssrc/renderer/src/components/terminal-pane/terminal-fit-restore.tssrc/renderer/src/store/slices/workspace-cleanup.tssrc/shared/map-with-concurrency.test.tssrc/shared/map-with-concurrency.ts
…ck (stablyai#8200) Previously a failed resize during reclaimTerminalForDesktop left the override/lock in place (stablyai#7588 semantics), but for an explicit "take back all terminals" gesture that could strand banners on background panes whose resize can't converge. Now the take-back unconditionally releases the driver and clears any held fit-override via a new releaseDesktopTakeBack helper, while auto-restore and phone-initiated paths keep the original keep-lock-on-failure behavior. Also extract the local mapWithConcurrency helper out of workspace-cleanup.ts into a shared, tested src/shared/map-with-concurrency.ts and use it to bound concurrent desktop-fit reclaims in terminal-fit-restore.ts.
Summary
Describe the user-visible change.
Screenshots
No visual change.Testing
pnpm lintpnpm typecheckpnpm testpnpm buildAI Review Report
Summarize the code review you ran with your AI coding agent. Include the main risks it checked, what it flagged, and what you changed or verified as a result.
Confirm that the review explicitly checked cross-platform compatibility for macOS, Linux, and Windows, including shortcuts, labels, paths, shell behavior, and any Electron-specific platform differences touched by this PR.
Security Audit
Provide a basic security audit summary from your AI coding agent. Call out any input handling, command execution, path handling, auth, secrets, dependency, or IPC risks that were reviewed, plus any follow-up needed.
Notes
Call out any platform-specific behavior, risks, or follow-up work.