Skip to content

feat(site/src/pages/AgentsPage): show ask_user_question options as numbered one-line answers - #31555

Open
ibetitsmike wants to merge 4 commits into
mike/codagt-1460-chatd-async-askfrom
mike/codagt-1460-question-options
Open

ibetitsmike wants to merge 4 commits into
mike/codagt-1460-chatd-async-askfrom
mike/codagt-1460-question-options

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

🤖 Xum opened this PR for Mike.

Stack

This stack lets the agent in Coder Agents web UI chats ask a question with ask_user_question without ending its turn. Chats created through the API and plan mode keep the blocking tool.

  1. feat: let web UI chats ask questions without ending the turn #31310: chatd gives web UI chats an async ask_user_question whose options are one-line answers, and sends a web push.
  2. feat(site/src/pages/AgentsPage): show ask_user_question options as numbered one-line answers #31555 (this PR): the question form shows options as numbered one-line answers that number keys pick, and keeps unsent answers per call.
  3. feat(site/src/pages/AgentsPage): show async question answers without their call line #31315: async answers show without their call line in the bubble, the queue, Copy, Edit and the prompt history.
  4. feat(site/src): answer async agent questions in the timeline while the agent works #31294: an async question card stays answerable while the agent works, and closes when a newer question replaces it.
  5. feat: pin the open async question above the chat input #31312: the open async question is pinned above the chat input, plus docs.

Refs CODAGT-1460

Why

The question text and its options read as one block, and each option was a short title plus a description, so the answer that went back to the agent ("Backend") said less than what the user read. #31310 makes each option one complete answer; this PR gives the form a layout for that.

What changes (site/src/pages/AgentsPage)

  • Each answer is its own bordered row with a number badge (the shared Kbd), and the whole first line of a row is the radio. The Other row is the same frame: its badge is the radio, and the borderless field fills the rest. Rows use RadioGroupPrimitive.Item directly, because the shared RadioGroupItem is the 16 px circle.
  • While focus is in the form, keys 1 to N pick a row and move focus to it, and Enter on a row moves to the next question or sends on the last one. Digits typed in the Other field stay text, and modifier chords and IME composition are ignored. The handler sits on the <form>, so digits typed in the chat input never answer; that needs an oxlint-disable for no-noninteractive-element-interactions, and each radio announces its key with aria-keyshortcuts. A shortcut hint shows at 640 px and wider with a fine pointer.
  • The question text renders as Markdown, and Next and Back move focus to the new question's text.
  • questionDraft.ts saves unsent answers and the current step in local storage per tool call, together with the questions they answer, so a remount or a reload keeps them. A saved draft whose questions differ is ignored, and a draft is removed once the chat's stream ends with a newer question in its place. Storage errors do not block the form.
  • Calls made before feat: let web UI chats ask questions without ending the turn #31310 still carry option descriptions. Those render under the answer, outside the label, linked with aria-describedby.
  • A question set that grows while it streams keeps working under the "Asking for clarification..." status, and a question the user has not touched takes its default once its options arrive.
  • questionAnswers.ts, QuestionStep.tsx and questionShortcuts.tsx hold the answer helpers, the option rows and question step, and the key handling, which keeps AskUserQuestionTool.tsx near 500 lines.

Validation

Vitest (AskUserQuestionTool.test.tsx, questionDraft.test.ts) and the Storybook tests for the touched stories pass, as do biome, oxlint, tsc and the pre-commit hook. Pixel screenshots change for every question story, plus the new ones (NumberKeySelection, OtherAnswerTyped, Submitting, LegacyOptionDescriptions, LongUnbrokenAnswers). Pixel's headless browser does not match pointer: fine, so the hint does not appear in snapshots.

@linear-code

linear-code Bot commented Oct 29, 2026

Copy link
Copy Markdown

CODAGT-1460

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@ibetitsmike
ibetitsmike removed this pull request from stack #31316 October 30, 2026 21:22
@ibetitsmike
ibetitsmike changed the base branch from mike/codagt-1460-question-focus to mike/codagt-1460-chatd-async-ask October 30, 2026 21:22
@ibetitsmike
ibetitsmike added this pull request to stack #31597 October 30, 2026 21:23
@ibetitsmike ibetitsmike changed the title feat: show ask_user_question options as numbered one-line answers feat(site/src/pages/AgentsPage): show ask_user_question options as numbered one-line answers Oct 30, 2026
@ibetitsmike
ibetitsmike marked this pull request as ready for review October 30, 2026 22:22
@ibetitsmike
ibetitsmike requested a review from a team as a code owner October 30, 2026 22:22
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-31T00:34:18.884077Z 922760c Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1661b99580

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cd7be1a091

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f26a8f639e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 922760c145

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 922760c145

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@DanielleMaywood DanielleMaywood left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This review was performed by ai-review, an automated review bot.

7 inline findings and 1 below.

whole PR

SCOPE-1: This PR changes 2163 lines in 13 files (limit 1000). Split it into smaller PRs.

Remedy: split

Coverage
Coverage: 13 of 13 files reviewed; 35 rules.
Candidates: 296 found, 253 outside changed lines, 4 already discussed, 39 evaluated.
Findings: 8 (22 sites, 3 pre-existing sites), 0 over budget, 0 failed.
Model: deepseek/deepseek-v4.1-flash; 32 questions, 32 answered, 0 abstained, 0 cached; 0 uncalibrated findings held back; 32269 input and 9120 output tokens.

<div className="w-full">
{isRunning && (
return isInteractive ? (
// oxlint-disable-next-line jsx-a11y/no-noninteractive-element-interactions -- Takes keys from the radios and the focused question text; the radios announce them with aria-keyshortcuts.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LINT-1: New oxlint-disable-next-line suppression for jsx-a11y/no-noninteractive-element-interactions. Is it needed, or can the code be fixed instead?

Remedy: ask

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Xum posted this reply for Mike.

Yes, it is needed. The form handles number keys and Enter for the whole question step: the keys bubble up from the radios and from the focused question text, and the radios announce them with aria-keyshortcuts. A <form> is a non-interactive element to this rule, and moving the handler onto each radio would miss keys pressed on the question text. ThemeSwatch.tsx on main uses the same suppression for the same reason. Leaving this open in case you see a structure that avoids it.

},
onSuccess: (_data, message) => {
setSubmittedResponseText(message);
onSuccess: () => {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

REACT-8: Instead of onSuccess, call await mutateAsync(...) and handle the result after it, with try/catch for errors.

Remedy: use-await

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Xum posted this reply for Mike.

Not changing this. .claude/docs/FRONTEND_PATTERNS.md and site/AGENTS.md say to use mutate() with onSuccess/onError unless the result drives control flow. Here onSuccess only clears the saved draft, and the form reads the outcome from isSuccess, variables, and error, so mutateAsync would add a try/catch with nothing to do in it. Leaving this open for you to decide.

await userEvent.keyboard(" ");
expect(secondRadio).toBeChecked();

await userEvent.tab();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

TEST-1 (pre-existing, non-blocking): Story KeyboardNavigation asserts in its play function. Stories are covered by visual regression; keep play to state setup and move behaviour assertions to a Vitest test.

Remedy: move

Same at 1 other site:

  • site/src/pages/AgentsPage/components/ChatElements/tools/AskUserQuestionTool.stories.tsx:316: Story KeyboardOtherSubmit asserts in its play function. Stories are covered by visual regression; keep play to state setup and move behaviour assertions to a Vitest test.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Xum posted this reply for Mike.

Leaving this for a separate change. Both stories and their play assertions are on main, and this PR only updates their option text and queries for the new layout, so moving the assertions to Vitest is outside this PR's scope.

@mafredri
mafredri force-pushed the mike/codagt-1460-question-options branch from 922760c to 6b94d7d Compare November 3, 2026 20:24
…mbered one-line answers

The options are now one complete answer each (#31310), so the form
gives each answer its own numbered row that number keys pick, renders
the question as Markdown, and keeps unsent answers per call in local
storage so a reload does not lose them.

This is the net change of mike/codagt-1460-question-options at
922760c, collapsed into one commit to rebase it onto main without
replaying the merges from the layer below.
@mafredri
mafredri force-pushed the mike/codagt-1460-question-options branch from 6b94d7d to 2998c42 Compare November 6, 2026 19:25
…op comments that restate the code

Deletes doc comments that only repeat a name or describe the code below
them, and separates the form's setup steps with blank lines.

This branch has not been deployed

No deployments
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.

2 participants