fix(audit): resolve lint global, compaction metrics, and nudge id

This commit is contained in:
William Valentin
2026-02-15 21:54:12 -08:00
parent 50dcff5ea6
commit 948d589ac3
7 changed files with 106 additions and 11 deletions
+5 -6
View File
@@ -339,18 +339,17 @@ export class NativeAgent {
// If the same tool has been called too many times, append a nudge
// telling the model to use what it has. This combats local models
// that endlessly retry searches with slight query variations.
let nudgeMessage: string | null = null;
if (sameToolStreak >= maxSameToolStreak && !nudged) {
nudged = true;
toolResultBlocks.push({
type: 'tool_result',
tool_use_id: '__system',
content: `You have called this tool ${sameToolStreak} times in a row. You have enough information — do NOT call it again. Summarize what you have found and respond to the user now.`,
is_error: false,
});
nudgeMessage = `You have called this tool ${sameToolStreak} times in a row. You have enough information — do NOT call it again. Summarize what you have found and respond to the user now.`;
}
// Add tool results as a user message
loopMessages.push({ role: 'user', content: toolResultBlocks });
if (nudgeMessage) {
loopMessages.push({ role: 'user', content: nudgeMessage });
}
// Break out if the model is stuck in a repeated tool call loop
if (consecutiveRepeats >= maxConsecutiveRepeats) {