fix(agent): ignore quoted scratchpad tags in retry detection - #11743
Open
sgaofen wants to merge 1 commit into
Open
fix(agent): ignore quoted scratchpad tags in retry detection#11743sgaofen wants to merge 1 commit into
sgaofen wants to merge 1 commit into
Conversation
Contributor
|
LGTM. Switching from presence to count-based comparison and stripping markdown context before checking is the right approach. Tests cover the key false-positive vectors (fenced, inline, blockquote) and the "real tag after quote" case pins the true-positive path. One minor edge case to be aware of (not blocking): is handled correctly since each |
This was referenced Apr 24, 2026
Closed
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
has_incomplete_scratchpad()from treating quoted or code-form scratchpad tag mentions as an unfinished reasoning block<REASONING_SCRATCHPAD>tagsRoot Cause
The retry guard in
agent/trajectory.pyused a plain substring check for<REASONING_SCRATCHPAD>without understanding markdown context. That meant grep output, quoted user text, or inline code containing the tag could trigger the incomplete-scratchpad path, causing wasted retries and dropped output.Closes #11663.
Validation
python3 -m py_compile agent/trajectory.py tests/agent/test_trajectory.pyuv run --extra dev pytest -o addopts='' tests/agent/test_trajectory.py -qPlatform Tested
Contribution Guide Notes
CONTRIBUTING.mdand checked for existing open PRs before submitting this scoped change.pytest tests/ -qpass unless explicitly noted.