From b0a31a5956d4ef11277cfb3fd9af936583ad12be Mon Sep 17 00:00:00 2001 From: can1357 Date: Thu, 30 Apr 2026 18:34:50 +0200 Subject: [PATCH] fix: outdated tests --- packages/coding-agent/CHANGELOG.md | 2 +- .../test/agent-session-python-cleanup.test.ts | 14 +++++++------- .../coding-agent/test/core/python-prelude.test.ts | 5 ++--- .../coding-agent/test/tools/eval-fallback.test.ts | 6 +++--- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index 23a6e8443..abacab294 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -6,7 +6,7 @@ - Removed the built-in `python` tool in favor of `eval`, so tool allowlists and tool-call handlers referencing `python` need to migrate - Removed the `python.toolMode` setting and replaced mode control with separate `eval.py` and `eval.js` toggles - Changed the tool runtime config surface by migrating `python` execution timeout/export behavior to `eval` and replacing `./ipy/*` internal exports with `./eval/*` paths -- Changed the `eval` tool wire format to a single `input` string with `=== CELL ===` sections, fenced language selection, per-cell header timeouts, and `=== RESET ===` directives instead of top-level `cells`, `language`, `timeout`, and `reset` fields +- Changed the `eval` tool wire format to a single `input` string composed of markdown fenced code blocks (with per-fence language, timeout, title, and reset metadata in the info string) instead of top-level `cells`, `language`, `timeout`, and `reset` fields ### Added diff --git a/packages/coding-agent/test/agent-session-python-cleanup.test.ts b/packages/coding-agent/test/agent-session-python-cleanup.test.ts index 1397f402a..2818acbe3 100644 --- a/packages/coding-agent/test/agent-session-python-cleanup.test.ts +++ b/packages/coding-agent/test/agent-session-python-cleanup.test.ts @@ -378,7 +378,7 @@ describe("AgentSession python cleanup", () => { expect(EvalTool).toBeDefined(); let toolExecutionSettled = false; const toolExecution = EvalTool! - .execute("call-id", { input: "=== CELL ===\n```py\nprint('tool')\n```" }, undefined, undefined, undefined) + .execute("call-id", { input: "```py\nprint('tool')\n```" }, undefined, undefined, undefined) .finally(() => { toolExecutionSettled = true; }); @@ -437,7 +437,7 @@ describe("AgentSession python cleanup", () => { expect(EvalTool).toBeDefined(); const toolExecution = EvalTool!.execute( "call-id", - { input: "=== CELL ===\n```py\nprint('tool after warmup')\n```" }, + { input: "```py\nprint('tool after warmup')\n```" }, undefined, undefined, undefined, @@ -493,7 +493,7 @@ describe("AgentSession python cleanup", () => { expect(EvalTool).toBeDefined(); let toolExecutionSettled = false; const toolExecution = EvalTool! - .execute("call-id", { input: "=== CELL ===\n```py\nprint('tool')\n```" }, undefined, undefined, undefined) + .execute("call-id", { input: "```py\nprint('tool')\n```" }, undefined, undefined, undefined) .finally(() => { toolExecutionSettled = true; }); @@ -507,14 +507,14 @@ describe("AgentSession python cleanup", () => { expect(disposed).toBe(false); expect(toolExecutionSettled).toBe(false); - expect(warmupSpy).toHaveBeenCalledTimes(1); + expect(warmupSpy).toHaveBeenCalledTimes(2); expect(executeSpy).toHaveBeenCalledTimes(1); const [toolResult] = await Promise.all([toolExecution, disposeSession]); expect(disposed).toBe(true); expect(toolExecutionSettled).toBe(true); - expect(warmupSpy).toHaveBeenCalledTimes(1); + expect(warmupSpy).toHaveBeenCalledTimes(2); expect(executeSpy).toHaveBeenCalledTimes(1); expect(toolResult.details?.isError).toBe(true); expect(toolResult.content).toContainEqual( @@ -726,7 +726,7 @@ describe("AgentSession python cleanup", () => { await expect( EvalTool!.execute( "call-id", - { input: "=== CELL ===\n```py\nprint('late')\n```" }, + { input: "```py\nprint('late')\n```" }, undefined, undefined, undefined, @@ -767,7 +767,7 @@ describe("AgentSession python cleanup", () => { expect(EvalTool).toBeDefined(); const execution = EvalTool!.execute( "call-id", - { input: "=== CELL ===\n```py\nprint('late after artifact')\n```" }, + { input: "```py\nprint('late after artifact')\n```" }, undefined, undefined, undefined, diff --git a/packages/coding-agent/test/core/python-prelude.test.ts b/packages/coding-agent/test/core/python-prelude.test.ts index 22bd62b10..302b0d201 100644 --- a/packages/coding-agent/test/core/python-prelude.test.ts +++ b/packages/coding-agent/test/core/python-prelude.test.ts @@ -40,7 +40,7 @@ const shouldRun = Boolean(pythonPath) && hasKernelDeps; describe.skipIf(!shouldRun)("PYTHON_PRELUDE integration", () => { it("exposes prelude helpers via eval python backend", async () => { - const helpers = ["env", "read", "write", "append", "rm", "mv", "cp", "find", "grep"]; + const helpers = ["env", "read", "write", "append", "find", "glob", "grep", "rgrep", "sed", "tree", "stat", "diff", "run", "output"]; const session = { cwd: getProjectDir(), @@ -64,8 +64,7 @@ describe.skipIf(!shouldRun)("PYTHON_PRELUDE integration", () => { `; const result = await tool.execute("tool-call-1", { - input: `=== CELL prelude helpers === -\`\`\`py + input: `\`\`\`py prelude helpers ${code} \`\`\` `, diff --git a/packages/coding-agent/test/tools/eval-fallback.test.ts b/packages/coding-agent/test/tools/eval-fallback.test.ts index e9392e4d8..9fecf9abc 100644 --- a/packages/coding-agent/test/tools/eval-fallback.test.ts +++ b/packages/coding-agent/test/tools/eval-fallback.test.ts @@ -40,7 +40,7 @@ describe("EvalTool language resolution", () => { const tool = new EvalTool(makeSession()); await tool.execute("call-1", { - input: "=== CELL one ===\n```js\nconst x = 1;\n```\n", + input: "```js one\nconst x = 1;\n```\n", }); expect(jsExecuteSpy).toHaveBeenCalledTimes(1); @@ -54,7 +54,7 @@ describe("EvalTool language resolution", () => { const tool = new EvalTool(makeSession()); await tool.execute("call-2", { - input: "=== CELL one ===\n```python\nprint('hi')\n```\n", + input: "```python one\nprint('hi')\n```\n", }); expect(pythonExecuteSpy).toHaveBeenCalledTimes(1); @@ -68,7 +68,7 @@ describe("EvalTool language resolution", () => { const tool = new EvalTool(makeSession()); await tool.execute("call-3", { - input: "=== CELL one ===\ndef greet():\n print('hi')\ngreet()\n", + input: "def greet():\n print('hi')\ngreet()\n", }); expect(pythonExecuteSpy).toHaveBeenCalledTimes(1);