From 886752217de5349d43896bdc335ce2023319f777 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 24 Jan 2026 05:06:33 +0000 Subject: [PATCH] fix: gate diagnostic logs behind verbose --- src/agents/pi-embedded-runner/runs.ts | 6 +++--- src/logging/diagnostic.ts | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/agents/pi-embedded-runner/runs.ts b/src/agents/pi-embedded-runner/runs.ts index dcbe56244..042c12f06 100644 --- a/src/agents/pi-embedded-runner/runs.ts +++ b/src/agents/pi-embedded-runner/runs.ts @@ -43,7 +43,7 @@ export function abortEmbeddedPiRun(sessionId: string): boolean { diag.debug(`abort failed: sessionId=${sessionId} reason=no_active_run`); return false; } - diag.info(`aborting run: sessionId=${sessionId}`); + diag.debug(`aborting run: sessionId=${sessionId}`); handle.abort(); return true; } @@ -110,7 +110,7 @@ export function setActiveEmbeddedRun(sessionId: string, handle: EmbeddedPiQueueH reason: wasActive ? "run_replaced" : "run_started", }); if (!sessionId.startsWith("probe-")) { - diag.info(`run registered: sessionId=${sessionId} totalActive=${ACTIVE_EMBEDDED_RUNS.size}`); + diag.debug(`run registered: sessionId=${sessionId} totalActive=${ACTIVE_EMBEDDED_RUNS.size}`); } } @@ -119,7 +119,7 @@ export function clearActiveEmbeddedRun(sessionId: string, handle: EmbeddedPiQueu ACTIVE_EMBEDDED_RUNS.delete(sessionId); logSessionStateChange({ sessionId, state: "idle", reason: "run_completed" }); if (!sessionId.startsWith("probe-")) { - diag.info(`run cleared: sessionId=${sessionId} totalActive=${ACTIVE_EMBEDDED_RUNS.size}`); + diag.debug(`run cleared: sessionId=${sessionId} totalActive=${ACTIVE_EMBEDDED_RUNS.size}`); } notifyEmbeddedRunEnded(sessionId); } else { diff --git a/src/logging/diagnostic.ts b/src/logging/diagnostic.ts index adcb93eca..ff51dd4bf 100644 --- a/src/logging/diagnostic.ts +++ b/src/logging/diagnostic.ts @@ -63,7 +63,7 @@ export function logWebhookReceived(params: { }) { webhookStats.received += 1; webhookStats.lastReceived = Date.now(); - diag.info( + diag.debug( `webhook received: channel=${params.channel} type=${params.updateType ?? "unknown"} chatId=${ params.chatId ?? "unknown" } total=${webhookStats.received}`, @@ -84,7 +84,7 @@ export function logWebhookProcessed(params: { durationMs?: number; }) { webhookStats.processed += 1; - diag.info( + diag.debug( `webhook processed: channel=${params.channel} type=${ params.updateType ?? "unknown" } chatId=${params.chatId ?? "unknown"} duration=${params.durationMs ?? 0}ms processed=${ @@ -132,7 +132,7 @@ export function logMessageQueued(params: { const state = getSessionState(params); state.queueDepth += 1; state.lastActivity = Date.now(); - diag.info( + diag.debug( `message queued: sessionId=${state.sessionId ?? "unknown"} sessionKey=${ state.sessionKey ?? "unknown" } source=${params.source} queueDepth=${state.queueDepth} sessionState=${state.state}`, @@ -173,7 +173,7 @@ export function logMessageProcessed(params: { } else if (params.outcome === "skipped") { diag.debug(payload); } else { - diag.info(payload); + diag.debug(payload); } emitDiagnosticEvent({ type: "message.processed", @@ -203,7 +203,7 @@ export function logSessionStateChange( state.lastActivity = Date.now(); if (params.state === "idle") state.queueDepth = Math.max(0, state.queueDepth - 1); if (!isProbeSession) { - diag.info( + diag.debug( `session state: sessionId=${state.sessionId ?? "unknown"} sessionKey=${ state.sessionKey ?? "unknown" } prev=${prevState} new=${params.state} reason="${params.reason ?? ""}" queueDepth=${ @@ -263,7 +263,7 @@ export function logLaneDequeue(lane: string, waitMs: number, queueSize: number) } export function logRunAttempt(params: SessionRef & { runId: string; attempt: number }) { - diag.info( + diag.debug( `run attempt: sessionId=${params.sessionId ?? "unknown"} sessionKey=${ params.sessionKey ?? "unknown" } runId=${params.runId} attempt=${params.attempt}`, @@ -285,7 +285,7 @@ export function logActiveRuns() { ([id, s]) => `${id}(q=${s.queueDepth},age=${Math.round((Date.now() - s.lastActivity) / 1000)}s)`, ); - diag.info(`active runs: count=${activeSessions.length} sessions=[${activeSessions.join(", ")}]`); + diag.debug(`active runs: count=${activeSessions.length} sessions=[${activeSessions.join(", ")}]`); markActivity(); } @@ -314,7 +314,7 @@ export function startDiagnosticHeartbeat() { if (!hasActivity) return; if (now - lastActivityAt > 120_000 && activeCount === 0 && waitingCount === 0) return; - diag.info( + diag.debug( `heartbeat: webhooks=${webhookStats.received}/${webhookStats.processed}/${webhookStats.errors} active=${activeCount} waiting=${waitingCount} queued=${totalQueued}`, ); emitDiagnosticEvent({