diff --git a/packages/opencode/src/session/prompt/gpt.txt b/packages/opencode/src/session/prompt/gpt.txt index 9068df4778dc..1b7d758a81a4 100644 --- a/packages/opencode/src/session/prompt/gpt.txt +++ b/packages/opencode/src/session/prompt/gpt.txt @@ -3,7 +3,7 @@ You are OpenCode, You and the user share the same workspace and collaborate to a You are a deeply pragmatic, effective software engineer. You take engineering quality seriously, and collaboration comes through as direct, factual statements. You communicate efficiently, keeping the user clearly informed about ongoing actions without unnecessary detail. You build context by examining the codebase first without making assumptions or jumping to conclusions. You think through the nuances of the code you encounter, and embody the mentality of a skilled senior software engineer. - When searching for text or files, prefer using Glob and Grep tools (they are powered by `rg`) -- Parallelize tool calls whenever possible - especially file reads. Use `multi_tool_use.parallel` to parallelize tool calls and only this. Never chain together bash commands with separators like `echo "====";` as this renders to the user poorly. +- Parallelize tool calls whenever possible - especially file reads, by sending a single message with multiple tool calls. Never chain together bash commands with separators like `echo "====";` as this renders to the user poorly. ## Editing Approach diff --git a/packages/opencode/test/session/prompt-files.test.ts b/packages/opencode/test/session/prompt-files.test.ts new file mode 100644 index 000000000000..d69fedb53b5a --- /dev/null +++ b/packages/opencode/test/session/prompt-files.test.ts @@ -0,0 +1,26 @@ +import { describe, expect, it } from "bun:test" +import { readdirSync, readFileSync } from "node:fs" +import path from "node:path" + +// Resolves to packages/opencode/src/session/prompt regardless of where bun is invoked from. +const promptDir = path.join(import.meta.dir, "../../src/session/prompt") + +describe("system prompt files", () => { + // Regression for #38332: gpt.txt told the model to "Use `multi_tool_use.parallel` + // to parallelize tool calls". `multi_tool_use.parallel` is an OpenAI legacy + // pseudo-tool from the old parallel function-calling shim; opencode's provider + // adapters do not expose it, so models that followed the instruction attempted + // to call a tool that does not exist (surfacing as failed tool calls). + // Other prompts (anthropic/gemini/codex/...) already describe the correct + // mechanism — "send a single message with multiple tool calls". + it("no prompt references the multi_tool_use.parallel pseudo-tool", () => { + const files = readdirSync(promptDir).filter((file) => file.endsWith(".txt")) + expect(files.length).toBeGreaterThan(0) + for (const file of files) { + const content = readFileSync(path.join(promptDir, file), "utf8") + expect(content, `prompt file ${file} references multi_tool_use.parallel`).not.toContain( + "multi_tool_use.parallel", + ) + } + }) +})