sessions: use OS-specific task overrides for local agent host tasks#322336
Merged
benibenj merged 2 commits intoJun 22, 2026
Conversation
The agent host session task runner always emitted the POSIX (.sh) command when resolving tasks, ignoring the windows/osx/linux overrides in tasks.json. On Windows this meant 'Run and Compile Agents - OSS' ran ./scripts/code.sh instead of .\scripts\code.bat. Pass targetOS to resolveTaskCommand for the local agent host (which runs on the same machine as the renderer) so the renderer's OS picks the right override. Remote hosts, whose OS is unknown here, keep falling back to the task's default command. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes task command resolution for the Agents window’s Run Script flow so that OS-specific tasks.json overrides (windows/osx/linux) are honored for local agent host sessions (where the renderer OS matches the host OS), while keeping the existing default-command behavior for remote agent hosts (OS unknown at this layer).
Changes:
- Add an
OperatingSystem→tasks.jsonOS key mapping helper (osToTaskTargetOS) intaskCommand.ts. - Pass
targetOSintoresolveTaskCommandfor local agent host sessions inAgentHostSessionTaskRunner, and replace the inline local-host sentinel with a named constant. - Add unit tests covering the OS mapping and local-session OS-specific override behavior.
Show a summary per file
| File | Description |
|---|---|
| src/vs/sessions/contrib/chat/browser/taskCommand.ts | Adds osToTaskTargetOS helper to map OperatingSystem to tasks.json override keys. |
| src/vs/sessions/contrib/terminal/browser/agentHostSessionTaskRunner.ts | Uses renderer OS to pick OS-specific command overrides for local agent host task execution; introduces LOCAL_AGENT_HOST_ADDRESS constant. |
| src/vs/sessions/contrib/chat/test/browser/taskCommand.test.ts | Adds unit test verifying osToTaskTargetOS mapping. |
| src/vs/sessions/contrib/terminal/test/browser/agentHostSessionTaskRunner.test.ts | Adds unit test verifying OS-specific overrides apply for local agent host sessions. |
Copilot's findings
- Files reviewed: 4/4 changed files
- Comments generated: 1
Add a default branch so the function always returns a TaskTargetOS, satisfying noImplicitReturns and avoiding undefined for unexpected enum values. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
hediet
approved these changes
Jun 22, 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.
What
The agent host session task runner (used by the Run Script action in the Agents window titlebar) always emitted the POSIX (
.sh) command when resolving a task, ignoring thewindows/osx/linuxoverrides declared intasks.json.On Windows this meant Run and Compile Agents - OSS ran:
instead of the Windows variant using
.\scripts\code.bat.Why
AgentHostSessionTaskRunner.runTaskcalledresolveTaskCommand(task, ...)without atargetOS, sotaskCommand.tsnever selected the OS-specificcommand/argsoverrides.Changes
taskCommand.ts: added an exported pure helperosToTaskTargetOS(os)mappingOperatingSystem→ thewindows/osx/linuxkeys used intasks.json.agentHostSessionTaskRunner.ts: passtargetOStoresolveTaskCommand. For the local agent host (runs on the same machine as the renderer) it uses the renderer's OS, so on Windows the.batoverride is picked. Remote hosts (OS unknown here) keep falling back to the task's default command. Also extracted the__local__sentinel into aLOCAL_AGENT_HOST_ADDRESSconstant.Notes for reviewers
tsgo) was not available in the dev environment, but the pre-commit hygiene hook passed.