Skip to content

Fix terminal command edits ignored in two-step confirmation flow#309908

Merged
meganrogge merged 4 commits intomainfrom
copilot/fix-terminal-command-ignores-edits
Apr 14, 2026
Merged

Fix terminal command edits ignored in two-step confirmation flow#309908
meganrogge merged 4 commits intomainfrom
copilot/fix-terminal-command-ignores-edits

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 14, 2026

ConfirmTerminalCommandTool.invoke() returned a static 'yes' regardless of whether the user edited the command during confirmation. Agents using the two-step flow (confirm → execute) never saw the edited command and always ran the original.

  • runInTerminalConfirmationTool.ts: Read toolSpecificData.commandLine.userEdited in invoke() and return the edited command in the tool result when it differs from the original, so the agent can pass it to the subsequent run_in_terminal call.
  • runInTerminalTool.test.ts: Add tests for the three invoke cases: no edit, user edit, and edit-equals-original (no-op).

When using the two-step confirmation flow (ConfirmTerminalCommandTool
followed by RunInTerminalTool), user edits to terminal commands were
silently discarded because invoke() always returned a static 'yes'.

Now the invoke() method checks toolSpecificData.commandLine.userEdited
and returns the edited command in the result, allowing the agent to
use the correct command when executing.

Agent-Logs-Url: https://github.com/microsoft/vscode/sessions/664f7dc6-81de-42c9-ab62-74741a8bf022

Co-authored-by: meganrogge <29464607+meganrogge@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot April 14, 2026 17:25
…ool tests

Agent-Logs-Url: https://github.com/microsoft/vscode/sessions/664f7dc6-81de-42c9-ab62-74741a8bf022

Co-authored-by: meganrogge <29464607+meganrogge@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot April 14, 2026 17:28
Copilot AI changed the title [WIP] Fix terminal command edits being ignored in Claude Agent SDK Fix terminal command edits ignored in two-step confirmation flow Apr 14, 2026
Copilot AI requested a review from meganrogge April 14, 2026 17:29
@meganrogge meganrogge added this to the 1.117.0 milestone Apr 14, 2026
@meganrogge meganrogge marked this pull request as ready for review April 14, 2026 17:34
Copilot AI review requested due to automatic review settings April 14, 2026 17:34
@meganrogge meganrogge enabled auto-merge (squash) April 14, 2026 17:34
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 14, 2026

Screenshot Changes

Base: 107a0519 Current: 88a69a49

Changed (1)

editor/inlineCompletions/other/JumpToHint/Dark
Before After
before after

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

Note

Copilot was unable to run its full agentic suite in this review.

Fixes the two-step terminal confirmation flow so edits made during confirmation are returned from ConfirmTerminalCommandTool.invoke() and can be used in the follow-up run_in_terminal execution.

Changes:

  • Return an edited command from ConfirmTerminalCommandTool.invoke() when toolSpecificData.commandLine.userEdited differs from the original.
  • Update the confirmation tool’s “approved” response from a static 'yes' to a descriptive message.
  • Add tests covering invoke behavior for (a) no edit, (b) edited command, and (c) edit equals original.
Show a summary per file
File Description
src/vs/workbench/contrib/terminalContrib/chatAgentTools/test/electron-browser/runInTerminalTool.test.ts Adds invoke tests for the confirmation tool covering command edit/no-edit scenarios.
src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalConfirmationTool.ts Returns an edited command in the tool result when the user modifies it during confirmation.

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 6

@meganrogge meganrogge merged commit 9af6a69 into main Apr 14, 2026
26 checks passed
@meganrogge meganrogge deleted the copilot/fix-terminal-command-ignores-edits branch April 14, 2026 18:43
@bpasero
Copy link
Copy Markdown
Member

bpasero commented Apr 16, 2026

@joshspicer @meganrogge reverted, see #310702

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.

Terminal command edits are silently ignored when using Claude Agent SDK (works correctly with regular Copilot)

6 participants