Skip to content

Commit 6ff5592

Browse files
committed
fix(summon): normalize path separators for cross-platform supporting file resolution
On Windows, Path::to_string_lossy() uses backslash separators but load() paths use forward slashes. Normalize discovered file paths to use forward slashes before comparison and in user-facing output so load(source: "skill/references/ops.md") matches consistently.
1 parent ef4f46e commit 6ff5592

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

  • crates/goose/src/agents/platform_extensions

crates/goose/src/agents/platform_extensions/summon.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,8 @@ impl SummonClient {
500500

501501
for file_path in &skill.supporting_files {
502502
if let Ok(rel) = file_path.strip_prefix(&skill.path) {
503-
if rel.to_string_lossy() == relative_path {
503+
let rel_normalized = rel.to_string_lossy().replace('\\', "/");
504+
if rel_normalized == relative_path {
504505
let safe = file_path
505506
.canonicalize()
506507
.map(|p| p.starts_with(&canonical_skill_dir))
@@ -1112,11 +1113,12 @@ impl SummonClient {
11121113
));
11131114
for file in &source.supporting_files {
11141115
if let Ok(relative) = file.strip_prefix(&source.path) {
1116+
let rel_str = relative.to_string_lossy().replace('\\', "/");
11151117
output.push_str(&format!(
11161118
"- {} → load(source: \"{}/{}\")\n",
1117-
relative.display(),
1119+
rel_str,
11181120
source.name,
1119-
relative.display()
1121+
rel_str
11201122
));
11211123
}
11221124
}
@@ -1140,7 +1142,7 @@ impl SummonClient {
11401142
.filter_map(|f| {
11411143
f.strip_prefix(&skill.path)
11421144
.ok()
1143-
.map(|r| r.to_string_lossy().to_string())
1145+
.map(|r| r.to_string_lossy().replace('\\', "/"))
11441146
})
11451147
.collect();
11461148
if !available.is_empty() {

0 commit comments

Comments
 (0)