feat: add debug logging for silently caught errors (#809)

Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
jnjpng
2026-02-03 17:47:22 -08:00
committed by GitHub
parent 5ddce473e6
commit 0b5a4549a6
5 changed files with 66 additions and 21 deletions

View File

@@ -386,8 +386,8 @@ function sendDesktopNotification(
// Send terminal bell for native notification
process.stdout.write("\x07");
// Run Notification hooks (fire-and-forget, don't block)
runNotificationHooks(message, level).catch(() => {
// Silently ignore hook errors
runNotificationHooks(message, level).catch((error) => {
debugLog("hooks", "Notification hook error", error);
});
}

View File

@@ -7,6 +7,7 @@
import type { LettaStreamingResponse } from "@letta-ai/letta-client/resources/agents/messages";
import { INTERRUPTED_BY_USER } from "../../constants";
import { runPostToolUseHooks, runPreToolUseHooks } from "../../hooks";
import { debugLog } from "../../utils/debug";
import { extractCompactionSummary } from "./backfill";
import { findLastSafeSplitPoint } from "./markdownSplit";
import { isShellTool } from "./toolNameMapping";
@@ -652,7 +653,9 @@ export function onChunk(b: Buffers, chunk: LettaStreamingResponse) {
toolCallId,
undefined,
b.agentId,
).catch(() => {});
).catch((error) => {
debugLog("hooks", "PreToolUse hook error (accumulator)", error);
});
}
}
@@ -748,7 +751,9 @@ export function onChunk(b: Buffers, chunk: LettaStreamingResponse) {
b.agentId,
precedingReasoning,
precedingAssistantMessage,
).catch(() => {});
).catch((error) => {
debugLog("hooks", "PostToolUse hook error (accumulator)", error);
});
b.serverToolCalls.delete(toolCallId);
}