Skip to content

Remove auto-approval of user input in autopilot mode#309604

Merged
DonJayamanne merged 2 commits intomainfrom
don/corresponding-mosquito
Apr 13, 2026
Merged

Remove auto-approval of user input in autopilot mode#309604
DonJayamanne merged 2 commits intomainfrom
don/corresponding-mosquito

Conversation

@DonJayamanne
Copy link
Copy Markdown
Contributor

Eliminate the automatic approval of user input when in autopilot mode, requiring explicit user interaction for responses. This change enhances control over user input handling.

Fixes #307955

Copilot AI review requested due to automatic review settings April 13, 2026 20:11
@DonJayamanne DonJayamanne self-assigned this Apr 13, 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 updates the Copilot CLI chat session integration to stop short-circuiting user_input.requested events with an automatic response when the session is in autopilot mode, aligning behavior with the intent to require explicit handling of user input prompts.

Changes:

  • Removed the autopilot-only auto-response branch for user_input.requested in CopilotCLISession.
  • Ensures user_input.requested follows the existing askUserQuestion/question-carousel flow instead of injecting a hardcoded response.
Show a summary per file
File Description
extensions/copilot/src/extension/chatSessions/copilotcli/node/copilotcliSession.ts Removes autopilot auto-response logic for user_input.requested, routing prompts through the question handler flow.

Copilot's findings

Comments suppressed due to low confidence (2)

extensions/copilot/src/extension/chatSessions/copilotcli/node/copilotcliSession.ts:535

  • The PR description says user input in autopilot now requires explicit user interaction, but this handler routes user_input.requested through CoreAskQuestions (via askUserQuestion). The built-in AskQuestions tool auto-responds when request.modeInfo.permissionLevel is Autopilot, so user input may still be auto-approved. Either adjust the PR description to match the actual behavior, or change this flow/tool invocation so autopilot does not auto-answer and instead blocks until the user responds.

This issue also appears on line 522 of the same file.

			disposables.add(toDisposable(this._sdkSession.on('user_input.requested', async (event) => {
				if (!(this._toolInvocationToken as unknown)) {
					this.logService.warn('[AskQuestionsTool] No stream available, cannot show question carousel');
					this._sdkSession.respondToUserInput(event.data.requestId, { answer: '', wasFreeform: false });
					return;
				}
				const userInputRequest: IQuestion = {
					question: event.data.question,
					options: (event.data.choices ?? []).map(c => ({ label: c })),
					allowFreeformInput: event.data.allowFreeform,
					header: event.data.question,
				};
				const answer = await this._userQuestionHandler.askUserQuestion(userInputRequest, this._toolInvocationToken as unknown as never, token);
				flushPendingInvocationMessages();

extensions/copilot/src/extension/chatSessions/copilotcli/node/copilotcliSession.ts:545

  • This behavior change (removing the autopilot short-circuit and always going through the question handler) isn’t covered by unit tests. Add a test that emits user_input.requested with session.setPermissionLevel('autopilot') and asserts the session delegates to IUserQuestionHandler.askUserQuestion and forwards the resulting selection/freeText to respondToUserInput (and does not send the previously hardcoded autopilot message).
			disposables.add(toDisposable(this._sdkSession.on('user_input.requested', async (event) => {
				if (!(this._toolInvocationToken as unknown)) {
					this.logService.warn('[AskQuestionsTool] No stream available, cannot show question carousel');
					this._sdkSession.respondToUserInput(event.data.requestId, { answer: '', wasFreeform: false });
					return;
				}
				const userInputRequest: IQuestion = {
					question: event.data.question,
					options: (event.data.choices ?? []).map(c => ({ label: c })),
					allowFreeformInput: event.data.allowFreeform,
					header: event.data.question,
				};
				const answer = await this._userQuestionHandler.askUserQuestion(userInputRequest, this._toolInvocationToken as unknown as never, token);
				flushPendingInvocationMessages();
				if (!answer) {
					this._sdkSession.respondToUserInput(event.data.requestId, { answer: '', wasFreeform: false });
					return;
				}
				if (answer.freeText) {
					this._sdkSession.respondToUserInput(event.data.requestId, { answer: answer.freeText, wasFreeform: true });
				} else {
					this._sdkSession.respondToUserInput(event.data.requestId, { answer: answer.selected.join(', '), wasFreeform: false });
				}
			})));
  • Files reviewed: 1/1 changed files
  • Comments generated: 1

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 13, 2026

Screenshot Changes

Base: 8a73ca23 Current: c7634808

Changed (3)

chat/aiCustomizations/aiCustomizationManagementEditor/McpBrowseMode/Light
Before After
before after
editor/inlineCompletions/other/JumpToHint/Dark
Before After
before after
agentSessionsViewer/ApprovalRowLongLabel/Light
Before After
before after

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@DonJayamanne DonJayamanne marked this pull request as ready for review April 13, 2026 23:27
@DonJayamanne DonJayamanne enabled auto-merge (squash) April 13, 2026 23:27
@DonJayamanne DonJayamanne merged commit a1cdbe8 into main Apr 13, 2026
26 checks passed
@DonJayamanne DonJayamanne deleted the don/corresponding-mosquito branch April 13, 2026 23:39
@vs-code-engineering vs-code-engineering Bot added this to the 1.117.0 milestone Apr 13, 2026
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.

Copilot CLI: Remove user_input.requested changes to auto reply with comment when autopilot is turned on

3 participants