Skip to content

fix(native-chat): Skip and agent messages agree with the Codex question card - #42946

Merged
AmoabaKelvin merged 2 commits into
mainfrom
question-status-followups
Nov 16, 2026
Merged

AmoabaKelvin merged 2 commits into
mainfrom
question-status-followups

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

ELI5

When Codex asks you a question in a chat without stopping its work, the chat shows "waiting on you" until you answer. Two things were wrong with that. Pressing Skip on the question only hid it on the screen you pressed it on, so the chat kept saying "waiting". And a message from another agent (a coordinator) cleared "waiting" even though the question was still open. Now Skip counts everywhere, and only your own answer or your Skip ends the wait.

Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​45 $\color{#cf222e}{\Huge{\mathbf{−}}}$​4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​41
Prod 41 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​506 $\color{#cf222e}{\Huge{\mathbf{−}}}$​112 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​394

What Changed

Follow-ups to #42459.

Before:

  • Skip on a Codex async question card hid the card on that one screen. The tab and sidebar dot, worktree ps and the phone kept showing "waiting". The card came back after a reload, and the phone still showed it.
  • A message another agent sent to the chat turned the dot green ("done") while the card stayed open.

After:

  • Skip is saved on the chat's host. The dot goes to done on every device, the card is hidden on desktop and phone, and it stays hidden after a reload or a restart.
  • Another agent's message no longer touches the wait. The dot and the card agree.

Mechanism:

  • Skip is a host fact. agentSession.skipAsyncQuestions {sessionId, itemId} is modelled on agentSession.cancelUsageLimitContinue.
    • It saves asyncQuestionsSkippedThrough (the newest question row the card showed) on the chat's record and republishes status.
    • The status summary carries that row. The host folds it into awaitsAnswer: the chat waits only while the newest open question is not the skipped one.
    • Desktop (use-native-chat-async-questions.ts) and phone (use-mobile-native-chat-prompts.ts) hide every question up to that row, using the same shared helper (asyncQuestionsAfterSkip).
    • The saved row only ever moves forward, by journal position. A device that hasn't loaded the newest question can't bring it back.
    • Gated by agent-session.skip-async-questions.v1, and allowed from phones. Older hosts keep today's hide on that screen only.
  • Agent messages don't end the read. The host's status read now uses the card's own rule: only the person's delivered message answers. This is the isHumanSend rule @brennanb2025 set for the card in Keep async question controls available after agent notices #35758. The old agent-message cut-off (endsStructuredAgentSessionAsyncQuestionRead), which CodeRabbit flagged on fix(native-chat): show a Codex chat with an open async question as waiting on you #42459, is gone.
  • The read stays bounded. It was cheap before only because it stopped at the first agent message. To keep it cheap:
    • Two partial indexes are created in the journal SQL worker on open, with no user_version bump: rows naming request_user_input_async, and the person's own messages ($.body.from absent, json_valid-guarded).
    • The read takes the newest question from the first index and stops at once when there is none.
    • Otherwise it walks only the person's messages after that question, oldest first, from the second index.

Why

  • Codex keeps an unanswered async question only in its own TUI, and Skip there just drops it locally. In Orca the host plays that role for every device, so the Skip has to live on the host. A per-screen hide can't make the dot and the card agree.
  • The card's rule from Keep async question controls available after agent notices #35758 is the one users see: a coordinator's notice must not steal the person's question. So the status follows the card, not the other way round.
  • An index lets the read stay exact without scanning history. The alternatives:

Linked Issue

Follow-ups listed in the Risk section of #42459 (Fixes #42008 there). This PR has no issue of its own.

Visual Proof

Real Codex 0.167.2 app-server (temp HOME/CODEX_HOME) talking to a local fake model that calls request_user_input_async. Hidden desktop build, same profile, A/B by rebuilding from main.

Another agent's message while the question is open

Before (main): card open, dot done (green) After: card open, dot waiting
main-agent-message.png before-skip.png

After pressing Skip

Before (main): card gone, dot still waiting After: card gone, dot done
main-after-skip.png after-skip.png

Testing

Live, desktop build from this branch (worktree ps via the CLI against the same runtime):

  • Question asked: waiting, card open.
  • An orchestration message from another agent is delivered and Codex answers it: still waiting, card still open. On main this read done.
  • Skip on the desktop card: done at once. After a page reload the card stays gone. After an app restart the chat is still done. On main the restarted chat was back to waiting.
  • Phone route: a second question was skipped by calling agentSession.skipAsyncQuestions over RPC, as the phone does. The desktop card disappeared live, and ps went to done.
  • Both indexes exist in the chat database after open, and user_version stays 2.

Per-commit status read (readJournalSqlStatusState, ms per read, 200 reads, seeded journals):

Chat main this PR
short, 20 exchanges, question open 0.54 0.47
coordinator-driven, 1,500 agent messages / 3,000 replies, no question 2.74 1.81
same, question asked early and still open 2.42 (wrongly done) 1.73
same, question asked early and answered early 2.86 1.80

One-time index build: on a seeded 3.31 GB journal (1.9M rows, real-shaped payloads), building both indexes took 3.2 s. This happens once, in the journal worker on first open after upgrade, so chats load about that much later once. The main thread doesn't block. Later opens take 0.03 ms. EXPLAIN QUERY PLAN shows both queries searching their index.

Automated:

  • journal-domain-status-reads.test.ts: the question stays open across another agent's message and closes on the person's.

  • New structured-agent-session-skip-async-questions.test.ts: Skip on a chat the host has closed saves, and an unknown row is ignored. It hangs on the round-1 version of this branch.

  • Ran every test file that depends on the changed modules (140 files, plus 5 mobile files), mobile typecheck and typecheck:tests, and pnpm check:changed. macOS only; the change is shared and main-process code with no platform branches.

  • I manually tested these changes locally

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

  • Every added test fails without this change and avoids the test anti-patterns

Risk

Riskiest part: the two new indexes.

  • They're added without a version bump, so an older Orca opens the database normally. SQLite maintains both indexes on that build's writes too.
  • The person-message index runs a json_valid-guarded json_extract on each prompt row's insert, so a malformed row can't fail a write.
  • First open after upgrade spends about 1 s per GB of journal building them, in the worker.

Behaviour changes:

Mixed versions:

  • asyncQuestionsSkippedThrough is optional on the record and the summary. Older clients ignore it. Older hosts lack the capability, so newer clients keep the hide on that screen only.

Known limits (follow-ups):

  • If two journal rows carry the same async callId, the host can name a different open row than the card, so Skip may leave the host waiting.
  • While a queued answer that quotes an already-skipped question is still pending delivery, an older question can show again until that answer lands.

Back out: a plain revert. The indexes stay in existing databases, harmlessly.

Level: Medium

AI Disclosure

Review

Two review rounds (Codex and Claude).

  • Round 1:
    • The person-message walk still parsed agent rows, which led to the second index.
    • Skip saved a question a queued answer had hidden, so it now saves the newest question shown.
    • A lagging device could move Skip backwards, so it now only moves forward.
    • The saved Skip was ignored while the phone reconnected.
  • Round 2: found that Skip on a chat the host had idle-closed deadlocked that chat's task queue, because the open and the write queued on the same key. The chat now opens before the write takes its slot, and the new host test covers it.
  • Rejected: "worker chats stay waiting while working" is the intended card rule, see Risk. The two edge cases above are left as follow-ups.
  • CodeRabbit: Skip from a phone now also needs the paired desktop to relay the method (the useRouteRelaysCapability gate rewind and goal already use). A failed save now shows only its own card again.

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

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

  • Remote/SSH: the record, the indexes and the status read all live on the executing host. Remote desktops and paired phones get the same row and call the same method.
  • Folder workspaces: nothing here depends on git.
  • Terminal-backed Codex chats are unchanged. Their Skip already reaches the host through the hook path (fix(agent-status): show Codex's mid-turn async question as waiting for the user #39087).
  • Unrelated moves, to stay under the file line limits: AgentSessionForkedFrom moved to its own file and is re-exported. A dead agentDefinitions host member was removed.

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)
  • I stated the risk: what could break, for whom, and how to back it out
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Walkthrough

The change identifies open async questions by journal row and replaces the prior boolean status with a row identifier. The host can save a skipped-through row and publish it in session status. Renderer and mobile prompts use that position to filter questions, and dismissal attempts to save the newest displayed row. If the save fails, the prompts restore their locally hidden occurrences.

Severity of issue fixed: Medium

Merge Risk: Low · up to 210c8

Skip can sometimes fail to stick or briefly reappear when a save is rejected or the host does not support it. The impact is limited to the prompt UI and is recoverable. It is mergeable with these known follow-ups.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the two behaviors the PR changes: Skip and agent-message handling for the Codex async question card. The changeset adds a saved host-side skip position, a skip RPC, and a status read t…
Description check Passed The description follows the repository template. It includes ELI5, What Changed (before/after and mechanism), Why (alternatives considered), Linked Issue, Visual Proof with before/after images, Testin…
Linked Issues check Passed The only directly linked issue, #42008, is closed and completed. It supplies historical context only. No active directly linked target remains, so no linked-issue coding requirements apply. The PR des…
Out of Scope Changes check Passed No active linked-issue requirements exist. The scope is therefore the PR's stated purpose: Skip on a Codex async question persists on the chat host, and the status read follows the person-message rule…
Full details: Title check

Explanation

The title names the two behaviors the PR changes: Skip and agent-message handling for the Codex async question card. The changeset adds a saved host-side skip position, a skip RPC, and a status read that ignores agent messages, so the title matches the main change. It is a conventional-commit title of 76 characters, which is within a reasonable length. It does not name the host-side persistence or the new indexes, but it does not need to cover every detail.

Full details: Description check

Explanation

The description follows the repository template. It includes ELI5, What Changed (before/after and mechanism), Why (alternatives considered), Linked Issue, Visual Proof with before/after images, Testing with checkboxes, Risk with a level, AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist. The Linked Issue section has no issue of its own. It cites #42459 as the predecessor, and the template asks for a linked issue for outside contributors. The Risk section is detailed and includes a back-out plan. The AI Disclosure section is empty, and the final checklist item for pnpm lint, typecheck, test, and build is unchecked. These are minor gaps and do not make the description largely incomplete.

Full details: Linked Issues check

Explanation

The only directly linked issue, #42008, is closed and completed. It supplies historical context only. No active directly linked target remains, so no linked-issue coding requirements apply. The PR description cites follow-ups to #42459 (which fixed #42008 there). That issue is background only and is not assessed here.

Full details: Out of Scope Changes check

Explanation

No active linked-issue requirements exist. The scope is therefore the PR's stated purpose: Skip on a Codex async question persists on the chat host, and the status read follows the person-message rule from #35758. The whole-PR summary maps the changes to that purpose: the agentSession.skipAsyncQuestions RPC and capability gate; the asyncQuestionsSkippedThrough record field and status summary; desktop and phone Skip wiring with the shared asyncQuestionsAfterSkip helper; the bounded status read (readJournalSqlOpenAsyncQuestion) and its two partial indexes; the turn-completion feed change that uses the new awaits-answer rule; and the tests. The PR discloses two housekeeping moves: AgentSessionForkedFrom moved to its own file and is re-exported, and the unused agentDefinitions host member was removed. Both occur in files this change already edits, and both are small. The generated file src/shared/rpc-contract/rpc-params-catalog.generated.ts is excluded by the ignored-file rule. Its contents were not inspected. This does not affect the verdict because the file is generated registry output and the RPC method it would list is in the reviewed sources. This assessment relies on the whole-PR summary. No focused code inspection was performed for this incremental review.

  • 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

@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: 2

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 478d3b5f-d897-42ef-8a53-991c35190825
Commits

Reviewing files that changed from the base of the PR and between 313b7c9 and f7ed7cf.

Files ignored due to path filters: 1

  • src/shared/rpc-contract/rpc-params-catalog.generated.ts is excluded by !**/*.generated.*
Files selected for processing: 41

  • mobile/src/session/__mocks__/mobile-prompt-controller.ts
  • mobile/src/session/native-chat/agent-session/mobile-structured-agent-session-contract.ts
  • mobile/src/session/native-chat/agent-session/mobile-structured-agent-session-host-support.ts
  • mobile/src/session/native-chat/agent-session/use-mobile-structured-agent-session.ts
  • mobile/src/session/native-chat/agent-session/use-mobile-structured-async-questions.ts
  • mobile/src/session/native-chat/input/prompts/use-mobile-native-chat-prompt-controller.ts
  • mobile/src/session/native-chat/input/prompts/use-mobile-native-chat-prompt-dismiss.ts
  • mobile/src/session/native-chat/input/prompts/use-mobile-native-chat-prompts.ts
  • mobile/src/session/native-chat/input/prompts/use-mobile-structured-async-question.ts
  • src/main/native-chat/agent-session-journal/database/journal-async-question-index.ts
  • src/main/native-chat/agent-session-journal/journal-domain-status-reads.test.ts
  • src/main/native-chat/agent-session-journal/journal-sql-status-async-questions.ts
  • src/main/native-chat/agent-session-journal/journal-sql-status-items.ts
  • src/main/native-chat/agent-session-journal/journal-sql-status-state.ts
  • src/main/native-chat/agent-session-journal/journal-sql-worker-entry.ts
  • src/main/native-chat/agent-session-journal/journal-status-items.ts
  • src/main/native-chat/agent-session-journal/journal-status-state.ts
  • src/main/native-chat/agent-session-wire/host/structured-agent-session-conversation-reads.ts
  • src/main/native-chat/agent-session-wire/host/structured-agent-session-host.ts
  • src/main/native-chat/agent-session-wire/host/testing/structured-agent-session-skip-async-questions.test.ts
  • src/main/native-chat/agent-session-wire/observations/structured-agent-session-status-summary-equality.ts
  • src/main/native-chat/agent-session-wire/observations/structured-agent-session-status-summary.ts
  • src/main/native-chat/agent-session-wire/observations/structured-agent-session-turn-completion-feed.ts
  • src/main/native-chat/agent-session-wire/publication/subscribers/structured-agent-session-client-delivery.ts
  • src/main/runtime/agent-session/records/agent-session-record-command.ts
  • src/main/runtime/agent-session/records/agent-session-record-store.ts
  • src/main/runtime/rpc/methods/structured-sessions/conversation/structured-agent-session-skip-async-questions.ts
  • src/main/runtime/rpc/methods/structured-sessions/structured-agent-session.ts
  • src/main/runtime/rpc/server/runtime-rpc-mobile-agent-session-methods.ts
  • src/renderer/src/components/native-chat/prompts/NativeChatStructuredAsyncQuestion.tsx
  • src/renderer/src/components/native-chat/prompts/use-native-chat-async-questions.ts
  • src/renderer/src/components/native-chat/prompts/use-structured-agent-session-async-question-skip.ts
  • src/shared/agent-session/agent-session-runtime-capabilities.ts
  • src/shared/agent-session/agent-session-wire.ts
  • src/shared/agent-session/lifecycle/agent-session-record.ts
  • src/shared/agent-session/lifecycle/records/agent-session-forked-from.ts
  • src/shared/agent-session/lifecycle/records/agent-session-record-stored-form.ts
  • src/shared/agent-session/view/structured-agent-session-async-questions.ts
  • src/shared/agent-session/view/structured-agent-session-projection.ts
  • src/shared/native-chat/input/native-chat-ask.ts
  • src/shared/rpc-contract/structured-agent-session/skip-async-questions-params.ts

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

const newest = newestShownAsyncQuestionRow(contributors, sourceScope, prompt)
// A Skip the host did not save shows the card again, as the status still waits on it.
if (save && newest) {
void save(newest).catch(() => dismissals.forgetAsync(scopeKey))

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.

Minor · Functional Correctness · Quick win

Roll back only the occurrences that the rejected Skip hid.

forgetAsync(scopeKey) removes every hidden occurrence in the scope. If an earlier Skip save rejects while a newer Skip is still pending, the newer question reappears until its own save settles. Its occurrence IDs were dropped with the rejected request.

Remove only the IDs that the failed Skip added, for example through an ID-aware rollback in the store. Keep the scope-wide clear for the layout-effect cleanup.

Source: Learnings

…uestion card

Skip on a Codex async question card now saves the skipped row on the chat's host
record (agentSession.skipAsyncQuestions, modelled on cancelUsageLimitContinue), so
the status, the desktop card and the phone card all honour it. The host status read
no longer ends at another agent's message, matching the card's rule from #35758;
two partial indexes, created without a schema version bump, keep that read bounded.
@AmoabaKelvin
AmoabaKelvin force-pushed the question-status-followups branch from 40dd4ae to 210c8d6 Compare November 16, 2026 06:23

@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

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: eb7ecc84-7b27-4e8c-bc37-9b8cc0630c1c
Commits

Reviewing files that changed from the base of the PR and between 40dd4ae and 210c8d6.

Files ignored due to path filters: 1

  • src/shared/rpc-contract/rpc-params-catalog.generated.ts is excluded by !**/*.generated.*
Files selected for processing: 1

  • src/shared/native-chat/input/prompt-dismissal-store.ts

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

return
}
if (entry.prompt !== undefined) {
const kept = ids ? [...entry.hidden].filter((id) => !ids.includes(id)) : []

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.

Minor · Functional Correctness · Quick win

Scope the save rollback to its own dismissal.

When a save fails, the rollback restores the IDs it hid. It does not check whether a later dismissal in the same scope hid the same IDs. If the scope remounts and hides an ID again while the first save is pending, the first rejection can restore that ID while the second save is still pending. The rollback does not check owner or generation, so it cannot tell the two dismissals apart.

Give each dismissal a token, and make the rollback remove IDs only while that token is still current. Alternatively, skip the restore when the owner has changed since the dismissal started.

@AmoabaKelvin
AmoabaKelvin merged commit a2d17f8 into main Nov 16, 2026
50 of 51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Chat mode shows agents as green (“done”) even when they are blocked and asking a question

1 participant