From 4270522473e677ddba7b093caa0064a3df51d459 Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Mon, 12 Oct 2026 00:23:28 +0000 Subject: [PATCH] fix(coding-agent): code mode description says schema tools resolve with their value on failure --- packages/coding-agent/CHANGELOG.md | 1 + packages/coding-agent/src/extensions/codemode/tool.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index 1f6407d23..c7414b86f 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -16,6 +16,7 @@ - Fixed Mistral streams being aborted mid-generation (e.g. during long thinking) after the request timeout; the timeout now applies only to waiting for response headers ([#10609](https://github.com/earendil-works/pi/issues/10609)) - Fixed a symlinked `AGENTS.md` in a git worktree nested inside its main repo causing no project context file to load ([#10681](https://github.com/earendil-works/pi/issues/10681)) +- Fixed the code mode tool description claiming every failed tool call rejects; a tool that declares an output schema resolves with its value on failure too (e.g. `bash` with a nonzero exit) ## [1.1.0] - 2026-10-07 diff --git a/packages/coding-agent/src/extensions/codemode/tool.ts b/packages/coding-agent/src/extensions/codemode/tool.ts index f27811cd8..3a510ad70 100644 --- a/packages/coding-agent/src/extensions/codemode/tool.ts +++ b/packages/coding-agent/src/extensions/codemode/tool.ts @@ -136,7 +136,7 @@ export const codemodeToolSystemPromptContribution = { export const CODEMODE_DOCS_PATH = join(getDocsPath(), "codemode.md"); const DESCRIPTION_INTRO = `Run JavaScript that calls other tools. The input is raw JavaScript (not JSON, no code fence), run as an async function body in a QuickJS sandbox: top-level \`await\` and \`return\` work. No Node, file system, network, or timers. -- \`await tools.({ ...args })\` resolves to a string, or an object if the tool's declaration says so, and rejects with an Error on failure. Calls still running when the script ends are cancelled. +- \`await tools.({ ...args })\` resolves to a string, or an object if the tool's declaration says so, and rejects with an Error on failure. A tool whose declaration returns an object resolves on failure too when it returned that object; check its fields. Calls still running when the script ends are cancelled. - Optional first line: \`// @options: {"max_output_tokens": 10000, "timeout_ms": 60000}\``; /** One line per global. The details live in {@link CODEMODE_DOCS_PATH}. */