fix(coding-agent): keep hidden tools out of prompt rules and skills hint

Rules and the tool list follow the declared tools (active minus
hiddenDeclarations). The skills hint names no tool when the reader is
hidden. Codemode shows each tool's prompt guidelines with its
declaration, via the new ToolLoadout.getPromptGuidelines().

closes #10343
This commit is contained in:
Armin Ronacher 2026-10-05 18:49:43 +02:00
parent 68c22123be
commit c30840c2eb
12 changed files with 111 additions and 18 deletions

View file

@ -175,12 +175,34 @@ describe("AgentSession codemode tool", () => {
expect(requestPrompts[1]).not.toContain("\n- read: ");
expect(requestPrompts[1]).toContain("\n- codemode: ");
expect(harness.session.systemPrompt).not.toContain("\n- read: ");
// Hidden tools' guidelines move from the rules to their codemode sections (#10343).
expect(requestPrompts[1]).not.toContain("Use read to examine files");
expect(description("codemode")).toContain("- Use read to examine files instead of cat or sed.");
// Without codemode, tools keep their plain descriptions.
harness.session.setActiveToolsByName(["echo"]);
expect(description("echo")).toBe("Echo text back.\n\nSecond paragraph.");
});
// #10343
it("shows the guidelines of tools that do not fit the inline budget through describeTool()", async () => {
const harness = await setup();
harness.settingsManager.applyOverrides({ codemode: { mode: "only", inlineBudget: 0 } });
harness.session.setActiveToolsByName(["read", "codemode"]);
const codemode = harness.session.agent.state.tools.find((tool) => tool.name === "codemode");
expect(codemode?.description).not.toContain("### `read`");
harness.setResponses([
fauxAssistantMessage([fauxToolCall("codemode", { code: 'text(await describeTool("read"))' })], {
stopReason: "toolUse",
}),
fauxAssistantMessage("done"),
]);
await harness.session.prompt("go");
expect(resultText(codemodeResult(harness))).toContain("- Use read to examine files instead of cat or sed.");
});
it("runs nested calls in parallel and returns only the script result", async () => {
const harness = await setup();
harness.setResponses([