fix(coding-agent): preserved tool schemas while redacting

Converted provider-facing tool parameters to wire JSON Schema before redaction so live Zod instances are not deep-cloned into plain objects.

Fixes #2146
This commit is contained in:
roboomp
2026-06-10 08:26:02 +02:00
committed by can1357
parent 2a90108893
commit aa4cd0ab2d
6 changed files with 83 additions and 17 deletions
@@ -184,7 +184,7 @@ import planModeToolDecisionReminderPrompt from "../prompts/system/plan-mode-tool
import ttsrInterruptTemplate from "../prompts/system/ttsr-interrupt.md" with { type: "text" };
import ttsrToolReminderTemplate from "../prompts/system/ttsr-tool-reminder.md" with { type: "text" };
import { type AgentRegistry, MAIN_AGENT_ID } from "../registry/agent-registry";
import { deobfuscateSessionContext, type SecretObfuscator } from "../secrets/obfuscator";
import { deobfuscateSessionContext, obfuscateProviderTools, type SecretObfuscator } from "../secrets/obfuscator";
import { invalidateHostMetadata } from "../ssh/connection-manager";
import {
AUTO_THINKING,
@@ -6383,7 +6383,7 @@ export class AgentSession {
apiKey,
{
systemPrompt: this.#obfuscateForProvider(this.#baseSystemPrompt),
tools: this.#obfuscateForProvider(this.agent.state.tools),
tools: obfuscateProviderTools(this.#obfuscator, this.agent.state.tools),
customInstructions,
convertToLlm: messages => this.#convertToLlmForSideRequest(messages),
initiatorOverride: "agent",