Skip to content

fix(tools): read POSIX drive paths on Windows#111624

Open
ooiuuii wants to merge 2 commits into
openclaw:mainfrom
ooiuuii:fix/windows-msys-file-tool-paths
Open

fix(tools): read POSIX drive paths on Windows#111624
ooiuuii wants to merge 2 commits into
openclaw:mainfrom
ooiuuii:fix/windows-msys-file-tool-paths

Conversation

@ooiuuii

@ooiuuii ooiuuii commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Closes #111620

What Problem This Solves

Fixes an issue where native Windows users could not use agent file tools with drive paths copied or emitted by Git Bash, Cygwin, or WSL because existing files were reported as missing.

Why This Change Was Made

Recognized /c/..., /cygdrive/c/..., and /mnt/c/... drive forms are normalized once at the shared file-tool path boundary on native Windows. The conversion is platform-gated and leaves ordinary POSIX paths and UNC paths unchanged.

User Impact

Windows users can pass these POSIX drive paths directly to read, edit, and write workflows without manually rewriting them as C:\... paths.

Evidence

Before, the real read tool consistently failed against an existing file:

/f/repo/package.json           -> F:\f\repo\package.json           -> ENOENT
/cygdrive/f/repo/package.json  -> F:\cygdrive\f\repo\package.json -> ENOENT
/mnt/f/repo/package.json       -> F:\mnt\f\repo\package.json      -> ENOENT

After this change, the same createReadToolDefinition probe read the existing file successfully for all three input forms.

Focused validation:

node scripts/run-vitest.mjs   src/agents/sessions/tools/path-utils.test.ts   src/agents/sessions/tools/read.test.ts   src/agents/sessions/tools/write.test.ts

Test Files  3 passed (3)
Tests      40 passed (40)

Additional checks:

  • oxfmt --check: clean
  • oxlint --type-aware: clean
  • git diff --check: clean
  • pnpm deadcode:dependencies: clean
  • Structured Codex autoreview: no accepted/actionable findings; full-branch review rated the patch correct (0.97 confidence)
  • The existing Windows-only preview expectation failure in edit.test.ts reproduces unchanged on the unmodified base checkout.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S labels Jul 20, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Jul 20, 2026
@clawsweeper

clawsweeper Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 19, 2026, 11:43 PM ET / July 20, 2026, 03:43 UTC.

Summary
The branch adds native-Windows conversion of /c/..., /cygdrive/c/..., and /mnt/c/... paths at the session file-tool path boundary, with focused normalization tests.

PR surface: Source +19, Tests +46. Total +65 across 3 files.

Reproducibility: yes. at source level: current-main expandPath leaves these POSIX drive forms unchanged before Windows path resolution, and the PR supplies a concrete native-Windows read-tool before/after transcript for all three forms.

Review metrics: none identified.

Stored data model
Persistent data-model change detected: serialized state: src/agents/sessions/tools/path-utils.test.ts, serialized state: src/agents/sessions/tools/windows-posix-path.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #111620
Summary: This PR is the explicit candidate fix for the linked Windows POSIX-drive-path bug; it should remain open until merged or otherwise resolved.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🦞 diamond lobster
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • none.

Risk before merge

  • [P1] This changes shared Windows path semantics for every local caller of resolveToCwd; maintainers should retain the platform gate and confirm the merge result keeps unsupported POSIX and UNC paths unchanged.

Maintainer options:

  1. Preserve the narrow Windows mapping (recommended)
    Merge after confirming the resolved merge result still converts only recognized native-Windows drive forms and leaves ordinary POSIX and UNC inputs unchanged.
  2. Accept broader Windows path semantics
    Land the shared resolver change without additional boundary confirmation only if maintainers intentionally accept its effect on every local file-tool caller.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Confirm native-Windows coverage for `/c`, `/cygdrive/c`, and `/mnt/c` forms plus unchanged ordinary POSIX and UNC paths on the merge result.

Next step before merge

  • [P2] No actionable repair remains: the existing implementation PR already owns the linked bug and needs ordinary maintainer merge review rather than a separate ClawSweeper fix lane.

Security
Cleared: The patch adds no dependencies, workflow changes, secret handling, package-resolution changes, or new execution boundary; the platform-gated string normalization is confined to local path handling.

Review details

Best possible solution:

Merge the single shared normalizer if the final merge result preserves the stated platform gate and path exclusions, then let GitHub close the linked bug through the PR's existing closing reference.

Do we have a high-confidence way to reproduce the issue?

Yes, at source level: current-main expandPath leaves these POSIX drive forms unchanged before Windows path resolution, and the PR supplies a concrete native-Windows read-tool before/after transcript for all three forms.

Is this the best way to solve the issue?

Yes. A platform-gated conversion at the shared file-tool path boundary is narrower and more maintainable than separate read, edit, and write conversions, provided unsupported POSIX and UNC paths stay unchanged.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 990916c6ac87.

Label changes

Label justifications:

  • P2: The PR fixes a bounded but real native-Windows agent file-tool workflow failure.
  • merge-risk: 🚨 compatibility: The shared path resolver changes how existing Windows installations interpret POSIX-looking absolute input paths across local read and mutation tools.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body includes an after-fix native-Windows terminal probe of the real read-tool definition showing successful reads for Git Bash, Cygwin, and WSL drive forms; private paths should remain redacted in any follow-up evidence.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes an after-fix native-Windows terminal probe of the real read-tool definition showing successful reads for Git Bash, Cygwin, and WSL drive forms; private paths should remain redacted in any follow-up evidence.
Evidence reviewed

PR surface:

Source +19, Tests +46. Total +65 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 2 20 1 +19
Tests 1 46 0 +46
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 66 1 +65

What I checked:

  • Current-main behavior: Current main expands Unicode spaces and @ prefixes in expandPath, then passes POSIX-looking absolute paths to the platform resolver unchanged; this explains why native Windows resolves /f/... beneath the current drive rather than as F:\.... (src/agents/sessions/tools/path-utils.ts:43, 990916c6ac87)
  • Shared caller boundary: The current read tool uses resolveReadPath, while the write tool imports resolveToCwd; placing the platform-gated conversion in expandPath consistently covers local file-tool resolution without adding parallel per-tool policy. (src/agents/sessions/tools/read.ts:6, 990916c6ac87)
  • Proposed implementation: The PR converts only recognized drive-root forms on win32, preserves non-Windows inputs, and leaves UNC-style //server/share unmatched; the added test cases cover Git Bash, Cygwin, WSL, drive roots, and ordinary POSIX paths. (src/agents/sessions/tools/windows-posix-path.ts:1, eb1e9d798897)
  • Real behavior proof: The PR body reports a native-Windows createReadToolDefinition before/after probe: all three existing-file inputs previously failed with ENOENT and read successfully after the change; focused path/read/write tests are reported as 40 passing tests. (src/agents/sessions/tools/path-utils.test.ts:8, eb1e9d798897)
  • Linked implementation ownership: The PR body uses closing syntax for the open bug report, so that issue remains open until this candidate fix merges rather than being closed independently. (eb1e9d798897)

Likely related people:

  • steipete: A reasonable low-confidence route for a core session-tool behavior review; direct blame/log provenance for this specific utility was not available during the read-only inspection. (role: adjacent repository owner; confidence: low; files: src/agents/sessions/tools/path-utils.ts, src/agents/sessions/tools/read.ts, src/agents/sessions/tools/write.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (2 earlier review cycles)
  • reviewed 2026-07-20T02:52:37.325Z sha c854807 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-20T03:00:49.143Z sha eb1e9d7 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Windows file tools misresolve POSIX drive paths

1 participant