fix(audit): resolve lint global, compaction metrics, and nudge id
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user