fix(agent-runtime): format POSIX scratch directory paths with forward slashes - #1127
Merged
Merged
Conversation
… slashes Normalize scratch directory paths in system prompt guidance and tool descriptions when operating under POSIX shell dialects. Addresses vastsa#1108
vastsa
approved these changes
Sep 27, 2026
vastsa
left a comment
Owner
There was a problem hiding this comment.
Reviewed the implementation and the targeted runtime regression. The POSIX shell path normalization is scoped to the shell dialect, preserves PowerShell/cmd paths, and covers both system guidance and Bash tool descriptions.
Validation: runtime.test.ts 257/257 passed on the PR head before the base update; after updating the branch with latest main, required JS, Rust, base, and Vercel checks all pass.
This branch was previously deployed
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.
Summary
Normalizes scratch directory path representations in system prompt guidance and Bash tool descriptions when operating under a POSIX shell dialect (including Git Bash on Windows).
Motivation & Root Cause
Resolves issue #1108 (partially addressing the Windows path behavior in Bash).
When Git Bash (
dialect: "posix") is configured on Windows, the runtime emitted the raw Windows scratch path with backslashes into the system prompt and tool descriptions. In a POSIX shell context, backslashes act as escape characters rather than directory separators, breaking commands that reference the advertised scratch directory.Key Changes
Dialect-Aware Scratch Path Formatting (
packages/agent-runtime/src/runtime.ts):formatScratchDirForShell(shell, scratchDir)to convert backslashes to forward slashes whenshell.dialect === "posix".commandShellGuidance,commandShellToolDescription, and scratch directory prompt sections to useformatScratchDirForShell.powershellandcmddialects.Regression Testing (
packages/agent-runtime/src/runtime.test.ts):formats scratch directory with forward slashes for POSIX shellsverifying that Git Bash receives forward-slash normalized scratch paths in both system prompt and tool descriptions.Verification
runtime.test.ts.fix:change addressing verified upstream issue [Agent Harness] 明确 Bash 超时、编码与 Windows 路径行为 #1108).