feat(agents): rapid-succession storm detector + callTrace to prevent nested-agent tool storms#56
Merged
Conversation
…events - Add `rapid_succession` LoopDetectorKind that fires when the same tool is called N consecutive times (any args), catching nested-agent tool storms before outcome data is available - Add `RAPID_SUCCESSION_THRESHOLD` (default 15) and `CALL_TRACE_SIZE` (10) constants with export - Add `buildCallTrace()` helper that builds a compact tool-name trace from session history for debugging - Add `callTrace?: string[]` to `LoopDetectionResult`, `DiagnosticToolLoopEvent`, and `logToolLoopAction` params — all existing detectors now emit traces - Add `rapidSuccession?: boolean` detector toggle and `rapidSuccessionThreshold?` to `ToolLoopDetectionConfig` / `ToolLoopDetectionDetectorConfig` - Update Zod schema, config labels, and help text for new fields - Pass `callTrace` through `pi-tools.before-tool-call.ts` to the diagnostic event - Add unit tests for rapid_succession detector, buildCallTrace, and callTrace presence in all detector results - Add integration tests in pi-tools.before-tool-call.test.ts Agent-Logs-Url: https://github.com/Piboonsak/openclaw_github/sessions/1ef9598b-f74a-4354-be83-070ea797fa7d Co-authored-by: Piboonsak <[email protected]>
Copilot
AI
changed the title
[WIP] Add loop detection and circuit breaker for agent tool storms
feat(agents): rapid-succession storm detector + callTrace to prevent nested-agent tool storms
Apr 5, 2026
Piboonsak
marked this pull request as ready for review
April 5, 2026 13:52
This was referenced Apr 6, 2026
This was referenced Apr 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #52