Repository navigation
fix(mobile): open Grok, OpenCode, OMP and Pi chats on the phone - #27212
Conversation
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.
Review status: ready for a maintainer look (head
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: 🔵 Low · up to 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 |
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
1901f6c9-cd0c-4add-83eb-1b6406d15fa4
📒 Files selected for processing (39)
mobile/src/session/MobileNativeChatOverlay.test.tsmobile/src/session/MobileNativeChatOverlay.tsxmobile/src/session/MobileNativeChatQuestion.test.tsxmobile/src/session/MobileNativeChatQuestion.tsxmobile/src/session/MobileNativeChatSessionOptionPickers.test.tsmobile/src/session/MobileNativeChatSessionOptionPickers.tsxmobile/src/session/mobile-existing-agent-launch.tsmobile/src/session/mobile-native-chat-controller-contract.tsmobile/src/session/mobile-native-chat-eligibility.test.tsmobile/src/session/mobile-native-chat-eligibility.tsmobile/src/session/mobile-native-chat-merged-snapshot-parity-hooks.test.tsxmobile/src/session/mobile-session-route-types.tsmobile/src/session/mobile-structured-agent-session-contract.tsmobile/src/session/mobile-structured-agent-session-host-support.test.tsmobile/src/session/mobile-structured-agent-session-host-support.tsmobile/src/session/use-mobile-native-chat-controller.test.tsmobile/src/session/use-mobile-native-chat-controller.tsmobile/src/session/use-mobile-native-chat-prompt-cards.tsmobile/src/session/use-mobile-native-chat-session-option-controller.test.tsmobile/src/session/use-mobile-native-chat-session-option-controller.tsmobile/src/session/use-mobile-session-terminal-create-agent-launch.test.tsmobile/src/session/use-mobile-structured-agent-accepts-images.test.tsmobile/src/session/use-mobile-structured-agent-accepts-images.tsmobile/src/session/use-mobile-structured-agent-session-prompt-cancel.test.tsxmobile/src/session/use-mobile-structured-agent-session-queued.test-fixture.tsmobile/src/session/use-mobile-structured-agent-session-send.test.tsxmobile/src/session/use-mobile-structured-agent-session.tsmobile/src/session/use-mobile-structured-native-chat-send-bridge.test.tsmobile/src/session/use-mobile-structured-native-chat-send-bridge.tsmobile/src/session/use-mobile-structured-send-with-outcome.tsmobile/src/session/use-mobile-structured-turn-indicator.test.tsxmobile/src/transport/mobile-runtime-client-capabilities.test.tsmobile/src/transport/mobile-runtime-client-capabilities.tssrc/main/runtime/mobile-rpc-allowlist.test.tssrc/main/runtime/rpc/methods/structured-agent-session-optional-model-capability.test.tssrc/main/runtime/runtime-rpc/runtime-rpc-mobile-agent-session-methods.tssrc/renderer/src/components/native-chat/structured-agent-registered-agent-surface.test.tssrc/renderer/src/runtime/use-host-structured-agent.tssrc/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.
| client.onStateChange((state) => { | ||
| if (state !== 'connected') { | ||
| created.read = null | ||
| created.agents = null | ||
| } |
There was a problem hiding this comment.
🎯 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.
* 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)
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:
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:
agent-session.structured.registered-agents.v1capability, plusagent-session.structured.pi-dialogs.v1for Pi. The phone advertised neither, so the host retitled those tabs "Update to view" (session-tab-agent-status-projection.ts).isAgentSessionHandleProvider). Its send and slash-command paths narrowed every chat's agent toclaude, or elsecodex.What changed:
mobile-runtime-client-capabilities.ts): the phone advertises registered-agents, pi-dialogs andagent-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.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.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/reviewin an OpenCode chat is now a message to OpenCode, not a Codex host command.agentSession.options, the per-chat report both clients already read for the model picker, /clear, /compact and rewind, now carries an optionalacceptsImagestrue/false (structured-agent-session-options-read.ts, type inagent-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.main.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.inputdialog) draws as one line, as on desktop.Why
Two options were considered for opening the chats:
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:
acceptsImages. The phone falls back to the built-in rule (images only for Claude/Codex).main.Differences from desktop, each labelled:
acceptsImages. It goes away when the host updates.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):After (this branch):
Testing
Phone emulator QA with real agents (Grok, OpenCode, Claude, Codex), at
3cad0345e44: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/sessionandsrc/transportpass apart from one known local failure,mobile-e2ee-v2-client-session(abtoaspy on local Node 26.5), unrelated.Checks: the mobile test-typecheck ratchet and the host's phone RPC allowlist test pass.
orca-ci-checkspasses apart from a known local-onlyno-cyclefalse red in untouched mobile files. CI is green on3cad0345e44.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
Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)