[Bug] expandTildePath produces mixed path separators on Windows #1442
RelaxJonh
started this conversation in
Bug reports
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Affected area
Coding agent and CLI (Windows)
What happened?
expandTildePath()inpackages/coding-agent/src/config.ts(line 515) uses string concatenation instead ofpath.join, producing mixed path separators on Windows:On Windows,
homedir()returnsC:\Users\username(backslashes). When the input is~/something, the result isC:\Users\username/something— mixing\and/separators.This function is called by
getAgentDir()(line 537) andgetSessionDir()(line 658) whenPRIME_AGENT_CODING_AGENT_DIRorPRIME_AGENT_SESSION_DIRenvironment variables are set with a tilde prefix.Steps to reproduce
On Windows:
PRIME_AGENT_CODING_AGENT_DIR=~/my-agentgetAgentDir()C:\Users\username/my-agentCompare with the default path (no env var set), which uses
join(homedir(), CONFIG_DIR_NAME)and producesC:\Users\username\.prime\agent(consistent backslashes).Expected behavior
expandTildePathshould return a path with consistent separators, matching the behavior ofpath.join. Either:join(homedir(), path.slice(2))after the~/check, orpath.normalize()Actual behavior
Mixed separators in paths derived from environment variables. While Node.js
fsfunctions generally handle mixed separators, some external tools, string comparisons, and path equality checks may not. The inconsistency between env-var-derived paths (mixed) and default paths (normalized) can cause subtle bugs in path comparison logic.Impact
getAgentDir() === someOtherPathmay fail when both refer to the same directorySuggested fix
Prime Agent version
0.7.2 (source checkout at
main)Environment
Windows 11, Node.js 24.x
All reactions