From ebef719464a20fa44cacde8bc82388c2ed8ed5a7 Mon Sep 17 00:00:00 2001 From: Filip Kujawa Date: Tue, 4 Aug 2026 17:48:19 -0700 Subject: [PATCH] test: early-exit code-exec smoke tests once tool invocation is observed The code_execution smoke test only checked its output pattern after the goose process exited, so models that keep looping tool calls past the 55s kill timer failed the test even though the asserted behavior (invoking the code_execution tool) had already happened seconds in. Pass the pattern as runGoose's early-exit success predicate, matching what the shell-tool smoke test already does. --- .../test_providers_code_exec.test.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/ui/desktop/tests/integration/test_providers_code_exec.test.ts b/ui/desktop/tests/integration/test_providers_code_exec.test.ts index f1d8c0c904bc..5db51778eab7 100644 --- a/ui/desktop/tests/integration/test_providers_code_exec.test.ts +++ b/ui/desktop/tests/integration/test_providers_code_exec.test.ts @@ -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}`