Fix Send to Terminal ignoring terminal session auto-approve#311103
Merged
meganrogge merged 1 commit intomainfrom Apr 17, 2026
Merged
Fix Send to Terminal ignoring terminal session auto-approve#311103meganrogge merged 1 commit intomainfrom
meganrogge merged 1 commit intomainfrom
Conversation
Collaborator
Author
|
cc @anthonykim1 |
Contributor
There was a problem hiding this comment.
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
ITerminalChatServiceintoSendToTerminalTool. - 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) | ||
| ); |
There was a problem hiding this comment.
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.
Contributor
rzhao271
approved these changes
Apr 17, 2026
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.
fixes #310748
Root cause: When "Allow All for this Session" is clicked on a
run_in_terminalconfirmation, it callsterminalChatService.setChatSessionAutoApproval(sessionResource, true). Therun_in_terminaltool respects this via itscommandLineAutoApproveAnalyzer, butsend_to_terminalonly checkedisSessionAutoApproveLevel()(which looks at the chat widget's permission level like Autopilot/Bypass Approvals) — it never checked the terminal-specific session auto-approval.Fix: Added
ITerminalChatServiceas a dependency and extended theisSessionAutoApprovedcheck to also callthis._terminalChatService.hasChatSessionAutoApproval(chatSessionResource), sosend_to_terminalrespects the terminal session auto-approval set by "Allow All for this Session".