Repository navigation
fix(agents): allow bounded recovery after repeated identical tool errors - #186853
Conversation
OpenClaw-Publication: ca783cce-abe0-4ca7-9d28-0fe37ea4caa6
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR lets agents change plans after three identical tool failures while blocking unchanged retries and terminating another critical loop. Example: An agent fails three times while reading a directory, then chooses a file read.
Review scores
ProductKind: Preference · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this maintainer-authored PR open: it provides useful bounded recovery, no actionable defect was found, and the previous merge conflict is resolved. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe embedded agent loop receives model tool calls, applies tool policies and execution admission, and publishes ordered results to the model and session history. flowchart TD
A[Model tool calls] --> B[Batch admission]
B --> C[Argument preparation and policies]
C --> D[Final launch and quarantine check]
D --> E[Tool implementation]
E --> F[Ordered outcome observation]
F --> G[Recovery feedback or terminal result]
G --> A
Technical reviewBest possible solution: Retain recovery in the existing agent-loop owner with final-argument quarantine, one shared allowance per accepted input, and ordered settlement of started work. Do we have a high-confidence way to reproduce the issue? Current-main source shows immediate termination after three identical failures; this read-only review ran no target code or tests. Is this the best way to solve the issue? The patch coherently extends the existing recovery policy and launch boundary, with no unnecessary competing owner or unsupported restriction identified. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against fb6ec25c2c97. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +289, Tests +961, Docs +19, Other -1. Total +1268 across 24 files. Added test files: 2. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed October 28, 2026, 12:19 PM ET / 16:19 UTC (Revision 2). |
OpenClaw-Publication: 7f14d82c-9c2f-4ded-92bd-25248db94fad
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Why
The tool loop guard ended a run on the third identical tool failure (same tool, arguments and error), before the model could see the failure and change plan. Its stop message also blamed the model's tool calling.
What changed
turn_endresults keep source order; a batch suppressed at the stop skips only admission and lifecycle hooks.Scope
Native embedded tool-loop recovery and per-input accounting of the shared critical-loop allowance. Approvals, permissions, configuration, providers and deployment are unchanged, and nothing retries automatically.
Tradeoffs
main's unchanged test-line ceiling (6,303,410 of 6,310,000 lines). One stale mock-export baseline entry is removed; no new waiver.Blast Radius
Runs that hit a critical tool loop: repeated identical failures get one bounded recovery attempt instead of an immediate stop, and a further critical loop for the same input still ends the run.
Verification
On this branch merged with current
main(the only conflict was the test-line baseline, resolved tomain's value):Agentthrough the production bridge and tool wrapper and failed before the fix, plus 60 payload-error and approval-policy integration tests. The five edited test files (49 cases) are unchanged by the merge and were audited in full.Selected fields from the live run's asserted execution receipt
{ "realNativeReadSourceStarts": [3, 1], "orderedToolResults": ["error", "error", "error", "success"], "orderedActivityStatus": ["failed", "failed", "failed", "completed"], "nextModelContextContainsRecovery": true, "agentWaitStatus": "ok", "usefulAnswerVerified": true, "persistedMessages": 10, "persistedActivityItems": 8, "freshGatewayReloadEqual": true, "sessionDoneInactive": true }mainbase reproduces exactly; this change adds no diagnostics.Exact-head CI passed; the requested fresh-head review is pending.