Repository navigation
fix(agents): stop repeated equivalent terminal exec failures - #118071
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed August 2, 2026, 1:08 PM ET / 17:08 UTC. ClawSweeper reviewWhat this changesThe PR records meaningful nonzero terminal Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 3 items remain Keep this protected maintainer PR open for normal review. The patch cleanly extends the existing per-run no-progress owner to block a contiguous tail of equivalent non-timeout terminal Priority: P1 Review scores
Verification
How this fits togetherBefore each agent tool call, OpenClaw reads the current run’s compact tool history and decides whether the next invocation is safe. Completed tool results feed canonical outcome hashes back into that history, which lets the loop detector stop a session that is repeatedly failing without progress. flowchart LR
A[Agent proposes exec command] --> B[Before-tool-call loop check]
B --> C[Current-run tool history]
C --> D[Terminal failure classifier]
D --> E[Equivalent outcome streak]
E --> F[Critical loop veto]
F --> G[Agent changes course or session stops]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +40, Tests +301. Total +341 across 5 files. View PR surface stats
Review metricsNone. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain this shared, output-hash-based detector repair and add redacted after-fix proof showing a live or terminal-driven agent session blocks the repeated failure at the threshold while a meaningful changed result lets the run continue. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: current main records exact argument hashes, so changing exec arguments prevent the existing generic no-progress streak from reaching the critical threshold; the PR’s focused tests exercise the repaired path and its reset boundaries. Is this the best way to solve the issue? Yes: extending the existing per-run outcome-history detector is a narrower and more maintainable fix than parsing shell commands or resource paths, and it preserves the current thresholds, veto accounting, and run isolation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 19aad4ac2a40. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
…w#118071) Co-authored-by: Peter Steinberger <[email protected]>
Fixes #117637
What Problem This Solves
Forty argument-varying
execcalls can repeat the same terminal failure without ever tripping loop detection because every command has a different argument hash. The agent continues consuming model calls, blocks its session, and repeats a meaningful failure indefinitely.What Changed
execresults with a finite, nonzero exit code and the same meaningful output.Verification
66eb1cbdb7b46fc901a16298a24db2a7c6bbc859.Live terminal proof (current head)
The actual terminal invocation
node <<'NODE'loaded the committed productionsrc/agents/agent-tools.before-tool-call.wrapper.ts,src/agents/tool-loop-detection.ts, andsrc/logging/diagnostic-session-state.ts. It executedwrapToolWithBeforeToolCallHookagainst synthetic exit-7 fixtures; the following are the actual redacted output lines:{"scenario":"identical-meaningful-failure","attempt":20,"status":"completed","exitCode":7,"stderr":"fixture stderr: FIXTURE_FAILURE_A"} {"scenario":"identical-meaningful-failure","attempt":21,"status":"blocked","deniedReason":"tool-loop","detector":"generic_repeat"} {"scenario":"identical-meaningful-failure","attempt":31,"status":"blocked","deniedReason":"tool-loop","detector":"global_circuit_breaker"} {"scenario":"changed-output-reset","attempt":19,"status":"completed","exitCode":7,"stderr":"fixture stderr: FIXTURE_FAILURE_A"} {"scenario":"changed-output-reset","attempt":20,"status":"completed","exitCode":7,"stderr":"fixture stderr: FIXTURE_FAILURE_B"} {"scenario":"changed-output-reset","attempt":21,"status":"completed","exitCode":7,"stderr":"fixture stderr: FIXTURE_FAILURE_A"}Actual terminal verdict:
{"pr":118071,"head":"66eb1cbdb7b46fc901a16298a24db2a7c6bbc859","productionWrapper":"wrapToolWithBeforeToolCallHook","criticalThreshold":20,"firstBlockedAttempt":21,"globalCircuitBreakerThreshold":30,"globalBlockedAttempt":31,"sameMeaningfulNonzeroFailureBlocked":true,"nonzeroExitCode":7,"typedVeto":"tool-loop","typedVetoHistoryEntries":11,"blockedCallsNeverExecuted":true,"changedFailureOutputReset":true,"subsequentCallPermitted":true,"nextDetectorDecision":{"stuck":false},"resetScenarioActualExecutions":22,"redacted":true}