From 4c944a86d7dce7e05b5e660c2f9619bbff637542 Mon Sep 17 00:00:00 2001 From: Aiden Cline <63023139+rekram1-node@users.noreply.github.com> Date: Mon, 21 Sep 2026 14:35:46 -0500 Subject: [PATCH] fix(core): tell the model search is synchronous (#50417) --- packages/core/src/codemode/instructions.ts | 2 +- packages/core/test/codemode/catalog.test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core/src/codemode/instructions.ts b/packages/core/src/codemode/instructions.ts index a87a677d7c6..859c941f275 100644 --- a/packages/core/src/codemode/instructions.ts +++ b/packages/core/src/codemode/instructions.ts @@ -10,7 +10,7 @@ const prompt = (hasMoreTools: boolean) => `# Code Mode Use the \`execute\` tool to call the tools listed below. They cannot be called directly${hasMoreTools ? ", and neither can \`search\`. Both" : ". They"} only work inside code you pass to \`execute\`. -${hasMoreTools ? `The catalog is partial. Inside \`execute\`, use \`search(...)\` to find a tool, then call it by the \`path\` in the result. Do not guess tool names. +${hasMoreTools ? `The catalog is partial. Inside \`execute\`, use \`search(...)\` to find a tool, then call it by the \`path\` in the result. \`search\` is synchronous. Call it without \`await\`; it does not return a Promise. Do not guess tool names. - ${searchSignature}` : "The catalog is complete. Do not guess tool names."} diff --git a/packages/core/test/codemode/catalog.test.ts b/packages/core/test/codemode/catalog.test.ts index 6132fdee505..c15fee05e12 100644 --- a/packages/core/test/codemode/catalog.test.ts +++ b/packages/core/test/codemode/catalog.test.ts @@ -131,7 +131,7 @@ describe("CodeModeInstructions.render", () => { expect(partial).toContain("- orders (1 tool, none shown)") expect(partial).toContain("They cannot be called directly, and neither can `search`.") expect(partial).toContain( - "The catalog is partial. Inside `execute`, use `search(...)` to find a tool, then call it by the `path` in the result.", + "The catalog is partial. Inside `execute`, use `search(...)` to find a tool, then call it by the `path` in the result. `search` is synchronous. Call it without `await`; it does not return a Promise.", ) expect(partial).toContain("- search(input: {") expect(partial).toContain(" /** @integer @exclusiveMinimum 0 */\n limit?: number,")