Skip to content

fix(agent-runtime): format POSIX scratch directory paths with forward slashes - #1127

Merged
vastsa merged 2 commits into
vastsa:mainfrom
Totopo27:fix/posix-scratch-dir-formatting
Sep 27, 2026
Merged

vastsa merged 2 commits into
vastsa:mainfrom
Totopo27:fix/posix-scratch-dir-formatting

Conversation

@Totopo27

Copy link
Copy Markdown
Contributor

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

  1. Dialect-Aware Scratch Path Formatting (packages/agent-runtime/src/runtime.ts):

    • Introduced formatScratchDirForShell(shell, scratchDir) to convert backslashes to forward slashes when shell.dialect === "posix".
    • Updated commandShellGuidance, commandShellToolDescription, and scratch directory prompt sections to use formatScratchDirForShell.
    • Retained native Windows backslash paths for powershell and cmd dialects.
  2. Regression Testing (packages/agent-runtime/src/runtime.test.ts):

    • Added unit test formats scratch directory with forward slashes for POSIX shells verifying that Git Bash receives forward-slash normalized scratch paths in both system prompt and tool descriptions.

Verification

… slashes

Normalize scratch directory paths in system prompt guidance and tool descriptions when operating under POSIX shell dialects.

Addresses vastsa#1108

@vastsa vastsa left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

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.

@vastsa
vastsa merged commit b14caaa into vastsa:main Sep 27, 2026
4 checks passed

This branch was previously deployed

1 inactive deployment
Preview — a68b0d2f Deployed Sep 27, 2026 by vercel[bot]
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.

2 participants