Repository navigation
fix(agents): surface bucketed tool-loop warnings - #135103
Conversation
Carry typed admission warnings into admitted tool results after raw outcome recording, including single-call wrappers. Keep warning buckets on canonical diagnostic sessions and leave critical recovery unchanged. Preserve private result state and empty display-content normalization. Cover thresholds, outcome hashes, model context, and both batch modes.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed September 1, 2026, 6:29 AM ET / 10:29 UTC. ClawSweeper reviewWhat this changesThe PR makes existing bucketed tool-loop warnings visible to the model by appending a system note to the affected tool result after its raw outcome is recorded. Merge readinessKeep this maintainer-authored PR open for normal merge review: current main logs bucketed loop warnings but does not return them to tool results, and the patch carries the existing warning through the embedded agent result lifecycle without changing critical-loop recovery. Priority: P2 Review scores
Verification
How this fits togetherTool-loop admission evaluates an agent’s recent tool-call history before execution. Its result controls whether tools run and what the next model turn receives. flowchart LR
A[Model tool calls] --> B[Loop admission]
B --> C{Warning or critical loop}
C -->|warning| D[Run and record raw tool outcome]
D --> E[Append model warning]
E --> F[Next model turn]
C -->|critical| G[Block batch and recovery turn]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +60, Tests +157, Docs +4. Total +221 across 12 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the typed warning handoff and single post-record result decorator, then merge once exact-head CI confirms the covered agent paths. Do we have a high-confidence way to reproduce the issue? Yes: on current main, reach a warning threshold and inspect the admitted tool result or next model context; the admission code logs the warning but returns no result feedback. Is this the best way to solve the issue? Yes: the patch reuses existing detection and critical recovery, adds feedback at the result boundary, and preserves raw outcome hashing before decoration. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 90dba1a51877. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
Carry typed admission warnings into admitted tool results after raw outcome recording, including single-call wrappers. Keep warning buckets on canonical diagnostic sessions and leave critical recovery unchanged. Preserve private result state and empty display-content normalization. Cover thresholds, outcome hashes, model context, and both batch modes.
What Problem This Solves
Tool-loop warnings appeared in diagnostics but not in tool results, leaving the model without loop feedback until a critical block.
Why This Change Was Made
Return the existing bucketed warning as typed admission feedback and append a short system note after raw outcome recording. This gives the model a chance to change approach without changing outcome hashing or no-progress escalation. Keep warning buckets on the canonical session instead of losing lazy initialization on a projected history copy.
Discovery source: NetEase Youdao's LobsterAI patch stack (github.com/netease-youdao/LobsterAI). Only the model-visible warning and record-before-decoration idea is adopted; existing critical recovery remains intact.
User Impact
With rolling tool-loop detection enabled, affected OpenClaw tool results carry a short warning at the diagnostic bucket boundary. Normal and unrelated sibling results remain unchanged. No new config; critical blocking, one-shot recovery, and termination stay unchanged. Documentation explains the warning and hashing behavior.
Evidence
327 targeted tests passed across agent-core, admission/detection, embedded-runner wiring, and the wrapper E2E suite in supported focused source-fixture mode. The four admission/agent-core regressions were observed failing against the base for missing warning feedback; wrapper pre-fix failure is verified from the unchanged raw-result return in the base diff, with its full candidate suite green. The critical renderer/batch-completion function is byte-identical to base. Autoreview is scoped-clean at P0.
pnpm check:changedpassed with exit code 0.Production delta: +60 lines; tests: +157; docs: +4. Growth implements typed transport and one shared result decorator without new detection/state paths. Full product-build, live-provider, and native-tool feedback proof are not claimed; native/CLI-only outcomes remain outside this result-decoration change.
Final Git verification
git commit -F .loop-warnings-commit.logpassed; the pre-commit formatter completed successfully.git diff --exit-code HEADreturned 0, so the committed tree exactly matches the final verified candidate.git status -sb:git check-ignore WORKER_RESULT.mdprints the report filename, andgit ls-files WORKER_RESULT.mdis empty. The report remains untracked through Git's info exclude, not.gitignore. No push, pull, PR, changelog, lockfile, baseline, or inventory changes.