Skip to content

Fix duplicated question text from agent host#312655

Draft
roblourens wants to merge 2 commits intomainfrom
roblou/conventional-giraffe
Draft

Fix duplicated question text from agent host#312655
roblourens wants to merge 2 commits intomainfrom
roblou/conventional-giraffe

Conversation

@roblourens
Copy link
Copy Markdown
Member

Fix #311121

Copilot AI review requested due to automatic review settings April 27, 2026 03:54
@roblourens roblourens enabled auto-merge (squash) April 27, 2026 03:54
@roblourens roblourens self-assigned this Apr 27, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 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.message for Copilot SDK ask_user requests.
  • Make SessionInputRequest.message optional 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

  • SessionInputRequest is now emitted without the top-level message. Downstream UI code assumes inputReq.message is a string (e.g. passed into rawMarkdownToString(...)) and will either fail to type-check or can produce runtime issues/blank titles when message is undefined. To fix the duplicated text without breaking consumers, consider keeping message as a string and setting it to an empty string (so it won’t render), or update all consumers/tests to tolerate message being 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.message from 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 a string). 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 handle message === 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

@roblourens roblourens marked this pull request as draft April 27, 2026 04:02
auto-merge was automatically disabled April 27, 2026 04:02

Pull request was converted to draft

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.

AgentHost: Question text is repeated in questions widget

2 participants