From 4a1743126e91a0ea67fd6cb1681effb7411f36ed Mon Sep 17 00:00:00 2001 From: wolfy Date: Sun, 31 May 2026 14:39:37 -0500 Subject: [PATCH] fix: diagnostic issues --- agents/ollama.ts | 29 +++++++++++++++++------------ modes.ts | 2 +- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/agents/ollama.ts b/agents/ollama.ts index 3d4c9f7..365566d 100644 --- a/agents/ollama.ts +++ b/agents/ollama.ts @@ -115,19 +115,22 @@ async function runOllamaLoop(ctx: AgentRunContext): Promise { let response: Awaited>; try { response = await retry( - () => ollama.chat({ - model, - messages, - tools, - keep_alive: -1, - think: false, - options: { num_ctx: 262144 }, - }), + () => + ollama.chat({ + model, + messages, + tools, + keep_alive: -1, + think: false, + options: { num_ctx: 262144 }, + }), { delaysMs: [3_000, 8_000], shouldRetry: (err) => { const msg = err instanceof Error ? err.message : String(err); - return /unexpected EOF|XML syntax error|ECONNRESET|ETIMEDOUT|fetch failed/i.test(msg); + return /unexpected EOF|XML syntax error|ECONNRESET|ETIMEDOUT|fetch failed/i.test( + msg, + ); }, label: `Ollama turn ${iterations}`, }, @@ -138,12 +141,14 @@ async function runOllamaLoop(ctx: AgentRunContext): Promise { return { success: false, error: `Ollama request failed: ${lastError}` }; } - const promptTokens = (response as Record).prompt_eval_count as number | undefined; - const evalTokens = (response as Record).eval_count as number | undefined; + const promptTokens = response.prompt_eval_count; + const evalTokens = response.eval_count; if (promptTokens !== undefined) { const total = promptTokens + (evalTokens ?? 0); const pct = Math.round((total / 262144) * 100); - log.info(` context: ${promptTokens} prompt + ${evalTokens ?? 0} eval = ${total} tokens (${pct}% of limit)`); + log.info( + ` context: ${promptTokens} prompt + ${evalTokens ?? 0} eval = ${total} tokens (${pct}% of limit)`, + ); } const assistantMessage = response.message; diff --git a/modes.ts b/modes.ts index cea0e2f..427d649 100644 --- a/modes.ts +++ b/modes.ts @@ -142,7 +142,7 @@ Inline comments are plain, no-frills anchors on the affected line: - **Optional \`
Technical details...
\` collapsible** for findings whose technical context (longer file:line references, related-code snippets, suggested approach, regression-risk notes) would overwhelm the human-readable lead-in. Same plain-markdown bold-header shape as the body technical-details block — see *Inline technical details* above. Encouraged whenever the depth helps a downstream fix-agent; don't force one when the inline lead-in already says everything. - **Visible portion ≤ 2-3 sentences.** If you find yourself writing more, that's the cue to split the depth into the \`Technical details\` collapsible. - **Multi-site findings go inline too.** A finding that spans multiple files or multiple lines is still an inline comment — anchor it to the PRIMARY causal site (the place a developer would fix first), and list the other affected sites in the \`**Affected sites:**\` section of the technical-details block. "Spans multiple files" is NOT a reason to put a finding in the body. -- **Anchor to the exact problem line.** Use the `| newLine |` column to find the specific line where the problematic symbol is **defined or first assigned** — not a nearby related line. If the symbol is `isAnyPending`, anchor to the line that defines `isAnyPending`, not a line that uses a different variable nearby. +- **Anchor to the exact problem line.** Use the \`| newLine |\` column to find the specific line where the problematic symbol is **defined or first assigned** — not a nearby related line. If the symbol is \`isAnyPending\`, anchor to the line that defines \`isAnyPending\`, not a line that uses a different variable nearby. ## Body-wide rules