fix: console error leak (#1049)
Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
@@ -2547,7 +2547,11 @@ export default function App({
|
|||||||
setApprovalContexts(contexts);
|
setApprovalContexts(contexts);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// If analysis fails, leave context as null (will show basic options)
|
// If analysis fails, leave context as null (will show basic options)
|
||||||
console.error("Failed to analyze startup approvals:", error);
|
debugLog(
|
||||||
|
"approvals",
|
||||||
|
"Failed to analyze startup approvals: %O",
|
||||||
|
error,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -2861,7 +2865,7 @@ export default function App({
|
|||||||
setCurrentToolset(persistedToolsetPreference);
|
setCurrentToolset(persistedToolsetPreference);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error fetching agent config:", error);
|
debugLog("agent-config", "Error fetching agent config: %O", error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
fetchConfig();
|
fetchConfig();
|
||||||
@@ -3680,7 +3684,7 @@ export default function App({
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Silently fail - don't interrupt the conversation flow
|
// Silently fail - don't interrupt the conversation flow
|
||||||
console.error("Failed to sync agent state:", error);
|
debugLog("sync-agent", "Failed to sync agent state: %O", error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -7496,8 +7500,9 @@ export default function App({
|
|||||||
setApprovalContexts(contexts);
|
setApprovalContexts(contexts);
|
||||||
} catch (approvalError) {
|
} catch (approvalError) {
|
||||||
// If analysis fails, leave context as null (will show basic options)
|
// If analysis fails, leave context as null (will show basic options)
|
||||||
console.error(
|
debugLog(
|
||||||
"Failed to analyze resume approvals:",
|
"approvals",
|
||||||
|
"Failed to analyze resume approvals: %O",
|
||||||
approvalError,
|
approvalError,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -9524,9 +9529,12 @@ ${SYSTEM_REMINDER_CLOSE}
|
|||||||
a.size === b.size && [...a].every((id) => b.has(id));
|
a.size === b.size && [...a].every((id) => b.has(id));
|
||||||
|
|
||||||
if (!setsEqual(expectedIds, sendingIds)) {
|
if (!setsEqual(expectedIds, sendingIds)) {
|
||||||
console.error("[BUG] Approval ID mismatch detected");
|
debugLog(
|
||||||
console.error("Expected IDs:", Array.from(expectedIds));
|
"approvals",
|
||||||
console.error("Sending IDs:", Array.from(sendingIds));
|
"[BUG] Approval ID mismatch detected. Expected: %O, Sending: %O",
|
||||||
|
Array.from(expectedIds),
|
||||||
|
Array.from(sendingIds),
|
||||||
|
);
|
||||||
throw new Error(
|
throw new Error(
|
||||||
"Approval ID mismatch - refusing to send mismatched IDs",
|
"Approval ID mismatch - refusing to send mismatched IDs",
|
||||||
);
|
);
|
||||||
@@ -12229,8 +12237,9 @@ Plan file path: ${planFilePath}`;
|
|||||||
setApprovalContexts(contexts);
|
setApprovalContexts(contexts);
|
||||||
} catch (approvalError) {
|
} catch (approvalError) {
|
||||||
// If analysis fails, leave context as null (will show basic options)
|
// If analysis fails, leave context as null (will show basic options)
|
||||||
console.error(
|
debugLog(
|
||||||
"Failed to analyze resume approvals:",
|
"approvals",
|
||||||
|
"Failed to analyze resume approvals: %O",
|
||||||
approvalError,
|
approvalError,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { Box, useInput } from "ink";
|
|||||||
import Link from "ink-link";
|
import Link from "ink-link";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { getClient } from "../../agent/client";
|
import { getClient } from "../../agent/client";
|
||||||
|
import { debugLog } from "../../utils/debug";
|
||||||
import { useTerminalWidth } from "../hooks/useTerminalWidth";
|
import { useTerminalWidth } from "../hooks/useTerminalWidth";
|
||||||
import { colors } from "./colors";
|
import { colors } from "./colors";
|
||||||
import { MarkdownDisplay } from "./MarkdownDisplay";
|
import { MarkdownDisplay } from "./MarkdownDisplay";
|
||||||
@@ -56,7 +57,7 @@ export function MemoryTabViewer({
|
|||||||
});
|
});
|
||||||
setFreshBlocks(agent.memory?.blocks || []);
|
setFreshBlocks(agent.memory?.blocks || []);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Failed to fetch memory blocks:", error);
|
debugLog("memory-tab", "Failed to fetch memory blocks: %O", error);
|
||||||
// Fall back to passed-in blocks if fetch fails
|
// Fall back to passed-in blocks if fetch fails
|
||||||
setFreshBlocks(blocks);
|
setFreshBlocks(blocks);
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import {
|
|||||||
type AwsProfile,
|
type AwsProfile,
|
||||||
parseAwsCredentials,
|
parseAwsCredentials,
|
||||||
} from "../../utils/aws-credentials";
|
} from "../../utils/aws-credentials";
|
||||||
|
import { debugLog } from "../../utils/debug";
|
||||||
import { useTerminalWidth } from "../hooks/useTerminalWidth";
|
import { useTerminalWidth } from "../hooks/useTerminalWidth";
|
||||||
import { colors } from "./colors";
|
import { colors } from "./colors";
|
||||||
import { Text } from "./Text";
|
import { Text } from "./Text";
|
||||||
@@ -166,8 +167,7 @@ export function ProviderSelector({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
// eslint-disable-next-line no-console
|
debugLog("provider", "Failed to parse AWS credentials: %O", err);
|
||||||
console.error("Failed to parse AWS credentials:", err);
|
|
||||||
if (mountedRef.current) {
|
if (mountedRef.current) {
|
||||||
setAwsProfiles([]);
|
setAwsProfiles([]);
|
||||||
setIsLoadingProfiles(false);
|
setIsLoadingProfiles(false);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { readdirSync, statSync } from "node:fs";
|
import { readdirSync, statSync } from "node:fs";
|
||||||
import { join, resolve } from "node:path";
|
import { join, resolve } from "node:path";
|
||||||
|
import { debugLog } from "../../utils/debug";
|
||||||
|
|
||||||
interface FileMatch {
|
interface FileMatch {
|
||||||
path: string;
|
path: string;
|
||||||
@@ -245,7 +246,7 @@ export async function searchFiles(
|
|||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Return empty array on any error
|
// Return empty array on any error
|
||||||
console.error("File search error:", error);
|
debugLog("file-search", "File search error: %O", error);
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import { LETTA_CLOUD_API_URL } from "../../auth/oauth.js";
|
|||||||
import { resizeImageIfNeeded } from "../../cli/helpers/imageResize.js";
|
import { resizeImageIfNeeded } from "../../cli/helpers/imageResize.js";
|
||||||
import { SYSTEM_REMINDER_CLOSE, SYSTEM_REMINDER_OPEN } from "../../constants";
|
import { SYSTEM_REMINDER_CLOSE, SYSTEM_REMINDER_OPEN } from "../../constants";
|
||||||
import { settingsManager } from "../../settings-manager.js";
|
import { settingsManager } from "../../settings-manager.js";
|
||||||
|
import { debugLog } from "../../utils/debug.js";
|
||||||
import { OVERFLOW_CONFIG, writeOverflowFile } from "./overflow.js";
|
import { OVERFLOW_CONFIG, writeOverflowFile } from "./overflow.js";
|
||||||
import { LIMITS } from "./truncation.js";
|
import { LIMITS } from "./truncation.js";
|
||||||
import { validateRequiredParams } from "./validation.js";
|
import { validateRequiredParams } from "./validation.js";
|
||||||
@@ -179,7 +180,7 @@ function formatWithLineNumbers(
|
|||||||
overflowPath = writeOverflowFile(content, workingDirectory, "Read");
|
overflowPath = writeOverflowFile(content, workingDirectory, "Read");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Silently fail if overflow file creation fails
|
// Silently fail if overflow file creation fails
|
||||||
console.error("Failed to write overflow file:", error);
|
debugLog("read", "Failed to write overflow file: %O", error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
* When outputs exceed limits, full content can be written to overflow files.
|
* When outputs exceed limits, full content can be written to overflow files.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { debugLog } from "../../utils/debug.js";
|
||||||
import { OVERFLOW_CONFIG, writeOverflowFile } from "./overflow.js";
|
import { OVERFLOW_CONFIG, writeOverflowFile } from "./overflow.js";
|
||||||
|
|
||||||
// Limits based on Claude Code's proven production values
|
// Limits based on Claude Code's proven production values
|
||||||
@@ -64,7 +65,7 @@ export function truncateByChars(
|
|||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Silently fail if overflow file creation fails
|
// Silently fail if overflow file creation fails
|
||||||
console.error("Failed to write overflow file:", error);
|
debugLog("truncation", "Failed to write overflow file: %O", error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,7 +168,7 @@ export function truncateByLines(
|
|||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Silently fail if overflow file creation fails
|
// Silently fail if overflow file creation fails
|
||||||
console.error("Failed to write overflow file:", error);
|
debugLog("truncation", "Failed to write overflow file: %O", error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -250,7 +251,7 @@ export function truncateArray<T>(
|
|||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Silently fail if overflow file creation fails
|
// Silently fail if overflow file creation fails
|
||||||
console.error("Failed to write overflow file:", error);
|
debugLog("truncation", "Failed to write overflow file: %O", error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user