Skip to content

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

Open
gcsecsey wants to merge 5 commits into
trunkfrom
stu-2320-fix-multi-question-prompts-in-classic-studio-code-ui-v1
Open

Studio Code: unblock multi-question prompts with a user reply#4689
gcsecsey wants to merge 5 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. Neither GUI offered a way out except picking one of the agent's options or pressing Stop.

  • Sending a reply while questions are pending now cancels them and delivers the message as a new turn, so the conversation is never stuck. The trade-off is visible: the transcript shows an "Interrupted by you" marker, because that is what happens under the hood.
  • Each question now offers a "Something else" option. The agent is already told the system appends one (and so never writes its own), but only the terminal UI ever kept that promise. Choosing it focuses the composer and the placeholder changes to match.
  • Both front ends get the same treatment, since they share the behaviour but not the code.

Open question for UX, @shaunandrews: should a typed reply answer the pending question instead of cancelling it? I'm not sure if the current changes are the right solution for this or not. We should come up with an elegant way of handling the "something else" options, ideally:

  • by reusing the main text field instead of adding a secondary one
  • using this option as an escape hatch to go to the next question, or finish the question block

The CLI persists answers in a form the transcript hides from the message flow, so the typed text would vanish from the chat unless free-form answers are also rendered in both apps. The marker question resolves along with this one, since cancelling honestly earns the marker and answering never shows one.

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 19ee359 vs trunk

app-size

Metric trunk 19ee359 Diff Change
App Size (Mac) 1422.56 MB 1422.57 MB +0.01 MB ⚪ 0.0%

site-editor

Metric trunk 19ee359 Diff Change
load 1170 ms 1205 ms +35 ms ⚪ 0.0%

site-startup

Metric trunk 19ee359 Diff Change
siteCreation 7522 ms 7526 ms +4 ms ⚪ 0.0%
siteStartup 3397 ms 3386 ms 11 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.

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.

4 participants