Skip to content

Fix user-edited terminal commands being ignored in confirmation UI#307433

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/fix-edit-commit-message
Draft

Fix user-edited terminal commands being ignored in confirmation UI#307433
Copilot wants to merge 3 commits intomainfrom
copilot/fix-edit-commit-message

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 2, 2026

When a user edits a terminal command in the chat confirmation widget (e.g. changing a commit message) and clicks Allow, the original unedited command was executed instead. Two root causes:

  1. Agent Host sessions: SessionToolCallConfirmed action only sent approved: true to the server — the user-edited command text was never included. The server continued executing the original toolInput.

  2. ConfirmTerminalCommandTool: invoke() returned a bare 'yes' string, discarding the user edit. The LM then called RunInTerminalTool with the original command from its parameters.

Changes

  • ISessionToolCallApprovedAction — added optional userEditedInput field to the protocol action type
  • sessionReducer — use action.userEditedInput ?? tc.toolInput when transitioning tool call to Running
  • agentHostSessionHandler._awaitToolConfirmation — extract commandLine.userEdited from toolSpecificData and include it in the dispatched confirmation action
  • ConfirmTerminalCommandTool.invoke() — when userEdited differs from original, return the edited command in the result so the LM uses it for subsequent execution
// Before: LM receives "yes", uses original command
return { content: [{ kind: 'text', value: 'yes' }] };

// After: LM receives the edited command when user made changes
const userEdited = toolSpecificData?.commandLine.userEdited;
if (userEdited && userEdited !== toolSpecificData?.commandLine.original) {
    return { content: [{ kind: 'text',
        value: `The user approved the command but edited it to: \`${userEdited}\`. Use this exact command when executing.`
    }] };
}

Note: The RunInTerminalTool.invoke() path already correctly prioritizes userEdited via toolSpecificData.commandLine.userEdited ?? toolEdited ?? original — that flow was not broken.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • redirector.gvt1.com
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --no-sandbox --crashpad-handler-pid=8484 --enable-crash-reporter=33d8f196-36d4-433c-9345-98f01e12f298,no_channel --user-data-dir=/tmp/vscode-tests-1775148836363 --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,9699356955558524326,2821434709459238297,262144 --enable-features=PdfUseShowSaveFilePicker --disable-features=LocalNetworkAccessChecks,ScreenAIOCREnabled,SpareRendererForSitePerProcess,TraceSiteInstanceGetProcessCreation --variations-seed-version --trace-process-track-uuid=3190708989122997041 bash k/vscode/vscode/git .ts k/vscode/vscode/--name-only eaderValidation.HEAD (dns block)
    • Triggering command: .build/electron/code-oss .build/electron/code-oss test/unit/electron/index.js --crash-reporter-directory=/home/REDACTED/work/vscode/vscode/.build/crashes --run src/vs/workbench/contrib/terminalContrib/chatAgentTools/test/electron-browser/runInTerminalTool.test.ts --grep ConfirmTerminalCommandTool --timeout 30000 k/vscode/vscode/./scripts/test.sh k/vscode/vscode/--run k/vscode/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/test/electron-browser/runInTerminalTool.test.ts k/vs�� k/vscode/vscode/ConfirmTerminalCommandTool k/vscode/vscode/--timeout rgo/bin/bash k/vscode/vscode/git .ts k/vscode/vscode/--name-only eaderValidation.HEAD (dns block)
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --no-sandbox --crashpad-handler-pid=10473 --enable-crash-reporter=33d8f196-36d4-433c-9345-98f01e12f298,no_channel --user-data-dir=/tmp/vscode-tests-1775149058336 --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,7937307963620496307,2974062484487749855,262144 --enable-features=PdfUseShowSaveFilePicker --disable-features=LocalNetworkAccessChecks,ScreenAIOCREnabled,SpareRendererForSitePerProcess,TraceSiteInstanceGetProcessCreation --variations-seed-version --trace-process-track-uuid=3190708989122997041 k/vscode/vscode/--inlineSources b/chat/test/brownode -lname ache/node/22.22.--project node (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI and others added 2 commits April 2, 2026 16:49
…mTerminalCommandTool

1. Add userEditedInput field to ISessionToolCallApprovedAction protocol
2. Update reducer to use userEditedInput when present
3. Send userEditedInput in agentHostSessionHandler's _awaitToolConfirmation
4. Return user-edited command in ConfirmTerminalCommandTool.invoke() result
5. Add tests for ConfirmTerminalCommandTool user-edit behavior

Agent-Logs-Url: https://github.com/microsoft/vscode/sessions/a1ae137d-c533-4696-b7fe-4e2580ce340b

Co-authored-by: meganrogge <29464607+meganrogge@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issue with editing commit message in sessions Fix user-edited terminal commands being ignored in confirmation UI Apr 2, 2026
Copilot AI requested a review from meganrogge April 2, 2026 17:01
@meganrogge meganrogge added this to the 1.116.0 milestone Apr 2, 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.

Sessions: Unable to edit commit message

2 participants