fix: resolve Windows-style backslash paths in input resolution - #17
Open
Tyagiquamar wants to merge 1 commit into
Open
fix: resolve Windows-style backslash paths in input resolution#17Tyagiquamar wants to merge 1 commit into
Tyagiquamar wants to merge 1 commit into
Conversation
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.
Problem
isResolvablePath()only treats a value as a resolvable file path when it contains a forward slash: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.mdpasses 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 inisResolvablePath(). All callers (resolveValue,resolveInputs, andresolveContextValueinsystem-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.tsTests 10 failed | 176 passed (186)on WindowsTests 117 passed (117)npm run build— clean compile.