agentHost: add setting to disable worktreeCreated task auto-dispatch#318243
Merged
roblourens merged 3 commits intoMay 26, 2026
Merged
Conversation
Adds `chat.agentHost.runWorktreeCreatedTasks` (default `false`) which gates `WorktreeCreatedTaskDispatcher` for agent host sessions. The generic dispatcher now consults the setting before dispatching and skips agent host sessions when it's disabled. Non-agent-host sessions and manual `Run Task` invocations are unaffected. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an application-scoped setting to gate automatic dispatch of worktreeCreated-tagged tasks specifically for agent-host backed sessions in the Agents window, disabling that auto-dispatch by default while related issues are addressed.
Changes:
- Introduces
chat.agentHost.runWorktreeCreatedTasks(defaultfalse) and registers it in sessions chat contributions. - Updates
WorktreeCreatedTaskDispatcherto skip auto-dispatch for agent-host sessions when the setting is disabled. - Extends unit tests to cover default-skip, enabled-run, and non-agent-host unaffected behavior.
Show a summary per file
| File | Description |
|---|---|
| src/vs/sessions/contrib/chat/test/browser/worktreeCreatedTaskDispatcher.test.ts | Adds tests and stubs for configuration/providers to validate the new gating behavior. |
| src/vs/sessions/contrib/chat/browser/worktreeCreatedTaskDispatcher.ts | Adds setting constant and gating logic before auto-dispatching worktreeCreated tasks. |
| src/vs/sessions/contrib/chat/browser/chat.contribution.ts | Registers the new chat.agentHost.runWorktreeCreatedTasks setting in the configuration registry. |
Copilot's findings
- Files reviewed: 3/3 changed files
- Comments generated: 4
The 3 new agent-host gating tests were creating sessions that already had a worktree at the time of the 'added' event. _trackSession returns early in that case (the session isn't 'pending'), so the dispatcher's gate was never exercised. Match the existing pattern: start with hasWorktree=false, fire the added event, then set the workspace. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Drop ISessionsProvidersService injection from the dispatcher; check session.providerId directly via a new isAgentHostProviderId() helper. - Improve setting description: quote the actual tasks.json JSON shape. - await TestConfigurationService.setUserConfiguration in the new test. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
DonJayamanne
approved these changes
May 26, 2026
anthonykim1
added a commit
that referenced
this pull request
May 26, 2026
Squashed cherry-pick of 10 commits from main that are included in the Insiders build (183159e) people are verifying: - agentHost: show fetched URL for web_fetch (#318240) - Fix SSH remote agent host passphrase auth (#318244) - agentHost: add setting to disable worktreeCreated task auto-dispatch (#318243) - Agent host: clearer worktree git timeout errors and 60s budget (#318242) - Normalize LF to CRLF in agent host terminal tool output (#318257) - sessions: restore X-button removal of SSH remote agent host entries (#318262) - chat: fix duplicate command registration for agent-host-copilotcli (#318273) - launch: build copilot in compile; wait for CDP in launch.sh (#318272) - Preserve unread state across remote host disconnect (#318267) - Add more codenotify for terminal (#318285)
dileepyavan
pushed a commit
that referenced
this pull request
May 27, 2026
Squashed cherry-pick of 10 commits from main that are included in the Insiders build (183159e) people are verifying: - agentHost: show fetched URL for web_fetch (#318240) - Fix SSH remote agent host passphrase auth (#318244) - agentHost: add setting to disable worktreeCreated task auto-dispatch (#318243) - Agent host: clearer worktree git timeout errors and 60s budget (#318242) - Normalize LF to CRLF in agent host terminal tool output (#318257) - sessions: restore X-button removal of SSH remote agent host entries (#318262) - chat: fix duplicate command registration for agent-host-copilotcli (#318273) - launch: build copilot in compile; wait for CDP in launch.sh (#318272) - Preserve unread state across remote host disconnect (#318267) - Add more codenotify for terminal (#318285)
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.
Adds a new setting
chat.agentHost.runWorktreeCreatedTasks(defaultfalse) that gates theWorktreeCreatedTaskDispatcherfor agent host sessions.What this changes
chat.agentHost.runWorktreeCreatedTasks(boolean, defaultfalse, application-scoped) registered insrc/vs/sessions/contrib/chat/browser/chat.contribution.ts.WorktreeCreatedTaskDispatchernow injectsIConfigurationServiceandISessionsProvidersService. Inside_dispatchWorktreeCreatedTasks, if the session's provider is an agent host provider (viaisAgentHostProvider) and the setting isfalse, the dispatch is logged at trace level and skipped.What is NOT affected
isAgentHostProvider(provider).Run Taskinvocations on agent-host sessions — the gate is in the auto-dispatch path, not inAgentHostSessionTaskRunner. Users can still triggerworktreeCreated-tagged tasks by hand.Tests
Three new tests added to
worktreeCreatedTaskDispatcher.test.ts:Validation
npm run compile-check-ts-native✅npm run valid-layers-check✅(Written by Copilot)