Repository navigation
feat: add stuck loop detection and exponential backoff infrastructure for agent polling - #17118
Merged
gumadeiras merged 8 commits intoFeb 16, 2026
Conversation
Contributor
Author
|
Hi @gumadeiras @cpojer @steipete, Would appreciate a review when you get a chance. This addresses the review feedback on the agent loop detection PR by fixing nested object hashing in hashToolCall and improving error visibility in diagnostic heartbeat imports. The changes eliminate potential false positives if tool params become nested and avoid silently swallowing dynamic import failures, without altering the loop detection thresholds or behavior. Thanks! |
thewilloftheshadow
force-pushed
the
main
branch
from
February 15, 2026 18:46
bfc1ccb to
f92900f
Compare
gumadeiras
force-pushed
the
fix/agent-loop-detection-and-backoff
branch
from
February 16, 2026 19:49
7e57733 to
5c1131e
Compare
gumadeiras
force-pushed
the
fix/agent-loop-detection-and-backoff
branch
3 times, most recently
from
February 16, 2026 19:59
e3fe4e9 to
6ad4706
Compare
… for agent polling
gumadeiras
force-pushed
the
fix/agent-loop-detection-and-backoff
branch
from
February 16, 2026 20:16
6ad4706 to
eebabf6
Compare
Member
|
Merged via squash. Thanks @akramcodez! |
lovewanwan
pushed a commit
to lovewanwan/openclaw
that referenced
this pull request
Apr 28, 2026
… for agent polling (openclaw#17118) Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: eebabf6 Co-authored-by: akramcodez <[email protected]> Co-authored-by: gumadeiras <[email protected]> Reviewed-by: @gumadeiras
ogt-redknie
pushed a commit
to ogt-redknie/OPENX
that referenced
this pull request
May 2, 2026
… for agent polling (openclaw#17118) Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: eebabf6 Co-authored-by: akramcodez <[email protected]> Co-authored-by: gumadeiras <[email protected]> Reviewed-by: @gumadeiras
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
May 9, 2026
… for agent polling (openclaw#17118) Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: eebabf6 Co-authored-by: akramcodez <[email protected]> Co-authored-by: gumadeiras <[email protected]> Reviewed-by: @gumadeiras
This was referenced May 12, 2026
This was referenced Jun 15, 2026
Closed
Closed
This was referenced Jul 13, 2026
Closed
lhfer
pushed a commit
to lhfer/openclaw
that referenced
this pull request
Oct 11, 2026
… for agent polling (openclaw#17118) Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: eebabf6 Co-authored-by: akramcodez <[email protected]> Co-authored-by: gumadeiras <[email protected]> Reviewed-by: @gumadeiras
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.
Summary
Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
Visible changes:
No config changes required - features are active by default and backward compatible.
Security Impact (required)
YesRepro + Verification
Environment
Steps
Before (reproduce stuck loop):
sleep 300)command_statusevery 4-5 secondsAfter (with fix):
Expected
Actual
[x] All expected behavior confirmed via 30 unit tests
Evidence
Test Results:
✓ src/agents/tool-loop-detection.test.ts (16 tests) - All passing
✓ src/agents/command-poll-backoff.test.ts (14 tests) - All passing
✓ src/logging/diagnostic.test.ts (2 tests) - No regressions
TypeScript compilation: No errors
Linter: 0 warnings, 0 errors
Human Verification (required)
Verified scenarios:
Edge cases checked:
What I did NOT verify:
Compatibility / Migration
YesFailure Recovery (if this breaks)
How to disable quickly:
git revert 0c28bbd8dFiles to restore:
Known bad symptoms to watch for:
Risks and Mitigations
Risk: Legitimate workflows with 20+ identical calls could be blocked
Risk: Memory overhead from tracking 30 tool calls per session
Risk: Backoff infrastructure unused if integration not completed
Greptile Summary
Adds stuck loop detection and exponential backoff infrastructure for agent polling. The loop detection is integrated into
runBeforeToolCallHook, tracking tool calls in a sliding window of 30 entries and blocking execution after 20 identical calls. A separate (currently unused) backoff module provides delay calculations for command polling. The heartbeat timer is extended to prune stale poll records.pi-tools.before-tool-call.tscorrectly gates onsessionKey, detects before recording, and blocks at critical threshold while allowing warnings to pass throughhashToolCallhas a latent bug: usesJSON.stringifywith a top-level-only key array as replacer, which silently drops nested object keys — currently safe because tool schemas are flat, but would produce false positives if nested params are introducedcommand-poll-backoff.ts) is well-structured infrastructure but entirely unused at runtime — integration is deferred to a follow-up PR.catch(() => {})for the dynamic import could hide module loading failuresConfidence Score: 4/5
src/agents/tool-loop-detection.ts— thehashToolCallfunction's use ofJSON.stringifyreplacer array silently drops nested object keysLast reviewed commit: 0c28bbd