Skip to content

feat(site/src): answer async agent questions in the timeline while the agent works - #31294

Open
ibetitsmike wants to merge 5 commits into
mike/codagt-1460-async-answer-messagesfrom
mike/codagt-1460-async-ask-user-question
Open

ibetitsmike wants to merge 5 commits into
mike/codagt-1460-async-answer-messagesfrom
mike/codagt-1460-async-ask-user-question

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Oct 26, 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: 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 (this PR): 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

What changes (site/src)

  • An async question card can be answered while the chat is streaming. The answer goes out as a normal message with the call line from feat(site/src/pages/AgentsPage): show async question answers without their call line #31315.
  • deriveAskUserQuestionState decides which question is open and which answer each card shows, from the transcript, the live stream and the queue:
    • An async question is answered only by a message that names its call, persisted or still queued. Unrelated messages do not close it.
    • It closes when a newer valid question replaces it, and then shows its text with "This question is closed." and no options. A call counts as newer only once its result shows that it passed validation, so a running or failed call closes nothing.
    • Providers can reuse a call ID in a later turn, so answers are keyed by call occurrence. A delivered answer belongs to the newest call before it with its ID; a queued one counts only if it was queued after that call started. parseMessagesWithMergedTools now pairs each tool result with the nearest earlier call that has its ID, so an older result no longer makes a running question look finished.
    • Blocking (plan-mode) questions keep today's rule, except that an answer to an earlier async call no longer closes them.
  • Removing a queued answer makes the card answerable again. "Send now" keeps it answered: the chat store holds the promoted message until the transcript has the user row the server created from it (queued_message_id), so the card does not reopen while the promote runs.
  • While the transcript or the queue has the answer, the card hides a send error, for example when the server stored the answer but the response failed, or another tab answered.
  • When an async question opens, a polite status region tells screen reader users that the agent asked a question. Only a card that can take the answer announces.

Validation

Vitest (askUserQuestionState.test.ts, messageParsing.test.ts, chatQueueReconciliation.test.ts, ConversationTimeline.test.tsx, AskUserQuestionTool.test.tsx) and the Storybook tests for the touched stories pass, as do biome, oxlint, tsc, knip and the pre-commit hook. The hidden send error has no Vitest test, because its only outcome is whether an alert is shown. Earlier remote dogfood UAT rounds of the combined stack with a real model checked the closed card, the queued-answer timing, a running 25-second call that did not close the open question, and "Send now" delivering a queued answer once without the card reopening.

Accepted limit

After a reload, the newest history page loads the whole active turn (#30524), so an open async question is on the page. The page stops filling at 1,000 messages or when a fill request fails; then a question outside the page shows once the user scrolls back to it.

Known follow-ups (not in this stack)

  • A chat-list indicator.
  • When a provider reuses a call ID, an answer to the older question that arrives after the newer call counts for the newer call, which is also how the model reads it. Exact routing needs question IDs from the server.

@linear-code

linear-code Bot commented Oct 26, 2026

Copy link
Copy Markdown

CODAGT-1460

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 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:36:03.905823Z 95dfb69 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: ed3fb3e9ee

ℹ️ 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".

Comment thread coderd/x/chatd/chatd_test.go Resolved
@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Docs preview

Check off each page once it's been reviewed. If a page changes in a later push, its checkbox clears automatically so it gets a fresh look. Pages not yet wired into the docs navigation aren't listed here.

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

Xum posted this comment for Mike.

@codex review

1 similar comment
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

Xum posted this comment for Mike.

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

ℹ️ 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

Xum posted this comment for Mike.

@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: 36c84fb8d1

ℹ️ 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
ibetitsmike changed the base branch from main to mike/codagt-1460-chatd-async-ask October 26, 2026 23:49
@ibetitsmike
ibetitsmike added this pull request to stack #31311 October 26, 2026 23:49
@ibetitsmike ibetitsmike changed the title feat: let web UI chats ask questions without ending the turn feat(site/src/pages/AgentsPage): answer async questions while the agent works Oct 26, 2026
@ibetitsmike ibetitsmike changed the title feat(site/src/pages/AgentsPage): answer async questions while the agent works feat: answer async agent questions in the web UI while the agent works Oct 26, 2026
@ibetitsmike
ibetitsmike removed this pull request from stack #31311 October 27, 2026 00:38
@ibetitsmike
ibetitsmike changed the base branch from mike/codagt-1460-chatd-async-ask to mike/codagt-1460-async-answer-messages October 27, 2026 00:38
@ibetitsmike
ibetitsmike added this pull request to stack #31316 October 27, 2026 00:38
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

Xum posted this comment for Mike.

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 4e9ec87aff

ℹ️ 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

Xum posted this comment for Mike.

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: bdfe251afc

ℹ️ 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

Xum posted this comment for Mike.

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 76eeb633c6

ℹ️ 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

Xum posted this comment for Mike.

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

ℹ️ 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

Xum posted this comment for Mike.

@codex review

@ibetitsmike
ibetitsmike removed this pull request from stack #31316 October 30, 2026 21:22
@ibetitsmike
ibetitsmike added this pull request to stack #31597 October 30, 2026 21:23
@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 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: 42afde0c25

ℹ️ 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".

Comment thread site/src/testHelpers/renderHelpers.tsx Resolved
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: 1e426687f3

ℹ️ 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: bebea2ed3e

ℹ️ 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. You're on a roll.

Reviewed commit: 430b786567

ℹ️ 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. Bravo.

Reviewed commit: 95dfb69d32

ℹ️ 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.

4 inline findings and 1 below.

whole PR

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

Remedy: split

Coverage
Coverage: 26 of 26 files reviewed; 35 rules.
Candidates: 430 found, 383 outside changed lines, 3 already discussed, 44 evaluated.
Findings: 5 (12 sites, 2 pre-existing sites), 0 over budget, 0 failed.
Model: deepseek/deepseek-v4.1-flash; 35 questions, 35 answered, 0 abstained, 0 cached; 0 uncalibrated findings held back; 36373 input and 17630 output tokens.
Experiments: 3 run, 0 passed, 3 vetoed, 0 unverified, 0 skipped for time.
  vetoed: TYPE-1 site/src/pages/AgentsPage/components/ChatConversation/askUserQuestionState.ts:29: 1 new type error, first src/pages/AgentsPage/components/ChatConversation/askUserQuestionState.ts: TS2345 Argument of type 'string 
  vetoed: TYPE-1 site/src/pages/AgentsPage/components/ChatElements/tools/asyncAnswer.ts:50: 3 new type errors, first src/pages/AgentsPage/components/ChatElements/tools/AskUserQuestionTool.tsx: TS2345 Argument of type 'string 
  vetoed: TYPE-1 site/src/pages/AgentsPage/components/ChatElements/tools/asyncAnswer.ts:51: 3 new type errors, first src/pages/AgentsPage/components/ChatElements/tools/AskUserQuestionTool.tsx: TS2345 Argument of type 'string 

* A selector cannot build this list: useSyncExternalStore needs a stable
* snapshot.
*/
export const useUndeliveredQueuedMessages = (

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.

ABS-1: useUndeliveredQueuedMessages only reads useChatSelector to compute [ ...queuedMessages, ...promotingQueuedMessages.filter((message) => suppressedQ…. Make it a pure function that takes that data as arguments, and call the hooks in the component.

Remedy: make-pure

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. The three selectors it reads are private to chatStore.ts, and the file already exposes composed reads as hooks (useChatMessages directly above follows the same pattern). A pure function would need those selectors exported and three more useChatSelector calls in ChatPageContent, which spreads the store's queue internals into the page. Leaving this open for you to decide.

@mafredri
mafredri force-pushed the mike/codagt-1460-async-ask-user-question branch from 95dfb69 to ac20ef6 Compare November 3, 2026 20:24
…e agent works

An async question does not end the turn, so its card stays answerable
while the chat streams, and closes once a newer valid question replaces
it. Answers are matched to their call by occurrence, because providers
can reuse a call ID in a later turn.

This is the net change of mike/codagt-1460-async-ask-user-question at
95dfb69, 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-async-ask-user-question branch from ac20ef6 to 8ebfda6 Compare November 6, 2026 19:25
…t-1460-async-ask-user-question

# Conflicts:
#	site/src/pages/AgentsPage/components/ChatElements/tools/AskUserQuestionTool.tsx
…ts and split long blocks

Deletes doc comments that describe the code below them and separates
the logical steps in the promote, timeline, and question form blocks
with blank lines.

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.

i'd be lying if i said i could understand what is going on here and why we've got such immense complexity for such a simple feature

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