fix(agent): stop tool thrash after writes and log rounds
CI / checks (push) Has been cancelled

Cap get_api_docs, break duplicate tool rounds, force a reply after
successful writes, and log each tool call so limit hits are diagnosable.
This commit is contained in:
ginnoir
2026-07-08 22:51:31 -05:00
parent 9bf8e508c7
commit 72d123b9a0
7 changed files with 389 additions and 13 deletions
@@ -4,6 +4,7 @@ export type AssistantChatMessage = {
role: "user" | "assistant";
content: string;
imageUrl?: string;
toolCalls?: Array<{ name: string; status: number }>;
};
const STORAGE_VERSION = "v2";
@@ -19,6 +20,14 @@ function isValidMessage(value: unknown): value is AssistantChatMessage {
if (row.role !== "user" && row.role !== "assistant") return false;
if (typeof row.content !== "string" || row.content.trim().length === 0) return false;
if (row.imageUrl !== undefined && typeof row.imageUrl !== "string") return false;
if (row.toolCalls !== undefined) {
if (!Array.isArray(row.toolCalls)) return false;
for (const call of row.toolCalls) {
if (!call || typeof call !== "object") return false;
const entry = call as Record<string, unknown>;
if (typeof entry.name !== "string" || typeof entry.status !== "number") return false;
}
}
return true;
}