xonecas.io
64875
Mc

mini-coder / commit bfda23b

revert: remove noisy diagnostic logging from e0e7fe9 and 1e8c453

xonecas2026-03-21 bfda23be9b26ef0107b17f81af080af4818f795b parent e0e7fe9

4 files changed

src/agent/session-runner.ts+1−4
@@ -10,7 +10,7 @@ import {
1010 compactToolResultPayloads,
1111 } from "../llm-api/turn-context.ts";
1212 import type { ToolDef } from "../llm-api/types.ts";
13-import { logError, setLogContext } from "../logging/context.ts";
13+import { setLogContext } from "../logging/context.ts";
1414 import { getDb, getMaxTurnIndex, saveMessages } from "../session/db/index.ts";
1515 import { LogsRepo } from "../session/db/logs-repo.ts";
1616 import type { ActiveSession } from "../session/manager.ts";
@@ -242,9 +242,6 @@ export class SessionRunner {
242242 this.coreHistory = compactToolResultPayloads(
243243 applyContextPruning(this.coreHistory),
244244 );
245- } catch (err) {
246- logError(err, "processUserInput turn failed");
247- throw err;
248245 } finally {
249246 setLogContext(null);
250247 }
src/llm-api/turn-execution.ts+1−13
@@ -6,7 +6,6 @@
66 // some providers (OpenAI) emit alongside tool calls, preventing duplicate output.
77 import type { FlexibleSchema, StepResult } from "ai";
88 import { dynamicTool, jsonSchema, type streamText } from "ai";
9-import { logApiEvent } from "../logging/context.ts";
109 import { normalizeUnknownError } from "./error-utils.ts";
1110 import { isRecord } from "./history/shared.ts";
1211 import { isAnthropicModelFamily } from "./model-routing.ts";
@@ -52,16 +51,9 @@ function toCoreTool(def: ToolDef): ReturnType<typeof dynamicTool> {
5251 description: def.description,
5352 inputSchema: schema,
5453 execute: async (input: unknown) => {
55- logApiEvent("tool execute start", { tool: def.name });
5654 try {
57- const result = await def.execute(input);
58- logApiEvent("tool execute end", { tool: def.name });
59- return result;
55+ return await def.execute(input);
6056 } catch (err) {
61- logApiEvent("tool execute error", {
62- tool: def.name,
63- error: String(err),
64- });
6557 throw normalizeUnknownError(err);
6658 }
6759 },
@@ -110,7 +102,6 @@ export function annotateToolCaching(
110102
111103 export function createTurnStateTracker(opts: {
112104 onStepLog: (entry: {
113- stepNumber: number;
114105 finishReason: string | null | undefined;
115106 usage: unknown;
116107 }) => void;
@@ -119,13 +110,10 @@ export function createTurnStateTracker(opts: {
119110 let outputTokens = 0;
120111 let contextTokens = 0;
121112 let partialMessages: CoreMessage[] = [];
122- let stepCount = 0;
123113
124114 return {
125115 onStepFinish: (step: StepResult<ToolSet>) => {
126- stepCount++;
127116 opts.onStepLog({
128- stepNumber: stepCount,
129117 finishReason: step.finishReason,
130118 usage: step.usage,
131119 });
src/llm-api/turn-request.ts+1−4
@@ -1,6 +1,5 @@
11 import type { streamText } from "ai";
22
3-import { logApiEvent } from "../logging/context.ts";
43 import { getMaxOutputTokens } from "./model-info.ts";
54 import { isAnthropicModelFamily } from "./model-routing.ts";
65 import type { ThinkingEffort } from "./provider-options.ts";
@@ -134,11 +133,9 @@ export function buildStreamTextRequest(
134133 }
135134 : {}),
136135 ...(input.signal ? { abortSignal: input.signal } : {}),
137- onError: ({ error }) => {
136+ onError: () => {
138137 // The AI SDK logs errors to stderr by default. We surface failures through
139138 // streamed turn events so CLI output stays compact and consistent.
140- // Log the error so we can debug silent stream terminations.
141- logApiEvent("streamText onError", { error: String(error) });
142139 },
143140 } as StreamTextOptions;
144141 }
src/llm-api/turn.ts+0−3
@@ -106,11 +106,9 @@ export async function* runTurn(options: {
106106 ) as StreamTextResultFull;
107107 result.response.catch(() => {});
108108
109- let lastChunkType: string | undefined;
110109 for await (const event of mapFullStreamToTurnEvents(result.fullStream, {
111110 stepPruneQueue,
112111 onChunk: (streamChunk) => {
113- lastChunkType = streamChunk.type;
114112 if (
115113 streamChunk.type === "tool-call" ||
116114 streamChunk.type === "tool-result"
@@ -129,7 +127,6 @@ export async function* runTurn(options: {
129127
130128 const finalState = turnState.getState();
131129 logApiEvent("turn complete", {
132- lastChunkType,
133130 newMessagesCount: finalState.partialMessages.length,
134131 inputTokens: finalState.inputTokens,
135132 outputTokens: finalState.outputTokens,