You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: rewrite repeated tool call reminders to redirect instead of prohibit (#1518)
The r1/r2/r3 reminders injected into repeated tool results led with
prohibition verdicts and, in r2, echoed the repeated tool name and full
arguments back into the context, reinforcing the very pattern they were
meant to break. Rewrite them to state the situation factually and hand
the model a concrete next action: an expectation-setting sentence for
the next call (r1), a forced decision menu of falsify / ask-user /
conclude (r2), and a final hand-off summary without further tool calls
(r3). Detection, thresholds (3/5/8/12), force-stop, and telemetry are
unchanged.
Copy file name to clipboardExpand all lines: packages/agent-core/src/agent/turn/tool-dedup.ts
+15-19Lines changed: 15 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -7,32 +7,28 @@ import { canonicalTelemetryArgs } from './canonical-args';
7
7
8
8
constREMINDER_TEXT_1=
9
9
'\n\n<system-reminder>\n'+
10
-
'You are repeating the exact same tool call with identical parameters.'+
11
-
' Please carefully analyze the previous result. If the task is not yet complete,'+
12
-
' try a different method or parameters instead of repeating the same call.'+
10
+
'The same tool call has been repeated several times in a row. '+
11
+
'Before making your next call, write one sentence stating what new information you expect it to produce. '+
12
+
'Then act on that sentence: if it names something this result does not already give you, choose the action that best provides it; otherwise, continue with the evidence you already have.'+
'You have repeatedly called the same tool with identical parameters many times.\n'+
20
-
'Repeated tool call detected:\n'+
21
-
`- tool: ${toolName}\n`+
22
-
`- repeated_times: ${String(repeatCount)}\n`+
23
-
`- arguments: ${argsStr}\n`+
24
-
'The previous repeated calls did not make progress. Do not call this exact same tool with the exact same arguments again.\n'+
25
-
'Carefully inspect the latest tool result and choose a different next action, different parameters, or finish the task if enough evidence has been gathered.'+
18
+
`The same tool call has now been issued ${String(repeatCount)} times in a row. `+
19
+
'Choose exactly one of the following and state your choice before acting:\n'+
20
+
'(1) Falsification check: run the cheapest test that could conclusively disprove your current approach, if such a test exists.\n'+
21
+
'(2) Missing input: tell the user precisely what information or decision you need to proceed, and ask for it.\n'+
22
+
'(3) Conclude: deliver your best result based on the evidence already gathered, listing anything that remains uncertain.'+
26
23
'\n</system-reminder>'
27
24
);
28
25
}
29
26
30
27
constREMINDER_TEXT_3=
31
28
'\n\n<system-reminder>\n'+
32
-
'You are stuck in a dead end and have repeatedly made the same function call without progress.\n'+
33
-
'Stop all function calls immediately. Do not call any tool in your next response.\n'+
34
-
'In analysis, review the current execution state and identify why progress is blocked.\n'+
35
-
'Then return a text-only summary to the user that reports the current problem, what has already been tried, and what information or decision is needed next.'+
29
+
'Write your final response now, without any further tool calls. '+
30
+
'Cover: the current blocker, each approach you have tried and what it established, and the specific information or decision you need from the user to unblock progress. '+
0 commit comments