fix(ai): bump loop-breaker limits from 16 to 30 to permit long autonomous workflows

This commit is contained in:
2026-05-19 14:51:45 -07:00
parent 2e5ca29c40
commit d7d4b2d2fe

View File

@@ -33,9 +33,9 @@ import { buildCodebaseSummary } from "@/lib/ai/codebase-summary";
import type { ChatMessage, ToolCall } from "@/lib/ai/gemini-chat";
// C-01: Lowered from 15 → 8. Real workflows (scaffold → install →
// configure → start) rarely need more than 8 rounds when done correctly.
// configure → start) rarely need more than 16 rounds when done correctly.
// If the cap IS hit the model gets a recovery summary, not silence.
const MAX_TOOL_ROUNDS = 8;
const MAX_TOOL_ROUNDS = 30;
let chatTablesReady = false;
async function ensureChatTables() {
@@ -683,7 +683,7 @@ export async function POST(request: Request) {
// Every 8 silent rounds or 12 tool calls, gently nudge the model to surface a one-liner
// status before continuing. This is the user's only signal of
// life when a tool chain runs long, but we keep the threshold high so it doesn't distract.
const isSilent = roundsSinceText >= 8 || toolCallsSinceText >= 12;
const isSilent = roundsSinceText >= 30 || toolCallsSinceText >= 12;
let extraSystem = isSilent
? "\n\n[STATUS NUDGE] You have run " +
`${toolCallsSinceText} tool call(s) over ${roundsSinceText} round(s) ` +
@@ -1138,7 +1138,7 @@ export async function POST(request: Request) {
return `${m.role.toUpperCase()}: ${text.slice(0, 1200)}`;
})
.join("\n\n");
} catch (err) {
} catch (err) {
console.warn("[chat] plan-extract failed (non-fatal):", err);
}
})().catch(() => {});