From a9bcdd77ddd11d438b344ffb494452daf12933f0 Mon Sep 17 00:00:00 2001 From: wolfy Date: Mon, 1 Jun 2026 13:51:26 -0500 Subject: [PATCH] chore: promote read_file args to info log, fix content parsing --- agents/ollama.ts | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/agents/ollama.ts b/agents/ollama.ts index c692d14..61fa1c9 100644 --- a/agents/ollama.ts +++ b/agents/ollama.ts @@ -307,10 +307,21 @@ async function runOllamaLoop(ctx: AgentRunContext): Promise { }); // Track read_file calls so we can reconstruct context after pruning. + // read_file returns { content: "..." } JSON — parse out the actual content. + // Promote args logging to info so we can diagnose the path key format. if (toolName === "read_file") { - const path = (toolArgs as Record)?.path; - if (typeof path === "string" && !readFileLog.has(path)) { - readFileLog.set(path, result.slice(0, 500)); + const args = toolArgs as Record; + log.info(` read_file args keys: ${Object.keys(args).join(", ")} | path type: ${typeof args.path} | path: ${String(args.path).slice(0, 120)}`); + const path = typeof args.path === "string" ? args.path : undefined; + if (path && !readFileLog.has(path)) { + let excerpt: string; + try { + const parsed = JSON.parse(result) as { content?: string }; + excerpt = (parsed.content ?? result).slice(0, 500); + } catch { + excerpt = result.slice(0, 500); + } + readFileLog.set(path, excerpt); } }