fix: block autopilot on user input requests#5090
Open
unveroleone wants to merge 1 commit intomicrosoft:mainfrom
Open
fix: block autopilot on user input requests#5090unveroleone wants to merge 1 commit intomicrosoft:mainfrom
unveroleone wants to merge 1 commit intomicrosoft:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes Copilot CLI Autopilot incorrectly auto-answering clarification prompts by removing the Autopilot-only shortcut and always routing user_input.requested through the standard user question flow, with regression tests to prevent reintroduction.
Changes:
- Removed the Autopilot “self-answer” branch for
user_input.requestedso Autopilot waits on the existing question flow. - Enhanced the Copilot CLI session test mock to emit/await
user_input.requestedend-to-end. - Added unit tests covering Autopilot returning both selected-choice and freeform user-input responses.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/extension/chatSessions/copilotcli/node/copilotcliSession.ts | Removes Autopilot’s auto-response path for user_input.requested, forcing the normal user-question handling path. |
| src/extension/chatSessions/copilotcli/node/test/copilotcliSession.spec.ts | Adds mock support + regression tests to validate Autopilot waits for and returns user-provided input. |
Comments suppressed due to low confidence (1)
src/extension/chatSessions/copilotcli/node/copilotcliSession.ts:520
- The guard for
user_input.requestedchecks_toolInvocationToken, but the warning says "No stream available". SincetoolInvocationTokenand stream attachment are different concerns, the message/condition reads as inconsistent. Consider either checkingthis._stream(if that’s what’s required), or updating the log text/guard to reflect the actual requirement (e.g. "No toolInvocationToken available"). Also theas unknowncast is unnecessary here;if (!this._toolInvocationToken)is clearer.
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;
Author
@microsoft-github-policy-service agree |
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.
Summary
Autopilot was incorrectly auto-answering clarification prompts and continuing execution without waiting for real user input.
This PR makes clarification questions in Autopilot a true pause point by removing the self-answering path and always routing through the existing question flow.
Root Cause
In copilotcliSession.ts, the user_input.requested handler had an Autopilot-only shortcut that immediately replied with a canned freeform answer instead of waiting for the question UI result.
What Changed
Behavior Impact
Validation