Skip to content

fix(native-chat): Codex async question cards on phone and desktop, one shared decision resolver - #25448

Closed
brennanb2025 wants to merge 39 commits into
mainfrom
brennanb2025/mobile-decision-cards-9142
Closed

brennanb2025 wants to merge 39 commits into
mainfrom
brennanb2025/mobile-decision-cards-9142

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 51 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​5799 $\color{#cf222e}{\Huge{\mathbf{−}}}$​34 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​5765
Prod 107 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​4531 $\color{#cf222e}{\Huge{\mathbf{−}}}$​464 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​4067

ELI5

When Codex asks you a question while it keeps working (its "async question"), the Orca phone app shows only the question as prose, with nothing to tap or answer. The desktop chat shows it as prose plus a raw tool row. This PR gives both a question card you can answer from either device. It also makes the phone and desktop decide which approval or question card to show with the same shared code, so the phone stops guessing at plan approvals from the terminal text.

What Changed

The problem.

  • Codex's request_user_input_async tool asks the user one or more questions and returns at once ({"accepted":true}), so Codex keeps working. The question stays open until the user replies.
  • Orca drops the questions when it reads Codex's history. Both the terminal transcript reader and the structured chat translator discard the tool's questions. The phone shows the prose and nothing to answer (Mobile omits Codex request_user_input_async decision cards #20073). The desktop shows the prose and a raw tool row.
  • Because Codex keeps working after asking, the question is usually far above the phone's 40-message window. So the question couldn't be found by scanning what the phone had loaded, not even with the fix the ticket proposed.
  • Separately, the phone and desktop each had their own copy of the code that turns an agent's "waiting on you" state into a card. On the phone, a text guess ran before the shared status envelope. For a Claude terminal plan approval, the guess could turn the plan's numbered steps into digit buttons that send digits to Claude's plan menu ([Bug]: Mobile App hangs when the agent presents a plan for review #24415, "the phone can't approve the plan").

What you see now.

Before After
Codex async question, phone Prose only; nothing to tap A card above the composer listing each open question: its title, the suggested choices, and a text field (a question with no choices is text-only). It appears however much Codex did after asking: on a fresh open, after a reconnect, without scrolling back
Codex async question, desktop chat Prose plus a raw request_user_input_async tool row The same card. While the card shows a question, its raw tool row and {"accepted":true} result fold away like other question rows. Without a card (an older host, a child agent's question) the row stays as today
Answering n/a Send (labelled Submit on desktop) posts your answers as an ordinary message (each question, then your answer). It goes straight into the turn Codex is running, the way Codex's own app delivers an answer, rather than waiting in the follow-up queue until the turn ends. Until Codex records it, each answered question shows what you sent and is held; Dismiss and any other open questions stay usable. If the send fails or is withdrawn, or Codex takes other input instead, your answers come back into the card. Dismiss hides the questions on this device only. The composer stays usable and your draft is never touched
When the card goes away n/a When the agent receives a later user message from any device or from the Codex terminal. An answer typed into Codex's own question editor removes only the questions it answers. The card stays across turn end, Stop, reconnects and switching between the terminal and chat views
Claude terminal plan approval, phone Plan steps could become numbered buttons The same approval card the desktop shows. Phone text guesses run only when nothing else applies, and never while the agent shows a prompt Orca can't read
A well-formed request of a kind this version doesn't know (only possible from a newer host) Phone: guessed buttons; desktop: Allow/Deny or nothing The request's text and one line, "This request needs a newer version of Orca.", with no Approve. A malformed prompt shows no card, as today
Structured chat approvals and questions Same cards, built by two copies of the code, in different orders Same cards, one shared mapping, journal order on both
Desktop terminal question/approval cards Could show from a stale live status after the agent moved on Shown from live status only while the agent is waiting, the rule the phone already used. A question still pending in the transcript still shows

No new notice, banner or toast. The only new text is the "newer version" line, the Dismiss label, and "n more questions in the transcript" (shown only for a pathologically large set, see below).

How it works.

  • One shared decision resolver (src/shared/native-chat-pending-decision.ts, native-chat-decision-envelope.ts). Desktop and phone both run it, for terminal and structured chats. It tells "no envelope" apart from "an envelope or subject this version can't read". An unreadable one is shown but never approvable, and it turns off every phone text guess. The phone's copy of the envelope parser is removed.
  • Async questions are worked out on the host that runs the agent, from Codex's whole history, by shared pure code (native-chat-async-questions.ts, native-chat-async-question-facts.ts):
    • Terminal chats: the transcript watcher tracks open questions as it reads the rollout file. A backward scan (transcript-async-question-boundary-scan.ts) finds questions asked since the last delivered user message. Its result is shared by every subscriber of the same file, so a reconnect costs only the bytes written since. If the scan fails, the host publishes no set (today's behaviour) and retries through the watcher's own read path, which never touches a stopped WSL distro.
    • Structured chats: the journal keeps the questions on the agent's message row. The status projection folds only the part after the last delivered user message, and only for Codex sessions.
    • The open set is published as a new optional side field on the replies and stream frames clients already receive. No client scans its loaded page. Nothing is stored: the set is recomputed from history. A delivered user message clears it, except a reply from Codex's question editor, which names the questions it answers and retires only those (the same keys Codex uses).
  • Answers go through each client's existing ordinary-message path: the phone's message send, the desktop terminal's per-pane send queue, and the desktop structured outbox. Whether an answer is still on its way is read from a record each client already keeps for a pending send: the desktop structured outbox entry (which also holds the answers, so it survives a remount or relaunch), the phone's journal submission, and the terminal message echo on both. Nothing new is stored. The hold is per question and ends when Codex records the answer; a failed, withdrawn or cancelled send gives the typed answers back to the card.
  • Size limit: the published set is capped at 256 KiB. Past that, the oldest questions that fit are shown, plus "n more questions in the transcript". Structured pages set aside the field's actual size from their existing byte budget, so other agents' pages are unchanged. Codex terminal frames have no byte budget today (only a message-count window), which is not changed here.

Why

  • Host-derived, not client-scanned. A question is usually older than whatever page a client holds, so only the host, which reads the whole history, can know it is open. Deriving it each time from history (instead of storing a pending-request record) means there is no flag that can get stuck: a delivered user message clears it everywhere.
  • One resolver, not a second patch on the phone. The phone bug came from having two copies of the mapping in different orders, with phone guesses ahead of the envelope. Sharing one resolver removes that class of mismatch.
  • Send directly, not "Add to message". The ticket suggested appending the answers to the draft. The common pattern, and Codex's own terminal app, submit the answer as an ordinary message. Doing that also leaves the user's draft alone.
  • Alternatives considered: a phone-only fix scanning the loaded messages (misses older questions; this is what the two earlier community PRs did); a new RPC to fetch pending questions (a new wire contract for something the existing frames can carry as an optional field).

Credit: this supersedes #22513 by @lorenzozanee (delivering the answer as a normal message, keeping async questions out of the blocking path) and #20074 by @jakeparkcolde (matching calls to their results, local dismissal). Both approaches are reused here.

Differences from the common pattern, labelled.

  • Intended: the open set is recomputed from history, not stored as a request record. Nothing can get stuck.
  • Intended: a later user message from anywhere clears the set (the common pattern clears it on respond, dismiss, or the conversation settling). Orca keeps no "responded" record, and this matches Codex clearing its questions on any submitted prompt.
  • Intended: Dismiss is per device. Nothing is owed to Codex, because its tool call already returned.
  • Intended: the "This request needs a newer version of Orca." line exists because Orca's phones and hosts update independently.
  • Intended: a child agent's async question gets no card, because there is no path to answer a child agent and a card would send the answer to the wrong agent.
  • Intended: after Codex's terminal app restarts, Codex no longer lists questions it asked before the restart, but Orca still shows them until a user message arrives. The model did ask, and an answer is still a valid message.
  • Temporary: the phone's text guesses still exist below the shared resolver. They go away with the follow-up below, once the terminal plan menus have real producers.
  • Temporary: a pending blocking structured prompt older than the first history page is still not shown (unchanged existing behaviour). Follow-up: carry pending prompts on the subscribe snapshot the way this PR carries async questions.

Linked Issue

Fixes #20073 (STA-7243).

Part of #24415 (STA-9142). This PR covers Claude plan approval on the phone (structured chats already worked; terminal chats get the desktop's card instead of guessed digit buttons). The OMP plan review the issue reports, Codex's terminal "Implement this plan?" menu, and the real choices of Claude's terminal plan menu need producers written against captured terminal transcripts. That is a follow-up, so #24415 stays open after this PR.

Visual Proof

Desktop, structured Codex chat, real Codex 0.159.0 (isolated test app; phone screenshots to follow).

The card appears while Codex keeps working (here, running sleep 25); the raw tool row is folded away:

Async question card while Codex works

Answer sent while sleep 60 is still running: it goes into the running turn, and the questions show the sent answers held until Codex records them (gone within 2 s):

Sent answers held during the running turn

The same turn ends using the answers; no second turn:

Codex reply uses the answers

Dismiss is per question; the remaining question stays answerable:

Per-question Dismiss

Testing

  • Unit tests for the shared resolver and envelope, the async-question fold and keys, the terminal tracker and backward scan (including oversized replies and recovery from a failed scan), structured journal rows and frames, desktop and phone cards and their send settlement (sent, rejected, withdrawn, cancelled, owner change), and the size cap.

  • Mixed versions: tests/e2e/cross-version-wire/async-questions-field-downgrade.unit.test.ts. Old clients ignore the new optional field. An old host sends no field, so new clients show today's prose. A row this build can't read never truncates the journal.

  • Local: renderer native-chat, main native-chat/codex/agent-session/runtime RPC, shared and cross-version tests (2181 files pass); mobile session tests (214 files pass); tc:node, tc:web, tc:cli, mobile tsc; full oxlint and the changed-code gates.

  • Live, desktop, structured Codex chat (real Codex 0.159.0, isolated test app, scratch repo): the card appears while Codex works; Submit posts Question: …\nAnswer: …; sent during a running command it goes into that turn, the questions show the sent answers held, and the card retires within 2 s once Codex records them; Codex's reply in the same turn used the answers; per-question Dismiss leaves the composer usable and the questions in Codex's prose.

  • Not yet run live: the phone, and terminal-backed Codex chats on desktop. The test machine's rig can't produce agent status with hooks turned off; that is pending a rig decision.

  • Not run live: an answer reaching Codex's terminal app. Running real terminal Codex for this check is not allowed on the test machines, so terminal delivery rests on Codex's source. Codex's question editor starts collapsed, so a pasted answer is an ordinary prompt that clears all its questions. Known limitation: if someone at the Codex terminal has opened its question editor, a pasted answer (from this card or any message) is filed under that editor's current question. A follow-up will disable terminal Send while the editor is open, based on a captured screen.

  • Known limitation (terminal chats): if Codex drops a steered answer (for example, Stop at the Codex terminal before Codex takes it) and no other input reaches Codex afterwards, that one question keeps the sent answer held. Dismiss, the other questions and the composer stay usable, and the next message gives the answer back or clears the question. On the phone, the hold otherwise lasts as long as the pending message bubble, which today has no expiry for any message.

  • I manually tested these changes locally

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

AI Disclosure

Review

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

  • Wire: only new optional fields on existing replies and frames; no new RPC or stream opcode. The host does the bounded work per subscribe, so SSH and remote hosts behave the same as local.
  • Follow-ups: terminal plan-menu producers (OMP plan review, Codex "Implement this plan?", Claude terminal plan choices); byte-limiting Codex terminal frames; disabling terminal Send while Codex's question editor is open.

Author: @BrennanKB5

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)

Add one shared decision-envelope parser and pending-decision resolver, the
Codex async-question reader and fold, and the terminal-transport host
derivation: the Codex rollout decoder keeps delivery/questions on both
durable shapes, the transcript watcher reconstructs the pending set from
the snapshot's consumed-byte boundary back to the newest delivered user
message (publishing 'pending' until complete), folds appends in file order,
and publishes an optional asyncQuestions side field on snapshot,
replacement and appended frames over RPC and IPC. Async question calls
fold away from the transcript, never become a blocking ask, and the
structured translator and journal schema keep the questions.
…ames

Derive the pending Codex async-question set from the whole journal once
per commit (cached by cursor, shared by every subscriber) and attach it
as an optional asyncQuestions field: whole on snapshot and reset frames,
on batches only when it changed, and on the caught-up frame a resumed
cursor is owed. A direct send retires what was asked before its
submission once accepted; a queued send counts at its handover. The
field's 256 KiB budget is reserved from the history page budget before
items are packed.
The terminal-backed pane now takes its card from the shared resolver: an
approval or unplaceable request shows only while the agent waits, and a
request this build cannot place shows its own words with one line and no
options. The structured pane maps prompts through the same resolver.

Both panes show Codex's pending async questions in a non-blocking card
above the composer, keyed per question: Send posts the answers as an
ordinary message (prose-prefixed so it is never a command) and is only
disabled while one is in flight; Dismiss is local. Terminal answers go
through the PTY message seam with an honest accepted/rejected/unknown
outcome; structured answers are outbox entries with a card origin whose
wait ends on every disposition and which a Stop never restores into the
composer draft.
…e phone

The phone's terminal prompts come from the shared resolver: an envelope
(approval or unsupported) outranks the prose guesses, which now run only
when there is no envelope, no blocking ask and no pending async question,
so plan steps never become digit buttons and an unplaceable request shows
its own words with no options. Structured prompts follow journal order,
as on desktop, and an unknown approval subject is never approvable.

Codex async questions show in a controller-owned card fed only by the
host-published set (so a question outside the loaded window still
shows): answers go through answerQuestion (now returning its outcome)
or the structured bridge's new answer(), neither of which touches the
composer draft.
…hecked types

An older release's structured reducer, coalescer and journal guard reduce
snapshot and batch frames that carry the optional asyncQuestions field,
and admit a text block with async question metadata, exactly as before.
Frame readers read the field through a checked helper instead of widening
existing casts.
…ecision-cards-9142

# Conflicts:
#	src/renderer/src/i18n/locales/es.json
…a; read-only journals publish no set

A text block whose async-question annotation this build can't read was rejected by the
journal schema, which truncates the journal from that row. The schema now admits any
value and the host validates it when deriving. A read-only journal (an unreadable newer
row) can't derive the set, so it publishes nothing, as an older host does, instead of
an authoritative empty set that prunes client state.
…ly and recover from a failed scan

A user reply over the 2 MiB record cap was skipped before it was checked, so it never
retired the pending questions (and a fresh subscriber could bring answered ones back).
Both the backward reconstruction and forward reads now inspect such a record's head,
which says whether it is a delivered user message. A reconstruction that fails on an
idle file used to stay pending until Codex wrote again; it now retries with backoff
until it succeeds, the source is replaced, or the subscriber leaves.
…l and waits out a model switch

The answer seam only noticed a cancel through its own handle, so a model or effort
change that drained the PTY queue before Enter still reported the answer as sent and
the card cleared it. The queue now says whether Enter fired. The seam also refuses to
write while an option command owns the PTY, as the composer already does, so an answer
can't land in the model picker.
…wn and requeued answers settle

The card kept one state per hook, so switching session tabs on the phone dropped typed
answers and dismissals (and could allow a second Send while one was in flight). The
shared reducer now parks each conversation's state, bounded, and settles a send for the
conversation it came from. A Stop-withdrawn answer is restored into the card; a
structured answer that an owner change puts back in the queue ends as unknown, so Send
is never left disabled. Desktop and phone share one submit path.
…sync field

The structured and phone controllers always provide the async-question view, so the
card hooks read it directly; the controller mocks that lacked it now carry it. Adds
render tests for both async cards (choices, free text, Send, Dismiss, the omitted
count) and for the unsupported-request card on both clients.
The answer hook runs over the real PTY queue: a refused write marks the echo
not sent, a lost acknowledgement holds it, Stop before Enter settles rejected,
a model switch or a phone-held terminal refuses without an echo, and no answer
writes Escape or touches the composer draft. The resolved view puts the card
between the transcript and a composer that stays, and yields to a blocking card.
…ured command gate

The overlay adds the async card after the queued cards only when no blocking
card holds the prompt slot. A terminal answer heals an orphaned image paste
before it clears the line or writes, sends nothing when the heal fails, and
carries no composer images. A /model-titled answer goes through the session's
real command gate as an ordinary message, while a typed /model is caught.
A question older than the byte-cut hydration page still rides the snapshot.
An over-budget set publishes its oldest questions with omittedCount, and the
whole frame stays inside the page limit because the field's share is held back
from history. The released reducer reads an over-budget frame exactly as it
reads the same frame without the field.
…he questions it answers

Codex records an answer from its own async-question editor as a user message
wrapped in its reply envelope naming the answered question ids, and keeps the
other questions pending. The rollout adapter now reads that envelope (mirroring
Codex's parser, including the IDE-context prefix) and the shared fold retires
only the named questions. A plain prompt still clears the whole set; entries
keyed by record position, which no reply can name, clear on any reply.
… and retry through the watcher

A failed reconstruction now publishes absent, the old-host state, so a read
failure never turns off the phone's fallback approval cards; the tracker no
longer owns a retry timer. A retry is due only after a backoff and runs from a
watcher drain or reconcile, so it inherits the WSL running check.

Each settled fold is cached host-wide per rollout (path, file identity, the
offset it reached and a boundary fingerprint; bounded to 32 files). A
re-subscribe to an unchanged file publishes ready on its snapshot with no
scan; otherwise it reads only the bytes written since the cached offset,
after verifying the fingerprint. A miss or a rewrite only means a rescan.
…cript re-derives its questions

A re-subscribe (phone resume, reconnect, desktop hide/show) publishes pending
first. Clients now keep showing the last ready set over that pending, so the
card no longer unmounts and the phone keyboard no longer drops; a new ready,
absent, or a source change replaces it. The desktop resets the view only when
the transcript source changes.
…running turn

An answer sent while Codex is working used to go out as queue-if-active
(follow-up queueing is on by default), so the host held it until the turn
ended while the card showed blank inputs and a live Send. Codex's own app
delivers an answer into the running turn, and Orca's structured Codex host
already steers a plain send into the active turn (turn/steer). Desktop outbox
entries with an async-answer origin and the phone's answer() now send plain;
ordinary composer messages still queue.
…rd state survives the chat toggle

The desktop structured card tracked an answer through a module-level outcome
map, a waiting-promise map and record calls spliced into four outbox mutation
sites. A remount resolved every wait as unknown and re-enabled Send while the
persisted entry could still be queued or dispatching, inviting a duplicate
answer, and the persisted origin.edits had no reader.

Now each render reads the persisted outbox: an async-answer entry that waits
or goes out holds its questions' Send and shows the sent answers; one held for
Retry, refused or unconfirmed shows them with Send enabled. Once the host has
it the entry leaves and the card waits for the host's set. A Stop or host
withdrawal, or a refusal whose row loaded, hands origin.edits back to the card,
as the composer draft gets its text back.

Card state (edits, dismissals, in-flight) now lives in a bounded module store
per conversation scope, like the composer draft cache, so the terminal card
keeps it across a terminal/chat toggle and a send settles into it after an
unmount.
…al suffix, Codex only

Every journal commit (text deltas commit about every 60 ms) rebuilt the set
from a full sorted snapshot once any message had ever asked, for every
structured session. The host now keeps, per journal epoch, the newest
delivered root user message as a boundary and folds only the messages after
it, read without a sorted snapshot; submissions are read only when a pending
send sits in that suffix. A vanished boundary item or a new epoch re-derives
from the start. A session whose provider is not Codex publishes the empty set
without reading the journal.
…arries, not a flat 256 KiB

The shared history content budget lost 256 KiB for every reader: OpenCode
terminal pages and appends, the conversation outline, structured history
pages, and the per-item 'too large' cutoff, though only structured subscribe
frames carry the field. The budget is restored; structured snapshot, reset
and catch-up pages now hold back the serialized size of the field the frame
will carry, so a full frame still stays under the page limit.
…ion set the host no longer publishes

After a reconnect the desktop resumes with its cursor, so the host replies with
catch-up batches, and a batch without the field kept the previous set. Against
a host that never publishes it (a downgrade), a stale card stayed up and kept
heuristic cards off indefinitely. A deriving host now attaches the set to a
subscription's first frame even mid catch-up (later changes still wait for the
final page), and the read transport treats a resumed subscription's first frame
without it as an old host: the held set becomes absent. The phone always
subscribes without a cursor, so its snapshot already states the set.
…t out settles unknown, not rejected

The answer seam uses the observed write path, which marks a send submitted
only once Enter's acknowledgement returns. A Stop, an option command's drain
or a PTY swap in that window (up to 15 s on a remote runtime) reported a
delivered answer as rejected: the echo showed failed and Send invited a
duplicate. The observed path now records that Enter was handed to the runtime,
and the answer seam reports unknown for a cancel after that point: the edits
stay and the echo is held as unconfirmed.
…of Orca'

A truncated or non-JSON prompt, raw tool input with no envelope arm, or a
known arm that doesn't parse rendered 'This request needs a newer version of
Orca.' on both clients and turned off the phone's fallback cards, telling an
up-to-date user to upgrade. Those are now no envelope, as before this change:
no card, fallback cards allowed. Unsupported is kept for what a newer host
sends: a well-formed arm this build doesn't know, or an approval subject of an
unknown kind.
…ted choices, narrower phone memo

- The omitted-questions line uses the catalogs' plural forms on desktop (all
  six catalogs, plus the boot catalog) and the phone's count pattern.
- Option buttons key by label and occurrence, so a choice the model repeats
  no longer collides as a React key on either client.
- The phone resolves the prompt cards only when the status fields the resolver
  reads change, not on every status update.
- The side-field cap comment now says frames hold back its actual size.
…old publishes its questions

A subscriber whose question scan failed retries after a drain. When another
subscriber of the same idle rollout had already folded it, the retry was
answered from the shared cache but nothing published the result, so the client
kept 'absent' until Codex next wrote to the file.
…p journal messages before the boundary without building them
…has it, on every client

Codex holds an answer steered into a running turn until its next model step.
The phone (both transports) and desktop terminal chats cleared the card as
soon as the send was accepted, so the same question came back blank with Send
live while Codex still held the answer; desktop structured chats already held
it through the outbox.

Each client now reads the hold from a record its transport already keeps, fed
through the shared progress input: a terminal answer's optimistic echo carries
its answers until the row lands or is marked not sent; a phone structured
answer is tied to its journal submission, held while pending, given back when
refused (a Stop before Codex drained it included) and let go once accepted.
…ver Dismiss

A transport hold (an answer on its way to the agent) used to mark the whole card as sending:
every input, every later question and Dismiss were disabled until the hold released. The hold
is now per question: a held question shows its sent answer read-only, other open questions
(including ones asked after the send) stay editable, Send builds its reply from unheld
questions only, and Dismiss and the Sending label follow only the card's own write.
…ts answers back

A terminal answer's echo held its questions until a transcript row with the echo's exact text
landed. When Codex consumes the paste some other way (its question editor files it as a reply
to one question, or a steer is dropped) that row never comes, so the hold never released.
The echo now records the sends queued ahead of it; once the agent records a user row after the
send that neither the echo nor those sends account for (harness machinery aside), the hold ends
and the answers go back to the card, on desktop and phone alike.
…he card shows it

The Codex request_user_input_async call and its acknowledgement were dropped from every
transcript unconditionally. With no card to replace them (an older host that publishes no
question set, a failed derivation, a child agent's question, or questions past the overflow
line) the question's options were shown nowhere. The fold now takes the call ids the client's
ready question set holds and drops only those calls; any other call keeps today's row. Desktop
(terminal and structured) and phone pass their view to the shared fold.
…es or goes

With no blocking card the prompt slot wrapped the queued cards in a fragment beside the async
question card; with one it passed the queued cards alone. React saw a different element at
that position and remounted the queued cards, dropping their in-flight busy state, same-frame
double-tap guard and open action menu. The slot is now one tree either way, with the async card
left out while a blocking card shows.
…oads on the phone

The phone's Hermes runtime has no Array.prototype.toSorted, and the mobile compatibility test
rejects it anywhere in the phone bundle, src/shared included. Copy then sort instead.
…e to read

The incremental reader joined every part of an oversized pending record (up to about 2 MiB) to
keep its first 4 KiB, and the kept slice pinned the whole join until the line ended. It now
copies just the head.
…hared module

The card-state module outgrew the line limit once the per-question hold and the terminal
echo rule landed. Where a sent answer stands (transport records to progress, and when a
terminal echo still holds) now lives in native-chat-async-answer-progress.ts; the card reducer
reads it. No behaviour change.
The async-question fixture fields this branch added pushed the file one line over the
limit; the structured session fixture drops its redundant error: undefined (absent reads
the same).
…riving the card

Opening a Codex chat with an open async question showed the raw
request_user_input_async row on the first frame, then hid it when the card
arrived: the host's first snapshot says "pending" and only the later ready
set named the calls to fold.

While the view is pending a card may follow, so every async question call
and its acknowledgement fold away on every client. An absent view (an older
host, or a derivation that failed) and ready calls the card doesn't show
keep their rows as before.
…hone holds the terminal

While a phone holds a terminal agent's input, the desktop chat hides the
async question card, but the message list still folded the question's tool
row away, so the desktop showed neither the card nor the row with its
options.

The chat view that decides whether its card can show now hands the message
list which async calls to fold, instead of the list deriving that on its
own. The terminal view folds nothing while the phone holds the terminal, so
the raw row shows as before; a blocking card hiding the async card only
briefly still folds. The structured view hands its own view's set the same
way.
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Review summary

The problem. When Codex asks a question with request_user_input_async and keeps working, Orca dropped the questions while reading Codex's history. The phone showed only Codex's prose, with nothing to tap or answer (#20073). The desktop showed the prose plus a raw tool row. Separately, the phone and desktop each had their own code for turning an agent's "waiting on you" state into a card, and on the phone a text guess could turn a Claude terminal plan's numbered steps into digit buttons (part of #24415).

What changes for you. Codex's open questions now appear as a card above the composer on both phone and desktop: the question, its choices, and a text field. Send (labelled Submit on desktop) posts your answers as an ordinary message that goes straight into the turn Codex is running. Until Codex records it, each answered question shows what you sent and is held; Dismiss and the other questions stay usable. Dismiss is per device and per question. The card stays across reconnects and the terminal/chat toggle, and a reply from Codex's own question editor clears only the questions it answers. The phone and desktop now pick approval and question cards with one shared resolver, so a Claude terminal plan approval shows the same card on both. Nothing new appears for prompts this version can't read except a request of a newer kind, which shows "This request needs a newer version of Orca." with no Approve.

Review. Four review rounds plus a readiness check (verdict PASS: no data loss on rollback, no regression for Claude Code, Codex or OpenCode). Every finding was fixed in this PR, each with a test that fails without the fix:

  • Answering one question in Codex's own editor no longer clears the others.
  • Answers steer into the running turn instead of waiting in the queue until the turn ends.
  • The card no longer blinks on reconnect, and a reconnect no longer re-scans the whole transcript; one scan per transcript file is shared by every viewer.
  • A failed scan shows no card (today's behaviour) and retries through the watcher's own read path, which never touches a stopped WSL distro.
  • Whether an answer is on its way is read from a record each client already keeps for a pending send; nothing new is stored, and a remount can't send it twice.
  • A held answer locks only its own question, never Dismiss; a terminal answer Codex took without recording it comes back to the card.
  • The raw tool row is hidden only while the card shows the question (it stays for an older host, a child agent's question, or while the phone holds the terminal), and no longer flashes on a cold open.
  • The size budget for the new field applies only where it rides, so other agents' history pages are unchanged.
  • Shared code no longer uses an array method the phone's JavaScript engine lacks (this had turned Mobile Checks red on earlier heads).

Deferred (low impact, recorded for follow-up).

  • A reply from Codex's editor larger than 2 MiB still clears every question.
  • If Codex drops a steered answer and nothing else reaches it afterwards, that one question stays held (Dismiss, other questions and the composer stay usable).
  • On the phone, an app relaunch forgets which send carried which answers, so the card shows blank inputs while Codex still holds the answer.
  • After a successful re-send, an older refused answer can briefly show its text again.
  • Follow-ups already noted in the body: producers for the terminal plan menus (OMP plan review, Codex "Implement this plan?", Claude's terminal plan choices), byte-limiting Codex terminal updates, and turning off terminal Send while Codex's question editor is open.

Verified.

  • Unit and component tests across host, shared, desktop and phone code; the full phone suite; mixed-version tests; all typechecks and lint gates. CI: every test job, Mobile Checks and the size check pass on the head. The one red check, localization coverage, flags src/renderer/src/lib/worktree-creation-hook-preparation.ts from fix: close worktree dialog before slow script checks #25472 on main; this PR doesn't touch that file.
  • Live on desktop with real Codex 0.159.0 in a structured chat (isolated test app): the card appears while Codex works; an answer sent during a running command goes into that turn, is held on the card, and retires within 2 s; Codex's reply in the same turn used the answers; per-question Dismiss works. Screenshots are in the body.

Not verified.

  • The phone, and terminal-backed Codex chats on desktop, live: the test machine's rig can't produce agent status with hooks turned off, which is pending a rig decision. Phone screenshots will be added to the body once that runs.
  • An answer reaching Codex's terminal app live (running real terminal Codex isn't allowed on the test machines); terminal delivery rests on Codex's source.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Closing this stale combined implementation. Codex questions that cannot be answered on the phone and incorrect plan approval cards remain tracked in #20073 and #24415.

miguel93041 added a commit to miguel93041/orca that referenced this pull request Oct 17, 2026
Derive pending questions from delivered history so cards remain available outside the loaded message window. Extend the current-request transport from stablyai#29121 with opt-in async rows and adapt rollout reconstruction and regressions from stablyai#25448.
@miguel93041

Copy link
Copy Markdown

@brennanb2025 I've carried forward the Codex async-question part of this work in #30062, adapting the pending-question reconstruction and regression tests and using the current-request transport you merged in #29121.

It covers desktop and mobile, structured and terminal-backed chat, Other answers, questions outside loaded history, and resolution across clients. Turn completion does not discard unanswered questions. The latest review also fixed a late rejected send incorrectly clearing newer questions after a context clear.

The shared decision resolver and plan-approval changes from this PR remain outside #30062; #24415 is not fixed by it. Once reviewed and merged, #30062 could provide a new base for resuming that remaining work. I'd welcome your review of what was carried forward and the boundary between the two changes.

384 focused tests and the build pass. Full CI needs maintainer approval for the fork; physical phones and live SSH remain unverified.

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.

Mobile omits Codex request_user_input_async decision cards

2 participants