Skip to content

fix(native-chat): show why the chat composer is locked and offer Take back when a phone holds the input - #30199

Merged
nwparker merged 1 commit into
mainfrom
nwparker/chat-floor-take-back
Oct 18, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/chat-floor-take-back

Conversation

@nwparker

@nwparker nwparker commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​164 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​164
Prod 6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​79 $\color{#cf222e}{\Huge{\mathbf{−}}}$​8 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​71

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:

  • The only explanation was the empty-box placeholder ("Input is held by another device."). A half-written draft or goal mode hides that placeholder, so the box just went dead.
  • Chat view hides the terminal's phone overlay, and nothing in chat view could reclaim input.
  • The locked box was meant to look dimmed with a not-allowed cursor, but those styles used disabled:, which never matches the rich-text editor (a contenteditable div, not a form control). The box looked normal.

After:

  • The composer's notice card (the one already used for attachment and host messages) shows "Input is held by another device." with a Take back button, whatever the box holds. It goes away when input comes back.
  • Take back calls the same restoreTerminalFitToDesktop reclaim 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.restoreFit RPC for remote runtimes).
  • The editor now dims and shows a not-allowed cursor through [&[contenteditable=false]]:, which matches the attribute TipTap sets when it isn't editable.

Mechanism: a new useNativeChatMobileHoldNotice(ptyId, canSend) hook, called from NativeChatComposer for terminal-backed chats only (structured sessions have no phone floor). It adds a device notice ahead of the composer's own notices. canSend is still the existing driver-state signal, so nothing new decides when the box is locked.

Why

  • I reused the existing notice card and its action slot instead of bringing the terminal overlay into chat view. The overlay is a pane-centered dialog sized for the terminal, and it would sit over the transcript. The card sits right above the box that's locked, which is where the user is looking.
  • I reused the terminal's reclaim call instead of adding a chat-specific path, so there's no new floor protocol and no wire change. Main already treats an explicit Take back as a user command and always drops the lock ([Bug] Desktop claims phone is in charge even when phone is closed and not being used #28487 behavior unchanged).
  • Copy reuses the existing translated strings (components.native-chat.composer.locked and 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").

chat-composer-held-floor.png

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 off contenteditable=false (this test fails on main), and that the hook calls restoreTerminalFitToDesktop(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-chat folder run on a single worker: 376 files, 4058 tests pass.

  • pnpm tc passes. check:code-quality:changed passes (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 real NativeChatComposer in the running renderer against a real shell pty. Then I set that pty's renderer driver to mobile, 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

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

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

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1c22fd59-1762-4e8e-a37c-0a5e66504d31
📥 Commits

Reviewing files that changed from the base of the PR and between bbdbe72 and 97c9305.

📒 Files selected for processing: 7
  • src/renderer/src/components/native-chat/NativeChatComposer.tsx
  • src/renderer/src/components/native-chat/NativeChatComposerField.tsx
  • src/renderer/src/components/native-chat/NativeChatComposerNotices.tsx
  • src/renderer/src/components/native-chat/native-chat-composer-mobile-hold.test.tsx
  • src/renderer/src/components/native-chat/native-chat-composer-notice.ts
  • src/renderer/src/components/native-chat/use-native-chat-composer-notice.ts
  • src/renderer/src/components/native-chat/use-native-chat-mobile-hold-notice.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nwparker
nwparker merged commit 1e95c03 into main Oct 18, 2026
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Chat view composer locks with no visible reason and no Take back when a phone holds the input

1 participant