Skip to content

fix: resolve Windows-style backslash paths in input resolution - #17

Open
Tyagiquamar wants to merge 1 commit into
openprose:mainfrom
Tyagiquamar:fix/windows-path-resolution
Open

fix: resolve Windows-style backslash paths in input resolution#17
Tyagiquamar wants to merge 1 commit into
openprose:mainfrom
Tyagiquamar:fix/windows-path-resolution

Conversation

@Tyagiquamar

Copy link
Copy Markdown

Problem

isResolvablePath() only treats a value as a resolvable file path when it contains a forward slash:

return value.includes("/") && value.endsWith(".md");

On Windows, absolute paths and fs.mkdtempSync-produced paths use \ separators (C:\Users\me\docs\file.md), so every such input fails the check. resolveValue() / resolveInputs() then return the literal path string to the model instead of the file's content — silently, since a Windows path looks like a perfectly valid literal.

This breaks 9 existing tests on Windows (test/press-resolver.test.ts: 8, test/rlm.test.ts "resolves .md file paths to content in system prompt": 1); they all write real temp files and pass absolute native paths through resolution. It also affects real CLI/library usage on Windows: press run ... --input C:\path\doc.md passes the path string itself into the program context instead of the document.

Provenance: found by running the test suite on Windows (no matching open issue at the time of writing).

Fix

Accept both / and \ as path separators in isResolvablePath(). All callers (resolveValue, resolveInputs, and resolveContextValue in system-prompt.ts) route through this single predicate, so one change fixes context-stack file inlining as well as caller-input resolution. POSIX behavior is unchanged; URLs remain excluded.

Also fixes one platform-naive test assertion that assumed POSIX output from path.join("a", "b"), and adds a unit case documenting backslash acceptance.

Testing

  • npx vitest --run test/press-resolver.test.ts test/environment.test.ts test/rlm.test.ts
    • Before: Tests 10 failed | 176 passed (186) on Windows
    • After: Tests 117 passed (117)
  • npm run build — clean compile.

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.

1 participant