Mobile: indefinite phone-fit hold + configurable auto-restore#1532
Open
Mobile: indefinite phone-fit hold + configurable auto-restore#1532
Conversation
When the mobile app leaves a terminal, the PTY now stays at phone size indefinitely by default instead of releasing back to desktop dims after a 300ms debounce. This avoids expensive TUI reflows for apps like Claude Code and codex when users tab away briefly. The desktop banner becomes the explicit return path with a 'Restore' button, and a new 'mobileAutoRestoreFitMs' setting (settable from both desktop preferences and the mobile app via terminal.setAutoRestoreFit / .getAutoRestoreFit RPCs) lets users opt into a wall-clock auto-restore (1m / 5m / 30m). See docs/mobile-fit-hold.md for the full design. Co-authored-by: Orca <help@stably.ai>
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.
Why
When the mobile app leaves a terminal (tab swap, app background, lock screen), the PTY currently restores to desktop dims ~300ms later. For TUI apps like Claude Code and codex this fires an expensive reflow that disrupts the on-screen UI even though the user is coming right back. Users want the terminal to stay at phone size, with an explicit way back to desktop.
What
mobileAutoRestoreFitMssetting onGlobalSettings(number | null).null= Indefinite. Finite values (clamped server-side to [5s, 60min]) schedule a wall-clock restore that long after the last unsubscribe.terminal.*namespace:terminal.getAutoRestoreFitandterminal.setAutoRestoreFit.See
docs/mobile-fit-hold.mdfor the full design (3-iteration design review).Notable runtime semantics
reclaimTerminalForDesktopwidened: handles both the active-subscriber path (existing) and the held-no-subscriber path (resolves restore target via the override's snapshotted baseline;applyLayoutremains the sole writer ofterminalFitOverrides).finite → nullcancels every pending restore timer;null → finitedoes NOT retroactively schedule timers for already-held PTYs (the new value applies to the next unsubscribe).Tests
8 new tests in
mobile-subscribe-integration.test.tscovering: indefinite hold, finite-delay auto-restore, re-subscribe-cancels, manual reclaim of held PTY, finite→null clears all timers, null→finite no retro-scheduling, and clamp behavior. Updated 2 mock stores (mobile-subscribe-integration,mobile-presence-lock) and 2 codex-accounts test fixtures for the new field. All 48 mobile-related tests pass;tc:nodeandtc:webclean.Made with Orca 🐋