Skip to content
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
a577e6e
fix(core): halt turns on repeated identical tool errors (issue #10887)
yiliang114 Sep 3, 2026
e81c877
Merge branch 'main' into fix/issue-10887-tool-error-loop
yiliang114 Sep 3, 2026
e962446
fix(core): count error-loop guard rounds, not parallel-batch siblings
yiliang114 Sep 3, 2026
eb846eb
fix(core): fingerprint batch-budget truncation envelopes by content d…
yiliang114 Sep 3, 2026
75c8fe0
fix(core): fingerprint repeated tool errors on producer-owned identities
yiliang114 Sep 4, 2026
22ed450
test(cli): pin repeated-tool-error membership in the always-on hint list
yiliang114 Sep 4, 2026
97c9fe7
fix(core): carry repeated-error evidence on the LoopDetected event
Sep 4, 2026
23937e8
refactor(core): export producer-owned CANCELLED_TOOL_ERROR_PREFIX
Sep 4, 2026
8a8240c
test(core): pin the client.ts wiring of the repeated-tool-error guard
Sep 4, 2026
3b1ce40
fix(core): unify repeated-tool-error fingerprints across truncation f…
yiliang114 Sep 4, 2026
d136ac9
fix(core): correct cancel-prefix JSDoc and surrogate-safe error_excerpt
yiliang114 Sep 4, 2026
6439e09
Merge branch 'main' into fix/issue-10887-tool-error-loop
yiliang114 Sep 6, 2026
4ea2113
Merge remote-tracking branch 'origin/main' into fix/issue-10887-tool-…
yiliang114 Sep 15, 2026
64f1cc6
Merge remote-tracking branch 'origin/main' into fix/issue-10887-tool-…
yiliang114 Sep 15, 2026
438ee93
Merge remote-tracking branch 'origin/main' into fix/issue-10887-tool-…
yiliang114 Sep 15, 2026
bd82c84
Merge remote-tracking branch 'origin/main' into fix/issue-10887-tool-…
yiliang114 Sep 15, 2026
90db989
Merge origin/main (1d03a07f35) into fix/issue-10887-tool-error-loop
yiliang114 Sep 27, 2026
f263645
fix(core): close the three review Criticals on the tool-error guard
yiliang114 Sep 27, 2026
af1c1eb
Merge origin/main (0105eb7d49) into fix/issue-10887-tool-error-loop
yiliang114 Sep 28, 2026
965900a
fix(core): redact error_excerpt on the span export path
yiliang114 Sep 30, 2026
cd82572
fix(core): settle steer carrier as accepted on loop-detection halt
yiliang114 Sep 30, 2026
247b056
chore(core): merge origin/main into fix/issue-10887-tool-error-loop
qwen-code-dev-bot Oct 1, 2026
c75b338
test(core): drive the tool-error loop turns through the compressed `r…
yiliang114 Oct 1, 2026
3e4cf59
test(core): pin the remaining tool-error-guard witnesses (R3-2/3/4/6/7)
yiliang114 Oct 1, 2026
8745d41
test(core): use the numeric SIGTERM signal in the digest witness
yiliang114 Oct 1, 2026
56bd035
fix(core): bound MCP error normalization to the producer separator an…
yiliang114 Oct 2, 2026
3fb6a1f
Merge branch 'main' into fix/issue-10887-tool-error-loop
yiliang114 Oct 2, 2026
72f3d0a
fix(core): record halting round tool results in agent chat history
yiliang114 Oct 3, 2026
cfee088
fix(core): keep denials and unrelated probes out of the tool-error st…
yiliang114 Oct 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/cli/src/nonInteractiveCli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ const LOOP_TYPE_LABELS: Record<LoopType, string> = {
'the model repeatedly sent invalid tool parameters without correcting them',
[LoopType.REPEATED_TOOL_EXECUTION_FAILURE]:
'the same tool execution failure continued after a corrective reminder',
[LoopType.REPEATED_TOOL_ERROR]:
'the model kept receiving the same tool error without making progress',
};

function formatLoopDetectedMessage(loopType: LoopType | undefined): string {
Expand All @@ -208,7 +210,8 @@ function formatLoopDetectedMessage(loopType: LoopType | undefined): string {
loopType === LoopType.SHELL_COMMAND_STAGNATION ||
loopType === LoopType.GLOBAL_TOOL_CALL_DUPLICATE ||
loopType === LoopType.INVALID_TOOL_PARAMS_STAGNATION ||
loopType === LoopType.REPEATED_TOOL_EXECUTION_FAILURE;
loopType === LoopType.REPEATED_TOOL_EXECUTION_FAILURE ||
loopType === LoopType.REPEATED_TOOL_ERROR;
Comment thread
yiliang114 marked this conversation as resolved.
Resolved
const hint =
loopType === LoopType.TURN_TOOL_CALL_CAP
? ' A per-turn tool-call cap was reached. The default is adaptive (allows up to 1000 diverse calls, halting only on repeated calls); an explicitly set `model.maxToolCallsPerTurn` is a hard cap. If the model was repeating the same call, investigate the repetition; otherwise unset the value to use the adaptive default, or raise it (set 0 to disable).'
Expand Down
13 changes: 13 additions & 0 deletions packages/core/src/agents/runtime/agent-core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1241,6 +1241,19 @@ export class AgentCore {
break;
}
}
if (terminateMode !== AgentTerminateMode.LOOP_DETECTED) {
// Error-repetition guard (issue #10887): one batch-level
// recording per round — the sibling calls of this round are ONE
// round of evidence, not sequential retries, so a single
// denied/cancelled batch cannot trip the guard before the model
// has seen any of the errors.
const roundResultParts = toolCallResult.results.flatMap(
Comment thread
yiliang114 marked this conversation as resolved.
Resolved
(toolResult) => toolResult.responseParts,
);
if (loopDetector.recordToolErrorBatch(roundResultParts)) {
Comment thread
yiliang114 marked this conversation as resolved.
Resolved
Comment thread
yiliang114 marked this conversation as resolved.
Resolved
Comment thread
yiliang114 marked this conversation as resolved.
Resolved
Comment thread
yiliang114 marked this conversation as resolved.
Resolved
terminateMode = AgentTerminateMode.LOOP_DETECTED;
}
}
if (terminateMode === AgentTerminateMode.LOOP_DETECTED) {
break;
}
Expand Down
43 changes: 29 additions & 14 deletions packages/core/src/core/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3863,6 +3863,8 @@ export class LlmClient {
// loop (issue #9450). A detection here (the result-aware global
// duplicate count) halts the turn exactly like the event-loop
// guards below.
let loopHalt = false;
const toolResultParts: Part[] = [];
for (const part of requestToSend) {
if (
typeof part !== 'object' ||
Expand All @@ -3873,27 +3875,40 @@ export class LlmClient {
}
const functionResponseId = (part as Part).functionResponse?.id;
if (!functionResponseId) continue;
toolResultParts.push(part as Part);
if (
this.loopDetector.recordToolResultByCallId(functionResponseId, [
part as Part,
])
) {
for (const goalEvent of await finalizeInterruptedGoalTurn()) {
yield goalEvent;
}
const loopType = this.loopDetector.getLastLoopType();
yield {
type: LlmEventType.LoopDetected,
...(loopType && { value: { loopType } }),
};
await arenaAgentClient?.reportError('Loop detected');
this.lastApiCompletionTimestamp = Date.now();
endCurrentInteraction('error', 'loop detected', 'loop_detected');
this.cancelPendingMemoryPrefetch('no_safe_delivery_point');
this.fireLoopDetectedStopFailure(loopType);
return turn;
loopHalt = true;
break;
}
}
// Error-repetition guard (issue #10887): one batch-level recording
// per ToolResult message, so the sibling calls of this round count
// as ONE round of evidence, not as sequential retries — a single
// denied/cancelled batch must not trip the guard before the model
// has seen any of the errors.
if (!loopHalt) {
loopHalt = this.loopDetector.recordToolErrorBatch(toolResultParts);
Comment thread
yiliang114 marked this conversation as resolved.
Resolved
Comment thread
yiliang114 marked this conversation as resolved.
Resolved
Comment thread
yiliang114 marked this conversation as resolved.
Resolved
}
Comment thread
yiliang114 marked this conversation as resolved.
Resolved
if (loopHalt) {
for (const goalEvent of await finalizeInterruptedGoalTurn()) {
yield goalEvent;
}
const loopType = this.loopDetector.getLastLoopType();
yield {
type: LlmEventType.LoopDetected,
...(loopType && { value: { loopType } }),
};
await arenaAgentClient?.reportError('Loop detected');
this.lastApiCompletionTimestamp = Date.now();
endCurrentInteraction('error', 'loop detected', 'loop_detected');
this.cancelPendingMemoryPrefetch('no_safe_delivery_point');
this.fireLoopDetectedStopFailure(loopType);
return turn;
}
const toolResultMemory =
await this.consumeManagedAutoMemoryRecall('tool_result');
if (toolResultMemory?.prompt) {
Expand Down
Loading
Loading