From b81f9f4351d360181bc682966fa0e2381f18f79a Mon Sep 17 00:00:00 2001 From: Andrew Su Date: Thu, 15 Oct 2026 11:13:40 -0700 Subject: [PATCH] fix(tracing): recognize Windows skill paths --- plugins/tracing/src/skills.ts | 5 +++-- plugins/tracing/test/skills.test.ts | 32 +++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/plugins/tracing/src/skills.ts b/plugins/tracing/src/skills.ts index 7fe3dc6..aa04616 100644 --- a/plugins/tracing/src/skills.ts +++ b/plugins/tracing/src/skills.ts @@ -13,8 +13,9 @@ const SKILL_ACCESS_TOOLS = new Set([ ]); const SKILL_ACCESS_FIELDS = ["cmd", "command", "code", "uri"]; -const SKILL_DOC = /([A-Za-z0-9._@+-]+)\/SKILL\.md\b/g; -const SKILL_SCRIPT = /\bskills\/(?:\.[A-Za-z0-9._-]+\/)?([A-Za-z0-9._@+-]+)\/scripts\//g; +const SKILL_DOC = /([A-Za-z0-9._@+-]+)[\\/]+SKILL\.md\b/g; +const SKILL_SCRIPT = + /\bskills[\\/]+(?:\.[A-Za-z0-9._-]+[\\/]+)?([A-Za-z0-9._@+-]+)[\\/]+scripts[\\/]+/g; const SKILL_PROMPT_FRAGMENT = /\s*([^<\n]+)<\/name>/g; const MAX_SKILL_NAME_LENGTH = 64; diff --git a/plugins/tracing/test/skills.test.ts b/plugins/tracing/test/skills.test.ts index e4719e7..0457e9b 100644 --- a/plugins/tracing/test/skills.test.ts +++ b/plugins/tracing/test/skills.test.ts @@ -61,6 +61,38 @@ describe("skillsForToolCall", () => { ).toEqual(["figma-use"]); }); + it.each([ + [ + "native Windows command", + exec(String.raw`Get-Content C:\Users\dev\.codex\skills\pdf\SKILL.md`), + ], + [ + "escaped Windows path inside exec source", + toolCall( + "exec", + String.raw`const r = await tools.exec_command({cmd:"Get-Content C:\\Users\\dev\\.codex\\skills\\pdf\\SKILL.md"});`, + ), + ], + [ + "Windows argument array", + toolCall("local_shell", { + command: ["Get-Content", String.raw`C:\Users\dev\.codex\skills\pdf\SKILL.md`], + }), + ], + ["mixed separators", exec(String.raw`Get-Content C:\Users\dev/.codex/skills/pdf\SKILL.md`)], + ])("detects a SKILL.md read with %s", (_label, call) => { + expect(skillsForToolCall(call)).toEqual(["pdf"]); + }); + + it.each([ + String.raw`node C:\Users\dev\.codex\skills\pdf\scripts\read.mjs`, + String.raw`node C:\\Users\\dev\\.codex\\skills\\pdf\\scripts\\read.mjs`, + String.raw`node C:\Users\dev\.codex\skills\.system\pdf\scripts\read.mjs`, + String.raw`node C:\Users\dev/.codex/skills/pdf\scripts/read.mjs`, + ])("detects a Windows skill script: %s", (cmd) => { + expect(skillsForToolCall(exec(cmd))).toEqual(["pdf"]); + }); + it("ignores searches, unrelated source paths, and non-command tools", () => { expect(skillsForToolCall(exec("find .agents -type f -name 'SKILL.md'"))).toEqual([]); expect(