Skip to content

Fix Send to Terminal ignoring terminal session auto-approve#311103

Merged
meganrogge merged 1 commit intomainfrom
merogge/auto-approve-send
Apr 17, 2026
Merged

Fix Send to Terminal ignoring terminal session auto-approve#311103
meganrogge merged 1 commit intomainfrom
merogge/auto-approve-send

Conversation

@meganrogge
Copy link
Copy Markdown
Collaborator

fixes #310748

Root cause: When "Allow All for this Session" is clicked on a run_in_terminal confirmation, it calls terminalChatService.setChatSessionAutoApproval(sessionResource, true). The run_in_terminal tool respects this via its commandLineAutoApproveAnalyzer, but send_to_terminal only checked isSessionAutoApproveLevel() (which looks at the chat widget's permission level like Autopilot/Bypass Approvals) — it never checked the terminal-specific session auto-approval.

Fix: Added ITerminalChatService as a dependency and extended the isSessionAutoApproved check to also call this._terminalChatService.hasChatSessionAutoApproval(chatSessionResource), so send_to_terminal respects the terminal session auto-approval set by "Allow All for this Session".

Co-authored-by: Copilot <copilot@github.com>
@meganrogge meganrogge self-assigned this Apr 17, 2026
Copilot AI review requested due to automatic review settings April 17, 2026 21:59
@meganrogge meganrogge added this to the 1.117.0 milestone Apr 17, 2026
@meganrogge meganrogge enabled auto-merge (squash) April 17, 2026 21:59
@meganrogge
Copy link
Copy Markdown
Collaborator Author

cc @anthonykim1

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

Fixes send_to_terminal confirmation behavior so it respects terminal session “Allow All for this Session” auto-approval (previously only chat permission-level auto-approve was considered), aligning it with run_in_terminal.

Changes:

  • Inject ITerminalChatService into SendToTerminalTool.
  • Extend the session auto-approval check to include terminalChatService.hasChatSessionAutoApproval(...).
Show a summary per file
File Description
src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/sendToTerminalTool.ts Updates send_to_terminal confirmation gating to honor terminal session auto-approval.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 1

Comment on lines 155 to +160
// Determine auto-approval, aligned with runInTerminal
const chatSessionResource = context.chatSessionResource;
const isSessionAutoApproved = chatSessionResource && isSessionAutoApproveLevel(chatSessionResource, this._configurationService, this._chatWidgetService, this._chatService);
const isSessionAutoApproved = chatSessionResource && (
isSessionAutoApproveLevel(chatSessionResource, this._configurationService, this._chatWidgetService, this._chatService) ||
this._terminalChatService.hasChatSessionAutoApproval(chatSessionResource)
);
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New terminal-session auto-approval logic is added via hasChatSessionAutoApproval, but the existing SendToTerminalTool unit tests only cover chat permission auto-approve. Please add a test that stubs ITerminalChatService.hasChatSessionAutoApproval to return true for a session resource and verifies prepareToolInvocation skips confirmation in default permission mode.

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: d431c964 Current: 62387403

Changed (1)

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

@meganrogge meganrogge merged commit 840a3be into main Apr 17, 2026
30 checks passed
@meganrogge meganrogge deleted the merogge/auto-approve-send branch April 17, 2026 22:22
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.

Send to Terminal ignores Auto-Approve

3 participants