Repository navigation
fix(native-chat): show why the chat composer is locked and offer Take back when a phone holds the input - #30199
Merged
Merged
Conversation
…back when a phone holds the input
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 7 minutes. View limit details
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 |
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.
ELI5
When your phone is driving a terminal, the desktop can't type into it. In terminal view you see a "Your phone is in control" box with a Take back button. In chat view you saw nothing: the message box just stopped responding, and the only way out was to switch back to terminal view. Chat view now tells you why the box is locked and gives you the same Take back button.
What Changed
Before, when a phone held the input of a chat-view terminal:
disabled:, which never matches the rich-text editor (acontenteditablediv, not a form control). The box looked normal.After:
restoreTerminalFitToDesktopreclaim the terminal overlay uses, then refits the panes, as the overlay does. Local and remote/SSH terminals go through that one path (IPC locally,terminal.restoreFitRPC for remote runtimes).[&[contenteditable=false]]:, which matches the attribute TipTap sets when it isn't editable.Mechanism: a new
useNativeChatMobileHoldNotice(ptyId, canSend)hook, called fromNativeChatComposerfor terminal-backed chats only (structured sessions have no phone floor). It adds adevicenotice ahead of the composer's own notices.canSendis still the existing driver-state signal, so nothing new decides when the box is locked.Why
components.native-chat.composer.lockedand the overlay's "Take back").Linked Issue
Fixes #30179
Visual Proof
After: a held floor with a draft in the box. The notice and Take back show, and the draft is dimmed (computed style on the editor:
opacity: 0.5,cursor: not-allowed,contenteditable="false").Before: the same state showed only the draft at full opacity, with no notice and no button.
Testing
native-chat-composer-mobile-hold.test.tsx(new). It checks that the notice and Take back render with a draft and goal mode on, that the editor's dim classes key offcontenteditable=false(this test fails on main), and that the hook callsrestoreTerminalFitToDesktop(ptyId, settings), blocks a second click while pending, refits only when something was reclaimed, and shows nothing when the composer can send or has no pty.src/renderer/src/components/native-chatfolder run on a single worker: 376 files, 4058 tests pass.pnpm tcpasses.check:code-quality:changedpasses (design system, React Doctor, casting: 0 new findings). Locally I ran the steps of the static-analysis job.Live, macOS only: background dev build (
ORCA_BACKGROUND_LAUNCH=1, isolated profile, window kept off screen). I mounted the realNativeChatComposerin the running renderer against a real shell pty. Then I set that pty's renderer driver tomobile, took a CDP screenshot and read the computed styles. Not verified live: a real phone taking the floor on a real agent session, and clicking Take back against a held main-side lock (unit tests cover the call; the main-side reclaim is unchanged). Not run on Linux, Windows or SSH. The change is renderer-only and goes through the same reclaim path the terminal already uses on those platforms.I manually tested these changes locally
Automated tests added/updated, or explained why not below
Review
Agent skill upstream boundary
Notes
Renderer only. No wire, mobile, or main-process change. The "still sized for your phone / Restore" state (phone gone, fit override left behind) is also hidden in chat view. It doesn't lock the composer, so it's out of scope here.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)