Skip to content

Studio Code: unblock multi-question prompts with a user reply - #4689

Merged
wojtekn merged 19 commits into
trunkfrom
stu-2320-fix-multi-question-prompts-in-classic-studio-code-ui-v1
Sep 15, 2026
Merged

wojtekn merged 19 commits into
trunkfrom
stu-2320-fix-multi-question-prompts-in-classic-studio-code-ui-v1

Conversation

@gcsecsey

@gcsecsey gcsecsey commented Aug 26, 2026

Copy link
Copy Markdown
Member

Related issues

How AI was used in this PR

It was used to identify and solve the issue.

Proposed Changes

AskUserQuestion blocks the agent until every question in the batch is answered. Until now, a message typed while those questions were on screen went into the follow-up queue, and that queue only drains when the run goes idle. A run waiting for answers never does, so the message sat there and nothing happened.

  • A reply typed in the composer now answers the question the agent is waiting on. Nothing is canceled, the agent carries on in the same turn, and the typed answer appears in the transcript as a message.
  • Each question offers a “Something else” option that focuses the composer. When the model writes its own escape hatch we drive the composer from that one instead of appending a second.
  • The Stop button still force-interrupts, but closes the pending question call first. A call killed without a result reads to the model as a broken tool, after which it abandons the question UI and writes its options out in plain text.
  • Attachments are disabled while a question is pending, because answers are plain strings.
  • Both UIs get the same treatment, since they share the behavior.

Testing Instructions

  • Ask the agent something that makes it ask back, for example: Help me build a small WordPress plugin from scratch. Ask me what problem it should solve and how it should be structured.
  • When the questions appear, type an alternative reply, eg. it should be a mu-plugin and send it.
  • Before this change the reply became a queued chip and the agent stayed stuck. Now the questions are dismissed and the reply runs as a new turn.
  • Click "Something else" instead. The composer should take focus and the placeholder should read "Type your own answer…".
  • With no questions pending, send a message mid-run. It should still queue and run after the turn ends, unchanged.
State Classic UI Agentic UI
Questions pending CleanShot 2026-08-26 at 13 32 07@2x CleanShot 2026-08-26 at 13 30 08@2x
"Something else" selected CleanShot 2026-08-26 at 13 32 44@2x CleanShot 2026-08-26 at 13 30 49@2x
After sending a reply CleanShot 2026-08-26 at 13 32 59@2x CleanShot 2026-08-26 at 13 30 56@2x

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

…uestion-prompts-in-classic-studio-code-ui-v1

# Conflicts:
#	apps/studio/src/components/studio-code-session/index.tsx
#	apps/ui/src/ui-classic/components/session-view/index.tsx
@gcsecsey gcsecsey changed the title Studio Code: let a typed reply unblock the chat while the agent is asking questions Studio Code: unblock multi-question prompts with a user reply Aug 26, 2026
@gcsecsey
gcsecsey requested review from a team and shaunandrews and a lite review from Copilot August 26, 2026 12:35
@gcsecsey
gcsecsey marked this pull request as ready for review August 26, 2026 12:35

Copilot AI 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.

Pull request overview

This PR updates Studio Code’s chat runtimes (Classic UI, Agentic UI, and CLI tool progress) to prevent conversations from getting stuck when the agent is blocked on AskUserQuestion and the user replies via the composer. It introduces a consistent “Something else” free-form escape hatch for question batches and ensures typed replies can interrupt a blocked run so the message is delivered as a new turn.

Changes:

  • Add shared helpers for the “Something else” free-form option and detection of model-supplied equivalents.
  • Update both UIs to append and render the free-form option for pending questions, including composer placeholder/focus behavior.
  • Interrupt a run blocked on ask_user when the user sends a reply, so queued messages are not stranded behind a non-idling run.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/common/ai/tools.ts Adds shared “Something else” label/description helpers and detection for model-provided free-form options.
apps/ui/src/ui-classic/components/session-view/index.tsx Tracks an armed free-form question and wires it into Conversation + Composer behavior.
apps/ui/src/ui-classic/components/session-view/conversation/style.module.css Styles the appended free-form option as secondary until armed.
apps/ui/src/ui-classic/components/session-view/conversation/selection.test.tsx Updates test harness to pass new Conversation props.
apps/ui/src/ui-classic/components/session-view/conversation/index.tsx Renders the appended free-form option and forwards arming callbacks/state.
apps/ui/src/ui-classic/components/session-view/conversation/index.test.ts Adds coverage for free-form option rendering/arming and de-duplication.
apps/ui/src/ui-classic/components/session-view/composer/index.tsx Adds focus handle + placeholder/label logic for awaiting-answer and free-form mode.
apps/ui/src/data/queries/use-agent-run.tsx Interrupts blocked ask_user runs when sending a reply so the queued message can dispatch.
apps/ui/src/data/queries/use-agent-run.test.tsx Adds test coverage for interrupting blocked question runs before dispatching queued replies.
apps/studio/src/components/studio-code-session/use-agent-run.tsx Mirrors the “interrupt blocked question runs on reply” behavior in the desktop UI hook.
apps/studio/src/components/studio-code-session/tests/use-agent-run.test.tsx Adds desktop UI test coverage for interrupting blocked question runs before continuing.
apps/studio/src/components/studio-code-session/index.tsx Tracks armed free-form question and wires it into Conversation + Composer focus/placeholder behavior.
apps/studio/src/components/studio-code-session/conversation/style.module.css Visually distinguishes the appended free-form option (dashed border + secondary color).
apps/studio/src/components/studio-code-session/conversation/index.tsx Renders the appended free-form option and forwards arming callbacks/state.
apps/studio/src/components/studio-code-session/conversation/index.test.tsx Adds coverage for free-form option rendering/arming and de-duplication.
apps/studio/src/components/studio-code-session/composer/index.tsx Adds placeholder logic for awaiting-answer/free-form and supports focus requests.
apps/cli/ai/tools/generate-images.ts Switches progress reporting to tool context onProgress instead of CLI logger progress emission.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread apps/ui/src/ui-classic/components/session-view/index.tsx
Comment thread apps/studio/src/components/studio-code-session/index.tsx
@wpmobilebot

wpmobilebot commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing 5e14fb7 vs trunk

app-size

Metric trunk 5e14fb7 Diff Change
App Size (Mac) 1458.92 MB 1458.94 MB +0.02 MB ⚪ 0.0%

site-editor

Metric trunk 5e14fb7 Diff Change
load 1190 ms 1196 ms +6 ms ⚪ 0.0%

site-startup

Metric trunk 5e14fb7 Diff Change
siteCreation 7487 ms 7496 ms +9 ms ⚪ 0.0%
siteStartup 3365 ms 3375 ms +10 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

…uestion-prompts-in-classic-studio-code-ui-v1

# Conflicts:
#	apps/cli/ai/tools/generate-images.ts

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

@gcsecsey Thanks for working on this. I tested it and it works as expected. I saw a message that said following, is that expected? Also, in my ongoing session, it never prompted me to answer questions, it just kept going in chat format.

Image

@gcsecsey

Copy link
Copy Markdown
Member Author

@gcsecsey Thanks for working on this. I tested it and it works as expected. I saw a message that said following, is that expected? Also, in my ongoing session, it never prompted me to answer questions, it just kept going in chat format.

Image

Thanks for testing @gavande1! 🙌 I think it must be an issue with these changes, earlier the prompts were always presented via the question prompt UI. I'll try to reproduce and check what's going wrong here.

@shaunandrews

Copy link
Copy Markdown
Contributor

I think the composer should allow the user to respond to the current pending question. We should have the stop button as well, as a way to forcefully interrupt the agent.

Cancelling the question tool feels unexpected, and confusing. It feels natural (to me) to use the composer as a way to give freeform answers. The placeholder should change to something like "Write your own answer to the question..." to help indicate that you can use the composer to answer.

A next step might be looking to attach the question UI to the composer, so its more visually connected, and the composer becomes a natural last option in the list.

@gcsecsey

gcsecsey commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

@gcsecsey Thanks for working on this. I tested it and it works as expected. I saw a message that said following, is that expected? Also, in my ongoing session, it never prompted me to answer questions, it just kept going in chat format.
Image

Thanks for testing @gavande1! 🙌 I think it must be an issue with these changes, earlier the prompts were always presented via the question prompt UI. I'll try to reproduce and check what's going wrong here.

@gavande1 good catch thanks! This was caused by the cancellation killing the run while AskUserQuestion was still waiting, and so the call was recorded without tool result. On the next turn the agent read its own unanswered call, and thought that the question tool was broken.

Replying no longer cancels anything, so this should be resolved. Could you take another look?

I think the composer should allow the user to respond to the current pending question. We should have the stop button as well, as a way to forcefully interrupt the agent.

@shaunandrews thanks for the review! I agree that this is a much better UX, and I implemented these changes now.

Typing in the composer now answers the question, instead of cancelling the batch. The reply goes to the question the agent is waiting on. The agent continues in the same turn once the last question is answered.

Every question shows a "Something else" option. Clicking it focuses the composer and the placeholder changes to "Write your own answer to the question...". If the model wrote its own escape hatch (some models do, despite being told not to), we use that one rather than appending a second option. Earlier, clicking the model’s own option sent the literal string "Something else" as the answer, and the agent had to do an extra round asking what you actually meant.

classic agentic ui
image image

The Stop button is unchanged and still interrupts the turn. But it now closes the pending question call, any options the user already picked are sent as-is, and the rest are answered with “The user stopped the run without answering.”

classic agentic ui
CleanShot 2026-09-09 at 17 38 52@2x image

…uestion-prompts-in-classic-studio-code-ui-v1

# Conflicts:
#	apps/ui/src/ui-classic/components/session-view/index.tsx
@gcsecsey
gcsecsey requested a review from a team September 11, 2026 11:00
@shaunandrews

Copy link
Copy Markdown
Contributor

Nice! Works well. My only point of feedback is around showing my custom response. Right now when I type a response in the composer for a question, when I submit I never see that show up in the conversation.

image

I would have expected my custom response to show up as a normal message in the conversation, just below the predefined responses.

Also, I think we had solved this previously but the questions predefined responses often don't scroll into view when asked. I end up seeing just the first response, and the rest are under the composer out of view:

image

@gcsecsey

Copy link
Copy Markdown
Member Author

Nice! Works well. My only point of feedback is around showing my custom response. Right now when I type a response in the composer for a question, when I submit I never see that show up in the conversation.

image I would have expected my custom response to show up as a normal message in the conversation, just below the predefined responses.

Also, I think we had solved this previously but the questions predefined responses often don't scroll into view when asked. I end up seeing just the first response, and the rest are under the composer out of view:

image

Thanks @shaunandrews, both of these are good catches, and I fixed both.

The custom answer is now appended as a message to the history:

image

And we're also scrolling the options into view when there's a longer history:

image

gcsecsey and others added 3 commits September 11, 2026 16:52
…uestion-prompts-in-classic-studio-code-ui-v1

Trunk landed #4830 (multi-select questions) and #4831, an independent take on
answering a pending question from the prompt box. Resolved by keeping this
branch's richer targeting (free-form arming, composer focus, attachment block)
behind trunk's `onAnswer` composer contract, so both sides' tests hold:

- Composer: trunk's `onAnswer` decides routing and the Send/Answer/Queue label,
  including its guard that a slash command still queues as a prompt. The
  branch's `awaitingAnswer` stays as the attachment gate.
- Session views: `onAnswer` is bound to the branch's `targetQuestion` (the armed
  question, else the next unanswered one) instead of wrapping `onSend`.
- AgentQuestion: trunk's multi-select draft/Confirm on top of the branch's
  free-form escape hatch.
- Typed answers now render in the question block (trunk) rather than as a
  separate user message (branch); dropped the duplicate and carried the
  branch's stop-marker filter into the new rendering, in both front ends.
@gcsecsey

Copy link
Copy Markdown
Member Author

I resolved the conflicts on this, it should be good to go, but it still needs an approval. @shaunandrews and @gavande1, could you give this another look? Thanks!

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

Design looks good.

@wojtekn
wojtekn merged commit 0dd3515 into trunk Sep 15, 2026
13 checks passed
@wojtekn
wojtekn deleted the stu-2320-fix-multi-question-prompts-in-classic-studio-code-ui-v1 branch September 15, 2026 08:25
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.

6 participants