Skip to content

Commit 8ce33c6

Browse files
stephentoubCopilot
andcommitted
Normalize platform-specific shell tool names in snapshot matching
The 1.0.64-0 runtime removed report_intent; when the model still calls it, the runtime replies 'Available tools that can be called are <list>.' That list contains platform-specific shell tool names (powershell/read_powershell/ ... on Windows, bash/read_bash/... on Linux/macOS), which broke snapshot matching across CI platform legs. Add a normalizeAvailableToolNames tool-result normalizer that maps the shell tool family names in that error list to stable placeholders (\, \, \, \, \), applied symmetrically to stored snapshots and incoming requests. Re-normalize the 45 affected snapshots accordingly so they match on all platforms. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 469dbb2 commit 8ce33c6

47 files changed

Lines changed: 186 additions & 147 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

test/harness/replayingCapiProxy.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export class ReplayingCapiProxy extends CapturingHttpProxy {
5656
{ toolName: "*", normalizer: normalizeLargeOutputFilepaths },
5757
{ toolName: "${shell}", normalizer: normalizeShellExitMarkers },
5858
{ toolName: "*", normalizer: normalizeGhAuthMessages },
59+
{ toolName: "*", normalizer: normalizeAvailableToolNames },
5960
{ toolName: "read_agent", normalizer: normalizeReadAgentTimings },
6061
];
6162

@@ -1157,6 +1158,44 @@ function normalizeReadAgentTimings(result: string): string {
11571158
.replace(/\bduration: \d+(?:\.\d+)?s\b/g, "duration: 0s");
11581159
}
11591160

1161+
// Maps the platform-specific shell tool family names to stable placeholders.
1162+
// On Windows the runtime exposes powershell/read_powershell/stop_powershell/...,
1163+
// on Linux/macOS it exposes bash/read_bash/stop_bash/.... Ordered so that the
1164+
// prefixed names are handled explicitly; \b boundaries keep bare names from
1165+
// matching inside the prefixed ones.
1166+
const shellToolFamilyReplacements: ReadonlyArray<readonly [RegExp, string]> = [
1167+
[/\bread_powershell\b/g, "${read_shell}"],
1168+
[/\bstop_powershell\b/g, "${stop_shell}"],
1169+
[/\blist_powershell\b/g, "${list_shell}"],
1170+
[/\bwrite_powershell\b/g, "${write_shell}"],
1171+
[/\bpowershell\b/g, "${shell}"],
1172+
[/\bread_bash\b/g, "${read_shell}"],
1173+
[/\bstop_bash\b/g, "${stop_shell}"],
1174+
[/\blist_bash\b/g, "${list_shell}"],
1175+
[/\bwrite_bash\b/g, "${write_shell}"],
1176+
[/\bbash\b/g, "${shell}"],
1177+
];
1178+
1179+
function normalizeShellToolFamilyNames(text: string): string {
1180+
let result = text;
1181+
for (const [pattern, replacement] of shellToolFamilyReplacements) {
1182+
result = result.replace(pattern, replacement);
1183+
}
1184+
return result;
1185+
}
1186+
1187+
// When a model calls a tool that doesn't exist (e.g., the removed report_intent
1188+
// tool), the runtime replies with "Available tools that can be called are <list>."
1189+
// The shell tool family names in that list are platform-specific, so normalize
1190+
// them to placeholders to keep snapshots matching across Windows/Linux/macOS.
1191+
function normalizeAvailableToolNames(result: string): string {
1192+
return result.replace(
1193+
/(Available tools that can be called are )([^.]*)/g,
1194+
(_full, prefix: string, list: string) =>
1195+
prefix + normalizeShellToolFamilyNames(list),
1196+
);
1197+
}
1198+
11601199
// Transforms a single OpenAI-style inbound response message into normalized form
11611200
function transformOpenAIResponseChoice(
11621201
choices: ChatCompletion.Choice[],

test/snapshots/builtin_tools/should_capture_exit_code_in_output.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ conversations:
3939
arguments: '{"command":"echo hello && echo world","description":"Run echo hello && echo world"}'
4040
- role: tool
4141
tool_call_id: toolcall_0
42-
content: Tool 'report_intent' does not exist. Available tools that can be called are powershell, read_powershell,
43-
stop_powershell, list_powershell, view, create, edit, web_fetch, skill, sql, read_agent, list_agents, grep,
44-
glob, task.
42+
content: Tool 'report_intent' does not exist. Available tools that can be called are ${shell}, ${read_shell},
43+
${stop_shell}, ${list_shell}, view, create, edit, web_fetch, skill, sql, read_agent, list_agents, grep, glob,
44+
task.
4545
- role: tool
4646
tool_call_id: toolcall_1
4747
content: |-

test/snapshots/builtin_tools/should_create_a_new_file.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ conversations:
3939
arguments: '{"path":"${workdir}/new_file.txt","file_text":"Created by test"}'
4040
- role: tool
4141
tool_call_id: toolcall_0
42-
content: Tool 'report_intent' does not exist. Available tools that can be called are powershell, read_powershell,
43-
stop_powershell, list_powershell, view, create, edit, web_fetch, skill, sql, read_agent, list_agents, grep,
44-
glob, task.
42+
content: Tool 'report_intent' does not exist. Available tools that can be called are ${shell}, ${read_shell},
43+
${stop_shell}, ${list_shell}, view, create, edit, web_fetch, skill, sql, read_agent, list_agents, grep, glob,
44+
task.
4545
- role: tool
4646
tool_call_id: toolcall_1
4747
content: Created file ${workdir}/new_file.txt with 15 characters

test/snapshots/builtin_tools/should_edit_a_file_successfully.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ conversations:
4141
arguments: '{"path":"${workdir}/edit_me.txt","old_str":"Hello World","new_str":"Hi Universe"}'
4242
- role: tool
4343
tool_call_id: toolcall_0
44-
content: Tool 'report_intent' does not exist. Available tools that can be called are powershell, read_powershell,
45-
stop_powershell, list_powershell, view, create, edit, web_fetch, skill, sql, read_agent, list_agents, grep,
46-
glob, task.
44+
content: Tool 'report_intent' does not exist. Available tools that can be called are ${shell}, ${read_shell},
45+
${stop_shell}, ${list_shell}, view, create, edit, web_fetch, skill, sql, read_agent, list_agents, grep, glob,
46+
task.
4747
- role: tool
4848
tool_call_id: toolcall_1
4949
content: File ${workdir}/edit_me.txt updated with changes.

test/snapshots/builtin_tools/should_find_files_by_pattern.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ conversations:
4242
arguments: '{"pattern":"**/*.ts"}'
4343
- role: tool
4444
tool_call_id: toolcall_0
45-
content: Tool 'report_intent' does not exist. Available tools that can be called are powershell, read_powershell,
46-
stop_powershell, list_powershell, view, create, edit, web_fetch, skill, sql, read_agent, list_agents, grep,
47-
glob, task.
45+
content: Tool 'report_intent' does not exist. Available tools that can be called are ${shell}, ${read_shell},
46+
${stop_shell}, ${list_shell}, view, create, edit, web_fetch, skill, sql, read_agent, list_agents, grep, glob,
47+
task.
4848
- role: tool
4949
tool_call_id: toolcall_1
5050
content: ./src/index.ts

test/snapshots/builtin_tools/should_handle_nonexistent_file_gracefully.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ conversations:
3939
arguments: '{"path":"${workdir}/does_not_exist.txt"}'
4040
- role: tool
4141
tool_call_id: toolcall_0
42-
content: Tool 'report_intent' does not exist. Available tools that can be called are powershell, read_powershell,
43-
stop_powershell, list_powershell, view, create, edit, web_fetch, skill, sql, read_agent, list_agents, grep,
44-
glob, task.
42+
content: Tool 'report_intent' does not exist. Available tools that can be called are ${shell}, ${read_shell},
43+
${stop_shell}, ${list_shell}, view, create, edit, web_fetch, skill, sql, read_agent, list_agents, grep, glob,
44+
task.
4545
- role: tool
4646
tool_call_id: toolcall_1
4747
content: Path ${workdir}/does_not_exist.txt does not exist. Please provide a valid path.

test/snapshots/builtin_tools/should_read_file_with_line_range.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ conversations:
3939
arguments: '{"path":"${workdir}/lines.txt","view_range":[2,4]}'
4040
- role: tool
4141
tool_call_id: toolcall_0
42-
content: Tool 'report_intent' does not exist. Available tools that can be called are powershell, read_powershell,
43-
stop_powershell, list_powershell, view, create, edit, web_fetch, skill, sql, read_agent, list_agents, grep,
44-
glob, task.
42+
content: Tool 'report_intent' does not exist. Available tools that can be called are ${shell}, ${read_shell},
43+
${stop_shell}, ${list_shell}, view, create, edit, web_fetch, skill, sql, read_agent, list_agents, grep, glob,
44+
task.
4545
- role: tool
4646
tool_call_id: toolcall_1
4747
content: |-

test/snapshots/builtin_tools/should_search_for_patterns_in_files.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ conversations:
3939
arguments: '{"pattern":"^ap","path":"${workdir}/data.txt","output_mode":"content","-n":true}'
4040
- role: tool
4141
tool_call_id: toolcall_0
42-
content: Tool 'report_intent' does not exist. Available tools that can be called are powershell, read_powershell,
43-
stop_powershell, list_powershell, view, create, edit, web_fetch, skill, sql, read_agent, list_agents, grep,
44-
glob, task.
42+
content: Tool 'report_intent' does not exist. Available tools that can be called are ${shell}, ${read_shell},
43+
${stop_shell}, ${list_shell}, view, create, edit, web_fetch, skill, sql, read_agent, list_agents, grep, glob,
44+
task.
4545
- role: tool
4646
tool_call_id: toolcall_1
4747
content: |-

test/snapshots/client_options/should_use_client_cwd_for_default_workingdirectory.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ conversations:
2020
arguments: '{"path":"${workdir}/client-cwd/marker.txt"}'
2121
- role: tool
2222
tool_call_id: toolcall_0
23-
content: Tool 'report_intent' does not exist. Available tools that can be called are powershell, read_powershell,
24-
stop_powershell, list_powershell, view, create, edit, web_fetch, skill, sql, read_agent, list_agents, grep,
25-
glob, task.
23+
content: Tool 'report_intent' does not exist. Available tools that can be called are ${shell}, ${read_shell},
24+
${stop_shell}, ${list_shell}, view, create, edit, web_fetch, skill, sql, read_agent, list_agents, grep, glob,
25+
task.
2626
- role: tool
2727
tool_call_id: toolcall_1
2828
content: 1. I am in the client cwd

test/snapshots/event_fidelity/should_emit_events_in_correct_order_for_tool_using_conversation.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ conversations:
3939
arguments: '{"path":"${workdir}/hello.txt"}'
4040
- role: tool
4141
tool_call_id: toolcall_0
42-
content: Tool 'report_intent' does not exist. Available tools that can be called are powershell, read_powershell,
43-
stop_powershell, list_powershell, view, create, edit, web_fetch, skill, sql, read_agent, list_agents, grep,
44-
glob, task.
42+
content: Tool 'report_intent' does not exist. Available tools that can be called are ${shell}, ${read_shell},
43+
${stop_shell}, ${list_shell}, view, create, edit, web_fetch, skill, sql, read_agent, list_agents, grep, glob,
44+
task.
4545
- role: tool
4646
tool_call_id: toolcall_1
4747
content: 1. Hello World

0 commit comments

Comments
 (0)