test: early-exit code-exec smoke tests once tool invocation is observed (#10954)

This commit is contained in:
filip
2026-08-05 10:13:34 -07:00
committed by GitHub
parent 6646a0f6e2
commit c0bb2575a5
@@ -22,6 +22,13 @@ beforeAll(() => {
const { testAll } = providerTest(discoverTestCases({ skipAgentic: true }));
// Matches: "execute_typescript | code_execution", "get_function_details | code_execution",
// "tool call | execute", "tool calls | execute" (old format)
// "▸ execute N tool call" (new format with tool_graph)
// "▸ execute_typescript" (plain tool name in output)
const codeExecPattern =
/(execute_typescript \| code_execution)|(get_function_details \| code_execution)|(tool calls? \| execute)|(▸.*execute.*tool call)|(▸ execute_typescript)/;
testAll('invokes code_execution tool', async (tc, { expect }) => {
const testdir = fs.mkdtempSync(path.join(os.tmpdir(), 'goose-codeexec-'));
try {
@@ -30,16 +37,11 @@ testAll('invokes code_execution tool', async (tc, { expect }) => {
testdir,
"Store a memory with category 'test' and data 'hello world', then retrieve all memories from category 'test'.",
BUILTINS,
{ GOOSE_PROVIDER: tc.provider, GOOSE_MODEL: tc.model }
{ GOOSE_PROVIDER: tc.provider, GOOSE_MODEL: tc.model },
55_000,
(output) => codeExecPattern.test(output)
);
// Matches: "execute_typescript | code_execution", "get_function_details | code_execution",
// "tool call | execute", "tool calls | execute" (old format)
// "▸ execute N tool call" (new format with tool_graph)
// "▸ execute_typescript" (plain tool name in output)
const codeExecPattern =
/(execute_typescript \| code_execution)|(get_function_details \| code_execution)|(tool calls? \| execute)|(▸.*execute.*tool call)|(▸ execute_typescript)/;
expect(
codeExecPattern.test(output),
`Expected code_execution tool to be called\n\nFull output:\n${output}`