Skip to content

fix(mobile): open Grok, OpenCode, OMP and Pi chats on the phone - #27212

Merged
brennanb2025 merged 15 commits into
mainfrom
brennanb2025/mobile-opens-all-native-chat-agents
Oct 11, 2026
Merged

brennanb2025 merged 15 commits into
mainfrom
brennanb2025/mobile-opens-all-native-chat-agents

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 17 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​393 $\color{#cf222e}{\Huge{\mathbf{−}}}$​55 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​338
Prod 24 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​116 $\color{#cf222e}{\Huge{\mathbf{−}}}$​46 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​70

ELI5

On desktop you can chat with six agents in Orca's chat view: Claude, Codex, Grok, OpenCode, OMP and Pi. On the phone only Claude and Codex chats opened. A Grok, OpenCode, OMP or Pi chat showed in the phone's tab list as "Update to view" with a blank pane, even on the newest phone build. This PR makes the phone open all six.

What Changed

Before: a Grok/OpenCode/OMP/Pi chat tab on the phone was titled "Update to view" and showed nothing. Updating the app didn't help, because no phone build could open them.

After: those chats open on the phone like Claude and Codex chats. You can:

  • read the transcript and send messages;
  • use slash commands, including /clear and /compact;
  • stop the agent;
  • answer its approval and question cards, including Pi's yes/no, pick-one, one-line-input and multi-line-editor dialogs.

The image button shows only where the chat's agent takes images (OpenCode, Pi, Claude, Codex yes; Grok and OMP no), and both the phone and the desktop now get that answer from the same place. Starting one of these agents from the phone's "+" opens the new chat tab right away.

Why it was broken, at two layers:

  1. The host hid the tabs. The desktop host only sends another agent's chat to a client that says it can render the host's agents. That is the agent-session.structured.registered-agents.v1 capability, plus agent-session.structured.pi-dialogs.v1 for Pi. The phone advertised neither, so the host retitled those tabs "Update to view" (session-tab-agent-status-projection.ts).
  2. The phone would have refused them anyway. Its chat resolver accepted chat tabs only for Claude and Codex (isAgentSessionHandleProvider). Its send and slash-command paths narrowed every chat's agent to claude, or else codex.

What changed:

  • Phone capabilities (mobile-runtime-client-capabilities.ts): the phone advertises registered-agents, pi-dialogs and agent-session.options.optional-model.v1, so the host sends these tabs as they are. The third one matters because Grok/OpenCode/OMP often report no current model. Without it the host refused the options read, and /clear, /compact and the model picker went missing.
  • Opening chats (mobile-native-chat-eligibility.ts): a chat tab opens for any agent id the host lists (isStructuredAgentId), not only the two built-ins. Chat tabs replay the host's journal through the shared reducer, so no per-agent transcript code is needed.
  • Sending (use-mobile-native-chat-controller.ts, use-mobile-structured-send-with-outcome.ts): the chat's real agent is passed to the shared composer. A /review in an OpenCode chat is now a message to OpenCode, not a Codex host command.
  • Image attach: one answer, from the chat's own options report.
    • Host change: agentSession.options, the per-chat report both clients already read for the model picker, /clear, /compact and rewind, now carries an optional acceptsImages true/false (structured-agent-session-options-read.ts, type in agent-session-wire.ts). It comes from the agent's registered capability. For a running Grok/OpenCode/OMP agent it is also ANDed with what the agent announced when it started (acpSessionAcceptsImages, the same rule the host uses when it actually sends a prompt, so the button and the send can't disagree). Reading it starts nothing and sends nothing new to the agent.
    • Phone: the attach button follows that field, remembered per chat. Until the report arrives, or from an older host that doesn't send it, the phone keeps today's rule: images for Claude and Codex only.
    • Desktop: the composer's image gate uses the same field. While a new chat is still starting (desktop doesn't read options then) or on an older remote server, it falls back to the host's agent list, as before.
    • An earlier version of this PR had the phone fetch the host's whole agent list for this (an extra request, a per-connection cache, a "host refused" latch, and a new entry in the host's phone allowlist). All of that is gone; the phone allowlist is unchanged from main.
  • Launching (mobile-existing-agent-launch.ts): the phone reserves the new chat's id for every agent, as it already did for Claude/Codex. The new tab is found as soon as it appears, instead of after the launch reply.
  • Composer:
    • The model pill now shrinks and truncates, so Send stays on screen on narrow phones. Phone QA caught a long Pi model label pushing Send off the row.
    • The "/" menu gets the chat's commands even when the agent lists no models. OMP at rest was missing /clear and /compact.
  • Cards:
    • A card's X (stop the turn) is offered only while a turn is running. Outside a turn it could only fail with "Stop not sent".
    • A declared one-line input (Pi's input dialog) draws as one line, as on desktop.

Why

Two options were considered for opening the chats:

  • A phone-only special case per agent. That means adding Grok, then OpenCode, then OMP to a list. It repeats the Claude/Codex narrowing that caused the bug, and every new desktop agent would need another phone change.
  • Read what the host says (chosen). The phone renders whatever agents the host lists. Per-agent differences come from the host's own records and each chat's options report: images, which slash commands the host handles, compact/clear. A future desktop agent works on the phone with no phone change, unless it brings a new card shape that needs its own capability, as Pi's dialogs did.

For images, the per-chat options report was chosen over a separate agent-list read because the host already owns the answer and already sends that report for every chat. The client keeps no second copy, there is no extra request or cache, and for a running agent the answer matches what the host will actually accept.

Mixed versions:

  • New phone, older host. An older host ignores the new capability strings and sends no acceptsImages. The phone falls back to the built-in rule (images only for Claude/Codex).
  • Older phone or older desktop, new host. The new field is optional and ignored. Older phones advertise none of the new capabilities, so they keep seeing "Update to view" until they update.
  • New desktop, older remote server. No field, so desktop uses the agent list exactly as on main.

Differences from desktop, each labelled:

  • Temporary: with a desktop host released before this PR, OpenCode/Pi chats on the phone have no image button, because those hosts don't send acceptsImages. It goes away when the host updates.
  • Intended: the X on a card is hidden when no turn is running. Desktop shows it, but it sends a cancel without a turn id, which the host's cancel schema rejects. There is no working behavior to match yet. Cancelling a Pi dialog outside a turn needs a host + desktop follow-up.

Linked Issue

N/A (maintainer change; found during phone QA of the Grok background-stop work).

Visual Proof

Android emulator on a separate test Mac, paired to a desktop dev build of this branch (3cad0345e44). Real agents, signed in on that Mac: Grok 1.0.50, OpenCode 2.0.21, Claude 2.1.296 and Codex. Every reply below is from the real agent. Pi and OMP were not tested with real agents: Pi isn't signed in on any test machine, and OMP is signed in only on a Windows machine that has no phone emulator. Their screenshots from the earlier round (stand-in programs) are no longer shown.

Before (phone code from main, real agents on the host):

Tab list Grok chat
Tab titled Update to view Grok chat blank, Update to view

After (this branch):

Grok: opens, real reply, no image button Grok "/" menu "+" new Grok chat, real reply
Grok chat with real reply Grok slash menu New Grok chat reply
OpenCode: phone send, real reply, image button OpenCode: image attached on the phone Same chat on desktop: OpenCode describes the phone's image
OpenCode reply OpenCode image attached Desktop OpenCode chat with zebra reply
Claude: opens, real reply, image button Codex: phone send, real reply, image button
Claude chat Codex reply

Testing

  • Phone emulator QA with real agents (Grok, OpenCode, Claude, Codex), at 3cad0345e44:

    • tabs named per agent, no "Update to view"; history from desktop shows;
    • a phone send gets a real reply in all four, and it appears on desktop;
    • image button: Grok hidden, OpenCode/Claude/Codex shown, checked at 0, 5 and 15 s with no flicker;
    • "/" menu matches desktop (/model, /effort, /clear, /compact; Codex also /goal); model pill right and Send on screen;
    • an image attached on the phone reached the real OpenCode, which described it;
    • "+" creates a new Grok chat that opens selected and replies.
  • Not verified with real agents: Pi (including its dialog cards) and OMP. An earlier round checked them with stand-in programs only. The desktop composer's image gate was not checked by hand: desktop's attach button is a general "attach file" button for every agent, so there is no per-agent button to compare; it is covered by unit tests.

  • Unit tests: the host's options report (definition, running agent can only narrow it, unregistered agent false), the ACP rule shared by the report and the send, the phone's per-chat answer (true/false/absent, a model pick during the read, switching chats), and the desktop gate (the report reaches the composer; checked to fail with the hookup removed). Mobile src/session and src/transport pass apart from one known local failure, mobile-e2ee-v2-client-session (a btoa spy on local Node 26.5), unrelated.

  • Checks: the mobile test-typecheck ratchet and the host's phone RPC allowlist test pass. orca-ci-checks passes apart from a known local-only no-cycle false red in untouched mobile files. CI is green on 3cad0345e44.

  • I manually tested these changes locally (phone QA ran on a separate test Mac, see Visual Proof)

  • Automated tests added/updated, or explained why not below

Review

Reviewed in a multi-round loop with an architecture check each pass (verdict: keep this design, no split). The second pass moved "takes images" into the per-chat options report. Status comment below.

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

  • Platforms: mobile on iOS and Android, no platform-specific code. The host change is one optional field on the per-chat options report.
  • SSH / remote servers: the answer is computed by the host that runs the chat, which is also the host that sends the prompt, so SSH-backed and remote-server chats get the right answer the same way.
  • Performance: no new requests. The field rides on the options read each chat already makes, and computing it reuses the agent's start-up answer.

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)

The phone advertised only the Claude chat lane, so the host retitled every
other agent's chat tab 'Update to view' and the phone's resolver refused
non-Claude/Codex chat tabs anyway. Mobile now reads any agent the host
lists, passes the chat's real agent to its send and slash-command paths,
advertises the registered-agents and Pi dialog capabilities, hides image
attach for agents the host says take none (as desktop does), and draws
Pi's input dialog as one line.
Grok, OpenCode and OMP can report no current model, and a chat at rest may
have none saved. The host refuses those reports to clients that don't
advertise agent-session.options.optional-model.v1, which left the phone's
model picker on its seed list and dropped /clear and /compact.
The phone matches a launched chat tab only by its session id, which it
minted only for Claude and Codex. A Grok, OpenCode, OMP or Pi chat started
from + landed only once the host replied, and a lost reply read as
"Couldn't confirm the agent started" even with the chat listed. Hosts
accept an agent-named id for any agent and ignore it for a terminal launch.
…a failure

Every session-screen mount asked agentSession.agents again, so the attach
button popped in late for OpenCode and Pi, and a read that failed while
connected was never retried. Share one read per client, drop it on
disconnect, and forget a failed read so the next chat asks again.
…ting

The send-bridge test passed with the claude/codex narrowing reverted. Drive
an OpenCode chat through the controller and the structured session's send,
where /review is the agent's own command but Codex's host claims it, and
check the overlay offers attach only when the agent takes images.
The X on a structured prompt card stops its turn. Pi opens dialogs outside
a turn too, and tapping X there could only say "Stop not sent". Claude and
Codex cards arrive inside a running turn, so they keep their X.
The phone now asks agentSession.agents to decide whether a chat's agent
takes images, but the mobile allowlist refused the method, so OpenCode and
Pi never got an attach button. It returns only each agent's id and its
fixed capability record.
Released hosts advertise registered agents but refuse agentSession.agents
to phones (forbidden, not available to mobile clients). Treat that answer
as no list until the next connection instead of re-asking on every chat;
keep retrying transient failures.
…oser row

On a narrow phone, attach + a long model label + mic left no room for Send
(seen with Pi's resting label). The pill's slot is now the row's only
shrinkable item, so its label truncates and the buttons keep their size.
Rows that already fit look the same.
… models

The phone dropped a structured chat's option controller when its picker had
nothing to show, and the / menu reads the chat's conversation commands from
that controller. OMP lists no models, so its menu lost /clear and /compact.
Keep the controller for every structured chat; the picker still renders
nothing without a model.
@brennanb2025

brennanb2025 commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor Author

Review status: ready for a maintainer look (head 3cad0345e44, CI green)

Updated after a second review pass. It moved "this chat takes images" into the chat's own options report, and re-ran the phone QA with real agents.

The problem. On the phone, any Grok, OpenCode, OMP or Pi chat showed up as a tab titled "Update to view" with an empty pane. Only Claude and Codex chats opened, and updating the phone app didn't help.

  • First cause: the phone never told the desktop it could show those agents, so the desktop hid them.
  • Second cause: the phone's own code only accepted Claude and Codex chats.

What changes for users. All six desktop chat agents open on the phone. You can read the history, send, use slash commands, stop the agent, and answer approval and question cards, including Pi's dialogs. The image button shows only where the agent takes images: OpenCode, Pi, Claude and Codex do; Grok and OMP don't. Starting one of these agents from the phone's "+" opens its chat tab right away.

Design change in the second pass. The first version had the phone fetch the desktop's whole agent list just to decide on the image button. That meant an extra request, a cache per connection, a "the desktop refused" latch, and a new entry in the desktop's list of requests phones may make. Now each chat's options report (the one both apps already read for the model picker, /clear and /compact) says whether that chat takes images. The desktop host fills it in from the agent's capabilities. For a running Grok/OpenCode/OMP agent it also checks what the agent announced at start, the same check the host uses when it actually sends, so the button and the send can't disagree. The phone and the desktop composer both read it. The extra request, cache, latch and allowlist entry are gone. An independent design check and two fresh reviewers found the new design no worse than the old in any case, including mixed app versions.

Fixed during review (pass 1, four rounds):

  • Missing /clear, /compact and model picker for agents that report no current model. The phone now says it can handle a missing model.
  • "/" menu without /clear and /compact for OMP at rest.
  • Send button pushed off the screen in a Pi chat by a long model name. The model name now shrinks.
  • New chats from "+" opening late. The phone now reserves the chat's id up front for every agent.
  • "Stop not sent" from a card's X outside a turn. The X is now shown only while the agent is working.
  • Tests that passed even without the fix. They now fail when the fix is removed.
  • (The image-button refusal and per-screen agent-list fixes from pass 1 no longer apply: that code was removed in pass 2.)

Deferred (not this PR):

  • Older desktops: no image button for OpenCode/Pi chats on the phone. Desktops released before this PR don't send the new field, so the phone keeps its old rule (Claude/Codex only). The gap closes when the desktop updates.
  • Cancelling a Pi dialog when no turn is running. It doesn't work on desktop either (the host rejects that cancel). Needs a host + desktop follow-up.
  • OMP /model with no models does nothing on the phone. Predates the PR; the PR made it reachable.
  • Raw phone id on desktop ("Answered on " after answering a Pi dialog from the phone). Probably not this PR.
  • Small timing cases, all fall back safely:
    • on desktop, picking a model during a chat's very first options read falls back to the agent list until the next read (the same race already affects /compact on main);
    • on the phone, a failed options read leaves OpenCode/Pi without the image button for that view;
    • an OpenCode chat's image button appears once its agent has finished starting.

Verified:

  • Phone on an Android emulator with REAL agents (separate test Mac, desktop dev build at 3cad0345e44; real Grok 1.0.50, OpenCode 2.0.21, Claude 2.1.296 and Codex, each signed in on that Mac):
    • Before, on the phone code from main: Grok and OpenCode tabs showed "Update to view" with empty panes.
    • After: tabs named per agent; each chat shows its desktop history; a phone send got a real reply from all four.
    • Image button: hidden for Grok; shown for OpenCode, Claude and Codex. Checked at 0, 5 and 15 s, with no flicker.
    • An image attached on the phone reached the real OpenCode, which described it correctly.
    • The "/" menus match desktop. The model pills are right, and Send is on screen.
    • "+" opens a new Grok chat that replies.
    • Screenshots are in the PR body.
  • Automated: host, ACP, phone and desktop tests (each new one checked to fail with its fix removed), the phone test-typecheck ratchet, the phone allowlist test, repo checks; CI green on 3cad0345e44.
  • Review: design check (keep), two fresh reviewers and a readiness pass, with no blocking findings.
  • main still merges cleanly (test merge, not pushed).

Not verified:

  • Pi and OMP with real agents. Pi isn't signed in on any test machine (its provider accounts need re-authentication). OMP is signed in only on a Windows test machine that has no phone emulator. Pi's dialog cards were checked only with stand-in programs in pass 1.
  • The desktop composer's image gate by hand. Desktop's attach button is a general "attach file" button shown for every agent, so there is no per-agent button to compare. Unit tests cover it.
  • No iOS run; the layout code isn't platform-specific.
  • Phone against an older released desktop was checked by reading code, not run live.
  • Side effect of the real-agent QA: the real Codex on the test Mac added a "trusted project" entry for the test folder to its own config, as Codex does on first use of a folder.

@brennanb2025
brennanb2025 marked this pull request as ready for review October 11, 2026 17:31
@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a6eac684-a80c-44d7-9c61-ae7ace9bdf7b


📥 Commits

Reviewing files that changed from the base of the PR and between 954eb96 and 3cad034.



📒 Files selected for processing (19)
  • mobile/src/session/mobile-native-chat-controller-contract.ts
  • mobile/src/session/use-mobile-native-chat-controller.test.ts
  • mobile/src/session/use-mobile-structured-agent-options.test.ts
  • mobile/src/session/use-mobile-structured-agent-options.ts
  • src/main/acp/acp-prompt-content.ts
  • src/main/acp/acp-structured-image-prompts.test.ts
  • src/main/acp/acp-structured-options.ts
  • src/main/acp/acp-structured-session-adapter.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-options-read.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-registered-definition.test.ts
  • src/renderer/src/components/native-chat/structured-agent-registered-agent-surface.test.ts
  • src/renderer/src/components/native-chat/use-native-chat-structured-composer-transport.test.tsx
  • src/renderer/src/components/native-chat/use-native-chat-structured-composer-transport.ts
  • src/renderer/src/components/native-chat/use-structured-agent-session-option-state.ts
  • src/renderer/src/components/native-chat/use-structured-agent-session-options.test.tsx
  • src/renderer/src/components/native-chat/use-structured-agent-session-options.ts
  • src/renderer/src/components/native-chat/use-structured-agent-session.ts
  • src/renderer/src/runtime/use-host-structured-agent.ts
  • src/shared/agent-session-wire.ts


🚧 Files skipped from review as they are similar to previous changes (2)
  • mobile/src/session/mobile-native-chat-controller-contract.ts
  • mobile/src/session/use-mobile-native-chat-controller.test.ts


Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.




📝 Walkthrough
📝 Walkthrough

Walkthrough

Mobile structured chat now routes using structured agent IDs and reserves session IDs for structured agents. Session options report image acceptance, which flows through mobile and renderer state to the composer and controls whether image attachment is available. The changes also update mobile text-input defaults, option-picker layout, prompt cancellation, and advertised runtime capabilities.



Priority: ➖ Normal

Merge Risk: 🔵 Low · up to 3cad0

After reconnecting, an active chat may retain stale image-attachment availability. This is a bounded issue to confirm or accept before merging.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 46 functions across 54 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title clearly and concisely describes the primary change: enabling mobile chats for Grok, OpenCode, OMP, and Pi.
Description check Passed The description is comprehensive and follows the template. It explains the user impact, implementation, rationale, linked-issue exception, visual proof, testing, known limitations, compatibility, and …

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR



  • 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1901f6c9-cd0c-4add-83eb-1b6406d15fa4
📥 Commits

Reviewing files that changed from the base of the PR and between 3c71318 and 954eb96.

📒 Files selected for processing (39)
  • mobile/src/session/MobileNativeChatOverlay.test.ts
  • mobile/src/session/MobileNativeChatOverlay.tsx
  • mobile/src/session/MobileNativeChatQuestion.test.tsx
  • mobile/src/session/MobileNativeChatQuestion.tsx
  • mobile/src/session/MobileNativeChatSessionOptionPickers.test.ts
  • mobile/src/session/MobileNativeChatSessionOptionPickers.tsx
  • mobile/src/session/mobile-existing-agent-launch.ts
  • mobile/src/session/mobile-native-chat-controller-contract.ts
  • mobile/src/session/mobile-native-chat-eligibility.test.ts
  • mobile/src/session/mobile-native-chat-eligibility.ts
  • mobile/src/session/mobile-native-chat-merged-snapshot-parity-hooks.test.tsx
  • mobile/src/session/mobile-session-route-types.ts
  • mobile/src/session/mobile-structured-agent-session-contract.ts
  • mobile/src/session/mobile-structured-agent-session-host-support.test.ts
  • mobile/src/session/mobile-structured-agent-session-host-support.ts
  • mobile/src/session/use-mobile-native-chat-controller.test.ts
  • mobile/src/session/use-mobile-native-chat-controller.ts
  • mobile/src/session/use-mobile-native-chat-prompt-cards.ts
  • mobile/src/session/use-mobile-native-chat-session-option-controller.test.ts
  • mobile/src/session/use-mobile-native-chat-session-option-controller.ts
  • mobile/src/session/use-mobile-session-terminal-create-agent-launch.test.ts
  • mobile/src/session/use-mobile-structured-agent-accepts-images.test.ts
  • mobile/src/session/use-mobile-structured-agent-accepts-images.ts
  • mobile/src/session/use-mobile-structured-agent-session-prompt-cancel.test.tsx
  • mobile/src/session/use-mobile-structured-agent-session-queued.test-fixture.ts
  • mobile/src/session/use-mobile-structured-agent-session-send.test.tsx
  • mobile/src/session/use-mobile-structured-agent-session.ts
  • mobile/src/session/use-mobile-structured-native-chat-send-bridge.test.ts
  • mobile/src/session/use-mobile-structured-native-chat-send-bridge.ts
  • mobile/src/session/use-mobile-structured-send-with-outcome.ts
  • mobile/src/session/use-mobile-structured-turn-indicator.test.tsx
  • mobile/src/transport/mobile-runtime-client-capabilities.test.ts
  • mobile/src/transport/mobile-runtime-client-capabilities.ts
  • src/main/runtime/mobile-rpc-allowlist.test.ts
  • src/main/runtime/rpc/methods/structured-agent-session-optional-model-capability.test.ts
  • src/main/runtime/runtime-rpc/runtime-rpc-mobile-agent-session-methods.ts
  • src/renderer/src/components/native-chat/structured-agent-registered-agent-surface.test.ts
  • src/renderer/src/runtime/use-host-structured-agent.ts
  • src/shared/agent-session-registered-agents.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

Comment on lines +42 to +46
client.onStateChange((state) => {
if (state !== 'connected') {
created.read = null
created.agents = null
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Refresh registered agents after reconnect.

When the connection leaves connected, this callback clears the cache but does not trigger a new read. The effect depends only on agent, client, and hostListsAgents. If those values stay the same after reconnect, the active chat keeps its old listed result, or keeps image attachment unavailable if the first read was interrupted. Clear the hook’s retained result and start a read when the connection returns.

The host's options read now carries acceptsImages for every session: the
agent definition's imagePrompts, narrowed by a running ACP child to what
its initialize advertised (the same rule its sends use). Absent means an
older host.
…eport

The phone no longer reads the host's agent list for the attach button. It
takes acceptsImages from the agentSession.options read it already makes,
keyed to the chat, and kept through a pick made during that read. Before
the read answers, and from an older host, Claude and Codex keep attach and
other agents don't, as before. Drops the agent-list hook with its cache and
refusal latch, the host-support flag only it used, and agentSession.agents
from the host's mobile allowlist.
…ons report

The composer's image gate takes the session's acceptsImages answer first,
falling back to the host's agent list before the options read lands (a
new chat's start) and for an older host that sends no answer. With the
phone no longer using it, structuredAgentAcceptsImages moves back to the
renderer, where it was.
@brennanb2025
brennanb2025 merged commit 28d07a6 into main Oct 11, 2026
31 checks passed
brennanb2025 added a commit that referenced this pull request Oct 15, 2026
* fix(mobile): open Grok, OpenCode, OMP and Pi chats on the phone

The phone advertised only the Claude chat lane, so the host retitled every
other agent's chat tab 'Update to view' and the phone's resolver refused
non-Claude/Codex chat tabs anyway. Mobile now reads any agent the host
lists, passes the chat's real agent to its send and slash-command paths,
advertises the registered-agents and Pi dialog capabilities, hides image
attach for agents the host says take none (as desktop does), and draws
Pi's input dialog as one line.

* test(mobile): drive the agents read through the shared fake client

* fix(mobile): read options reports with no model

Grok, OpenCode and OMP can report no current model, and a chat at rest may
have none saved. The host refuses those reports to clients that don't
advertise agent-session.options.optional-model.v1, which left the phone's
model picker on its seed list and dropped /clear and /compact.

* fix(mobile): reserve the chat session for every launched agent

The phone matches a launched chat tab only by its session id, which it
minted only for Claude and Codex. A Grok, OpenCode, OMP or Pi chat started
from + landed only once the host replied, and a lost reply read as
"Couldn't confirm the agent started" even with the chat listed. Hosts
accept an agent-named id for any agent and ignore it for a terminal launch.

* fix(mobile): read the host's agents once per connection, retry after a failure

Every session-screen mount asked agentSession.agents again, so the attach
button popped in late for OpenCode and Pi, and a read that failed while
connected was never retried. Share one read per client, drop it on
disconnect, and forget a failed read so the next chat asks again.

* test(mobile): pin the chat's own agent on the send path and attach gating

The send-bridge test passed with the claude/codex narrowing reverted. Drive
an OpenCode chat through the controller and the structured session's send,
where /review is the agent's own command but Codex's host claims it, and
check the overlay offers attach only when the agent takes images.

* fix(mobile): offer a card's X only while a turn is running

The X on a structured prompt card stops its turn. Pi opens dialogs outside
a turn too, and tapping X there could only say "Stop not sent". Claude and
Codex cards arrive inside a running turn, so they keep their X.

* fix(runtime): let a phone read the host's registered agents

The phone now asks agentSession.agents to decide whether a chat's agent
takes images, but the mobile allowlist refused the method, so OpenCode and
Pi never got an attach button. It returns only each agent's id and its
fixed capability record.

* fix(mobile): keep a host's refusal of the agents list for the connection

Released hosts advertise registered agents but refuse agentSession.agents
to phones (forbidden, not available to mobile clients). Treat that answer
as no list until the next connection instead of re-asking on every chat;
keep retrying transient failures.

* fix(mobile): shrink the model pill before it pushes Send off the composer row

On a narrow phone, attach + a long model label + mic left no room for Send
(seen with Pi's resting label). The pill's slot is now the row's only
shrinkable item, so its label truncates and the buttons keep their size.
Rows that already fit look the same.

* fix(mobile): keep /clear and /compact for a chat whose agent lists no models

The phone dropped a structured chat's option controller when its picker had
nothing to show, and the / menu reads the chat's conversation commands from
that controller. OMP lists no models, so its menu lost /clear and /compact.
Keep the controller for every structured chat; the picker still renders
nothing without a model.

* feat(runtime): say in a chat's options report whether it takes images

The host's options read now carries acceptsImages for every session: the
agent definition's imagePrompts, narrowed by a running ACP child to what
its initialize advertised (the same rule its sends use). Absent means an
older host.

* refactor(mobile): read whether a chat takes images from its options report

The phone no longer reads the host's agent list for the attach button. It
takes acceptsImages from the agentSession.options read it already makes,
keyed to the chat, and kept through a pick made during that read. Before
the read answers, and from an older host, Claude and Codex keep attach and
other agents don't, as before. Drops the agent-list hook with its cache and
refusal latch, the host-support flag only it used, and agentSession.agents
from the host's mobile allowlist.

* refactor(native-chat): gate desktop chat images on the session's options report

The composer's image gate takes the session's acceptsImages answer first,
falling back to the host's agent list before the options read lands (a
new chat's start) and for an older host that sends no answer. With the
phone no longer using it, structuredAgentAcceptsImages moves back to the
renderer, where it was.

* test(native-chat): prove the session's image answer reaches the composer gate

(cherry picked from commit 28d07a6)
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.

1 participant