Conversation
…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
… and a nonexistent emitProgress export
There was a problem hiding this comment.
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_userwhen 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.
📊 Performance Test ResultsComparing 5e14fb7 vs trunk app-size
site-editor
site-startup
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
left a comment
There was a problem hiding this comment.
@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.
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. |
|
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. |
…uestion-prompts-in-classic-studio-code-ui-v1 # Conflicts: # apps/ui/src/data/queries/use-agent-run.test.tsx # apps/ui/src/ui-classic/components/session-view/composer/index.tsx # apps/ui/src/ui-classic/components/session-view/index.tsx
@gavande1 good catch thanks! This was caused by the cancellation killing the run while Replying no longer cancels anything, so this should be resolved. Could you take another look?
@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.
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.”
|
…uestion-prompts-in-classic-studio-code-ui-v1 # Conflicts: # apps/ui/src/ui-classic/components/session-view/index.tsx
Thanks @shaunandrews, both of these are good catches, and I fixed both. The custom answer is now appended as a message to the history:
And we're also scrolling the options into view when there's a longer history:
|
…sic-studio-code-ui-v1
…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.
…sic-studio-code-ui-v1
|
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! |











Related issues
How AI was used in this PR
It was used to identify and solve the issue.
Proposed Changes
AskUserQuestionblocks 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.Testing Instructions
Help me build a small WordPress plugin from scratch. Ask me what problem it should solve and how it should be structured.it should be a mu-pluginand send it.Pre-merge Checklist