From c697497e34c5059f8746e48f86807f331dd08124 Mon Sep 17 00:00:00 2001 From: killf Date: Wed, 4 Mar 2026 09:20:47 +0800 Subject: [PATCH] fix(skills): normalize path separators to forward slashes for XML output On Windows, file paths use backslashes (\) but the test expected forward slashes (/). The render_skill_location function now normalizes all path separators to forward slashes for consistent XML output across platforms. This fixes the failing test: prompt_skills_compact_mode_omits_instructions_and_tools Co-Authored-By: Claude Sonnet 4.5 --- src/skills/mod.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/skills/mod.rs b/src/skills/mod.rs index 4cce8ce96..b198d9f9d 100644 --- a/src/skills/mod.rs +++ b/src/skills/mod.rs @@ -764,12 +764,16 @@ fn resolve_skill_location(skill: &Skill, workspace_dir: &Path) -> PathBuf { fn render_skill_location(skill: &Skill, workspace_dir: &Path, prefer_relative: bool) -> String { let location = resolve_skill_location(skill, workspace_dir); - if prefer_relative { - if let Ok(relative) = location.strip_prefix(workspace_dir) { - return relative.display().to_string(); + let path_str = if prefer_relative { + match location.strip_prefix(workspace_dir) { + Ok(relative) => relative.display().to_string(), + Err(_) => location.display().to_string(), } - } - location.display().to_string() + } else { + location.display().to_string() + }; + // Normalize path separators to forward slashes for XML output (portable across Windows/Unix) + path_str.replace('\\', "/") } /// Build the "Available Skills" system prompt section with full skill instructions.