Fix duplicated question text from agent host#312655
Draft
roblourens wants to merge 2 commits intomainfrom
Draft
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses an Agent Host “Ask User” UX issue where the question text is rendered twice in the questions widget by changing how SessionInputRequest is populated/typed.
Changes:
- Stop populating
SessionInputRequest.messagefor Copilot SDKask_userrequests. - Make
SessionInputRequest.messageoptional in the protocol types. - Update the synced Agent Host Protocol version hash.
Show a summary per file
| File | Description |
|---|---|
| src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts | Omits the top-level input-request message when building SessionInputRequest for ask_user. |
| src/vs/platform/agentHost/common/state/protocol/state.ts | Changes protocol type so SessionInputRequest.message is optional. |
| src/vs/platform/agentHost/common/state/protocol/.ahp-version | Bumps the synced protocol commit hash. |
Copilot's findings
Comments suppressed due to low confidence (2)
src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts:564
SessionInputRequestis now emitted without the top-levelmessage. Downstream UI code assumesinputReq.messageis a string (e.g. passed intorawMarkdownToString(...)) and will either fail to type-check or can produce runtime issues/blank titles whenmessageisundefined. To fix the duplicated text without breaking consumers, consider keepingmessageas a string and setting it to an empty string (so it won’t render), or update all consumers/tests to toleratemessagebeing absent (and derive a display message from the first question).
// Build the protocol SessionInputRequest from the SDK's simple format
const inputRequest: SessionInputRequest = {
id: requestId,
questions: [request.choices && request.choices.length > 0
? {
kind: SessionInputQuestionKind.SingleSelect,
id: questionId,
message: request.question,
required: true,
options: request.choices.map(c => ({ id: c, label: c })),
allowFreeformInput: request.allowFreeform ?? true,
}
: {
kind: SessionInputQuestionKind.Text,
id: questionId,
message: request.question,
required: true,
},
],
};
src/vs/platform/agentHost/common/state/protocol/state.ts:672
- Changing
SessionInputRequest.messagefrom required to optional is a breaking protocol/API change for existing clients/renderer code that treat it as always present (and pass it to helpers that require astring). If the goal is only to avoid duplicated question text, it’s safer to keep this field required and allow an empty string, or bump/gate the protocol and update all call sites to handlemessage === undefined(including any schema/TS types and tests).
export interface SessionInputRequest {
/** Stable request identifier */
id: string;
/** Display message for the request as a whole */
message?: string;
/** URL the user should review or open, for URL-style elicitations */
url?: URI;
/** Ordered questions to ask the user */
questions?: SessionInputQuestion[];
- Files reviewed: 3/3 changed files
- Comments generated: 0
auto-merge was automatically disabled
April 27, 2026 04:02
Pull request was converted to draft
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix #311121