fix(agent): detect same-result tool loops even when args vary - #60285
Closed
isheng-eqi wants to merge 4 commits into
Closed
fix(agent): detect same-result tool loops even when args vary#60285isheng-eqi wants to merge 4 commits into
isheng-eqi wants to merge 4 commits into
Conversation
Collaborator
Duplicate of #60087 — both add a content-hash result-repetition guardrail keyed on |
isheng-eqi
force-pushed
the
fix/tool-guardrails-same-result-detection
branch
from
July 7, 2026 15:29
9f01a12 to
10c9322
Compare
Contributor
Author
Contributor
Author
|
Closing as planned — duplicate of #60087 which already provides the same fix. |
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.
What does this PR do?
The tool-loop guardrails only track
_no_progressby signature(tool_name, canonical_args)and only for tools inidempotent_tools. This means loops where args vary but the result never changes slip through --execute_codegenerating different code that all returns the same output, orvision_loadreading the same image with different prompts. The session burns through its iteration budget with no guard activity.Related Issue
Fixes #60084
Type of Change
Changes Made
agent/tool_guardrails.py: Add_same_resulttracking keyed on(tool_name, result_hash)that applies to ALL tools. Warns when the same result is returnedno_progress_warn_aftertimes regardless of varying args. Existing signature-based_no_progresstracking is preserved for idempotent tools (exact-arg-repeat blocking).tests/agent/test_tool_guardrails_same_result.py: 6 tests covering varying-args same-result, different results reset, hard stop integration, reset_for_turnHow to Test
execute_coderuns different code that all returns"done"