diff --git a/vibn-frontend/app/api/chat/route.ts b/vibn-frontend/app/api/chat/route.ts index 1fd7d8d1..593804a8 100644 --- a/vibn-frontend/app/api/chat/route.ts +++ b/vibn-frontend/app/api/chat/route.ts @@ -1744,7 +1744,10 @@ export async function POST(request: Request) { } catch { const fallback = buildHealthStatus({ loopBreakReason, - hitRoundCap: maxToolRounds > 0 && round >= maxToolRounds, + // If the loop was forcibly aborted by the user typing a new message mid-flight, + // we don't want to falsely claim we hit the tool-round cap. We only hit the cap + // if aborted is false. + hitRoundCap: !aborted && maxToolRounds > 0 && round >= maxToolRounds, lastError: extractLastToolFailure(messages), toolCount: assistantToolCalls.length, });