Skip to content

fix(native-chat): let a multi-question ask record list its questions - #23451

Merged
brennanb2025 merged 2 commits into
mainfrom
brennanb2025/native-chat-multi-question-structured
Sep 28, 2026
Merged

brennanb2025 merged 2 commits into
mainfrom
brennanb2025/native-chat-multi-question-structured

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​162 $\color{#cf222e}{\Huge{\mathbf{−}}}$​3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​159
Prod 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​42 $\color{#cf222e}{\Huge{\mathbf{−}}}$​15 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​27

ELI5

When an agent asks you several questions at once in a native chat and you cancel (or haven't answered yet), the chat only said "Asked: 2 questions" and never showed you what the questions were. Now you can click that line to read every question in full.

What Changed

Before: in a Claude or Codex structured chat, a question prompt with more than one question left a line reading "Asked: 2 questions" (or "Awaiting user input: 2 questions") in the transcript. If you cancelled it, the questions were shown nowhere: the line could not be opened, and only answered prompts list their questions (next to each answer). While a Codex prompt is pending, the answer card shows one question at a time, so the rest were also hidden until you answered the first.

After: that line works like the single long question line from #22941. Hover shows a chevron, clicking opens a numbered list of every question in full below the line, and clicking again folds it. The line still reads "Asked: 2 questions". The list sits outside the button, so you can select and copy it. It stays open when the row scrolls out of view and back, and keyboard focus stays on the toggle when it folds. For a pending Codex prompt, each answer turns the answered question into its own closed line and the remaining questions into a new folded line.

Unchanged: an answered prompt still lists each question with its answer below the line, so its line stays plain and nothing is shown twice. A single question behaves exactly as before. The ask line inside a tool-activity run (the terminal-chat path) still reads "N questions" with no toggle; a follow-up changes that one.

Mechanism: the shared description of what the line names used to be either one question or a bare count. The count is replaced by the list of question texts, and the line derives "N questions" from its length. The line gains one option saying whether it should list the questions; it defaults to yes. The receipt turns it off only once the prompt is answered, because that is when it lists every question with its answer itself. The tool-activity run turns it off for now. The line remembers whether its list is open separately from whether a single question is open. A pending Codex prompt is drawn as one line keyed by its first question, and once that question is answered it becomes its own line under the same key; without the split it would open already expanded. That description is computed while drawing and is never saved or sent between devices, so nothing stored or sent changes shape.

Why

The line is the only lasting record of the prompt in the transcript, so it is the natural place to keep the questions readable. Reusing the same disclosure (same saved open state, focus and keyboard behaviour) keeps one pattern for "this line hides text you may need." Carrying the texts rather than a count means the line cannot claim a count it has no questions for, and the count is never stored twice. Letting the prompt record say whether it already lists the questions avoids showing them twice on answered prompts without the line needing to know how the record is drawn. A count line always hides its questions, so unlike the single-question case it needs no width measurement.

Linked Issue

None. Follow-up to #22941: a multi-question ask must show every question.

Visual Proof

Checked live in a background dev build of this branch (head 4a9a848219) on a second Mac, with an isolated profile and real structured Claude chats. Before this change the same rows read "Asked: 2 questions" with no way to open them.

Pending ask: the row opens to list both questions, and the text can be selected while it stays open:
pending collapsed pending open selection

Cancelled ask: before, the questions were shown nowhere; now the row opens to list them:
cancelled collapsed cancelled open

Answered ask: the row stays plain and each question is shown once, with its answer:
answered

Keyboard focus, and still open after scrolling away and back:
keyboard still open

A single long question still unfolds, and a short one stays plain:
long open short

Codex, checked live on a second run: a default structured Codex chat cannot ask questions at all, because Codex only offers its question tool in Plan mode and a structured chat has no Plan mode. To exercise this change, that run started Codex with its own default_mode_request_user_input feature switched on, through a wrapper for that run only (nothing in the user's Codex config changed).

Pending three-question ask: the row opens to list every question:
codex pending codex pending open

After answering the first question, it becomes a plain line and the other two regroup into a row that opens again:
codex after q1 codex regrouped open

Answered and cancelled: every question stays readable:
codex answered codex cancelled

Keyboard focus, and still open after scrolling away and back:
codex focus codex back

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

New receipt tests: a cancelled grouped prompt opens to list every question outside the button, folds with focus kept, and stays open across a remount; a pending grouped prompt lists its questions; an answered grouped prompt stays plain and shows each question once; a cancelled single question that fits stays plain text; after the first question of an opened pending Codex prompt is answered, its own line is not left expanded. The existing tool-activity test that the "2 questions" line offers no toggle still passes, and the shared tests now assert the question texts. Each new test was checked to fail with its part of the change removed.

Ran: the native-chat renderer tests and shared ask-row tests (194 files, 1952 tests), pnpm tc, pnpm run check:code-quality:changed, pnpm run check:react-doctor:changed, and oxlint on the touched files. Live Electron QA (Claude): pending, cancelled and answered asks, text selection, keyboard, scroll away and back, and the single-question rows all behaved as described above. Live Codex QA (with Codex's own question feature switched on for the run): pending, answering one question at a time, answered, cancelled, keyboard, and scroll away and back all passed.

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

Renderer-only. No new user-facing text, so no translation changes. Nothing persisted or sent over the wire changes, so SSH and remote hosts and mixed client versions are unaffected. Mobile does not import the changed shared module.

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)

A cancelled or pending structured ask with several questions showed only
"Asked: 2 questions", and its questions appeared nowhere in the transcript.
The row's subject now carries the question texts instead of a count, and
the row unfolds them as a list below its toggle unless the record already
lists them with their answers.

@pullfrog pullfrog 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.

ℹ️ No critical issues — one minor suggestion inline.

Reviewed changes

  • Grouped asks now carry their question texts — NativeChatAskRowSubject's { kind: 'count'; count } becomes { kind: 'questions'; questions: string[] }, and the row derives its "N questions" label from questions.length (src/shared/native-chat-ask-row.ts).
  • The awaiting row can list a grouped prompt — a new listsQuestions prop (default true) gates a numbered <ol> below the toggle and makes the count line togglable without a clipping measurement (NativeChatAwaitingInputRow.tsx).
  • Callers opt out where the questions are already shown — the receipt passes listsQuestions={answers.length === 0} so cancelled/pending groups expand while resolved groups stay plain; NativeChatToolRun passes false to keep the tool-run line count-only (NativeChatResolutionReceipt.tsx, NativeChatToolRun.tsx).
  • Tests — new grouped-prompt receipt cases (cancelled list, copy-outside-button, remount-open, fold-keeps-focus; pending list; resolved stays plain) plus updated shared subject assertions.

I traced every consumer of NativeChatAskRowSubject / nativeChatAskRunSubject; the only production callers are the two components updated here, and the subject is computed at draw time so nothing persisted or sent changes shape.

ℹ️ Nitpicks

  • The JSDoc on NativeChatAwaitingInputRow (lines 23-26) still says a grouped prompt becomes a disclosure unconditionally. With the new listsQuestions opt-out that is only true for callers that leave it true; a clause noting the opt-out would keep the comment honest.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Comment on lines +138 to +141
{questions.map((entry) => (
<li key={entry} className="whitespace-pre-wrap break-words">
{entry}
</li>

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.

The question text is used as the React key, so a prompt that repeats a question produces duplicate keys — React warns and reconciles the duplicates unpredictably. The list is static, so an index key is unique and matches the existing pattern (NativeChatQuestionCard.tsx:166).

Suggested change
{questions.map((entry) => (
<li key={entry} className="whitespace-pre-wrap break-words">
{entry}
</li>
{questions.map((entry, index) => (
<li key={index} className="whitespace-pre-wrap break-words">
{entry}
</li>

…stion

A pending Codex group is keyed by its first question, which becomes its own row once answered. Opening the list left that row expanded, and folding it could drop the toggle under the pointer. The list and a lone question now remember their open state separately.
@coderabbitai

coderabbitai Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

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: 2f0b0695-c212-4e3a-a454-e0ea951574ec

📥 Commits

Reviewing files that changed from the base of the PR and between 995c100 and 4a9a848.

📒 Files selected for processing (2)
  • src/renderer/src/components/native-chat/NativeChatAwaitingInputRow.tsx
  • src/renderer/src/components/native-chat/NativeChatResolutionReceipt.test.tsx

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

Grouped-question subjects now contain the individual question texts rather than only a count. Awaiting-input rows can show the count and expand to an ordered question list. Receipt and tool-run callers control whether the row lists grouped questions. Tests cover pending, cancelled, and resolved grouped prompts, plus a cancelled single question.

Priority: ⬇️ Low

Priority: ⬇️ Low

Priority: ⬇️ Low

Priority: ⬇️ Low

Estimated code review effort:

Merge Risk: ⚪ Minimal · up to 4a9a8

The grouped-question display change is mergeable after normal checks; no additional blocking issue is established.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 4a9a8

Readers of a native-chat transcript can now expand unanswered or cancelled grouped prompts to see their questions. The change appears confined to display behavior, with no identified new privilege or execution path. The origin and access controls for the underlying transcript were not fully established.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The newly visible content is limited by the examined change to grouped question text in native-chat transcript rows, notably pending and cancelled receipts; who can access those transcripts was not established.

Trust Boundaries and Controls

  • observed — The examined tool-input-to-display path trims question strings and presents them as text. The tool-run caller suppresses the new list; the examined row adds no network, credential, or executable sink.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 6 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 main change: allowing multi-question native-chat asks to list their questions.
Description check ✅ Passed The description is complete and directly matches the changes. It covers the user-facing behavior, mechanism, rationale, linked issue reference, visual proof, testing, compatibility considerations, and…
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

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.

@pullfrog pullfrog 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.

✅ No new issues found.

Reviewed changes

  • A grouped prompt's list no longer leaks its open state onto a lone question — NativeChatAwaitingInputRow now builds its disclosure key as ${disclosureKey}:questions while the subject is a grouped questions subject, so the open state a reader sets on a pending Codex group does not auto-expand the first question's own row once that question is answered (both share the message id ask:<id> otherwise).
  • Test — a new receipt case builds a two-question Codex group, opens it, answers the first question, and asserts the resulting single-question row stays truncated with no toggle. The assertions fail without the key split, so the coverage is real.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Review status: ready for review

Head: 4a9a848219. CI: 18 passed, 15 skipped, 0 failed.

What this fixes. In structured Claude and Codex chats, a multi-question ask left a row reading "Asked: 2 questions". When the ask was cancelled, its questions were shown nowhere. While it was pending, a Codex ask showed only its first question, because the Codex answer card shows one question at a time. The row can now be opened to list every question in full, below the header, where the text can be selected. An answered ask already lists each question with its answer, so its row stays plain and nothing shows twice.

Review loops. Converged in two loops.

  • The start readiness check found one real bug: Codex records each question separately, so answering the first question left that question's row stuck open with the open state of the whole list. Loop 1 fixed it by keeping a list's open state separate from a single question's, and added a test built from real Codex record data.
  • Loop 1 also examined, and kept, two design points:
    • The pending row toggles because the Codex card shows only the first question.
    • Whether a record already lists its questions is worked out from its own answers.
  • Loop 2 was clean.

Readiness checks. Both passed. The end check found no issues.

Live QA, on a background dev build of this head on a second Mac with an isolated profile, using real structured Claude chats:

  • pending, cancelled and answered asks
  • selecting text in the opened list
  • keyboard (Tab, Enter, Space)
  • scroll away and back
  • a single long question still unfolds, and a short one stays plain

All passed. Screenshots are in the PR body. Live Codex QA was blocked by the Codex service on that machine: turns failed with an upstream HTTP 502 or ended empty, so no question reached the chat. The Codex paths are covered by tests only.

Known and accepted:

  • With a pending Codex list open, answering a question folds the list. The answered question becomes its own row and the rest regroup, and the regrouped list opens again with one click.
  • While a Claude ask is pending, the opened list repeats the questions the answer card already shows as tabs.

Not caused by this PR (possible follow-ups):

  • The Codex answer card doesn't say more questions are coming, e.g. "1 of 3".
  • An answered record reads "Answered on desktop-renderer" on a dev profile, which looks like an internal name reaching the UI.
  • The floating "Jump to latest" button can cover a transcript line.

Stacked follow-up: #23455 extends this to terminal-based chats and adds answers where the transcript records them.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Codex live QA follow-up (head 4a9a848219). I ran a second attempt on another Mac, with a working Codex login, in a background dev build with an isolated profile. Codex turns completed normally, but Codex never asked a question: it replied that request_user_input "is unavailable in Default mode". Codex allows its question tool only in Plan mode, and a default structured Codex chat runs in Default mode. So a multi-question Codex ask doesn't come up in a default structured chat. This PR's Codex paths (pending group, answering one question at a time, cancelled) remain covered by tests only, including a test built from real Codex record shapes. The Claude paths were verified live above.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Codex verified live (head 4a9a848219). A default structured Codex chat cannot ask questions, because Codex only offers its question tool in Plan mode. So this run started Codex with its own default_mode_request_user_input feature switched on, through a wrapper for that run only. The run used a background dev build with an isolated profile, and the user's Codex config was untouched. Every scenario passed:

  • a pending three-question row opens to list every question
  • after the first answer, that question becomes a plain line and the rest regroup into a row that opens again
  • answered and cancelled asks keep every question readable
  • keyboard (Tab, Enter, Space) works
  • an opened list survives scrolling away and back

There were no console errors and no duplicate-key warnings. Screenshots are in the PR body.

Found during this run, not caused by this PR (this PR changes only the question-row components and shared row data, not how rows are ordered):

  • Plan mode is unreachable in structured chats. A structured chat can't enter Plan mode: /plan is refused with "/plan is not available in chat sessions", and there is no mode control. So without that Codex feature, users never see a Codex question in a structured chat today.
  • Codex question rows appear out of order. Answered questions appear newest first (Q3, Q2, Q1). Cancelled ones appeared as Q2, Q1, Q3, on two tries. After answering Q1, the pending group of the remaining questions sits above the answered Q1.

@brennanb2025
brennanb2025 merged commit 7a3735f into main Sep 28, 2026
33 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.

1 participant