Repository navigation
fix: retry whenever a DSML residual leaks into content - #836
Open
songji-tian wants to merge 1 commit into
Open
songji-tian wants to merge 1 commit into
songji-tian wants to merge 1 commit into
Conversation
The server-side DSML->tool_calls parser sometimes leaves an untranslated tail in `content` and returns no `tool_calls`, e.g. `</|DSML| invoke>`, `</||DSML|| parameter>` or a leaked `</code_run>`. The turn then ends as a plain text reply and the agent silently stalls - no tool runs, no error. The existing guard only matches `</|DSML| calls>`, a form real leaks almost never end with (0/14 in sampled transcripts). Match any trailing closed tag while still requiring the DSML marker in the last 200 chars: 14/14 caught, 0 false positives across 1960 historical responses. Retry recovers the turn (19/19 leaked turns returned proper tool_calls next try). Co-Authored-By: GenericAgent <bot@gaagent.ai>
Contributor
|
Related: I ran into the same leak and opened #837 with a fix in #838 - it attacks the marker matching itself (variant-agnostic regex + a stateful filter that re-joins markers split across stream chunks) instead of only checking the content tail, so a leak anywhere in the turn and closing tags such as |
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.
Problem
When the server-side DSML ->
tool_callsparser fails to convert the whole tool call, it can leave an untranslated tail inmessage.contentand return notool_calls. The turn then ends as a plain text reply: no tool runs, no error is raised, and the agent silently stalls.The current guard only matches one exact form:
Real leaks (14 stalled rolls out of 18 sampled agent transcripts, DeepSeek official endpoint) end with other forms, so the guard never fires:
</|DSML| calls></||DSML|| parameter></|DSML| parameter></|DSML| invoke>Measured on those 14 rolls: current check 0/14, this patch 14/14.
Change (1 line, net zero)
The
'DSML' in content[-200:]guard keeps it conservative: the leak marker must still be present in the tail, so a normal answer that happens to end with</code_run>is not retried.Verification
tool_callson the next attempt.Related: #804 (same leak, closed as an upstream serving-side issue).
Co-Authored-By: GenericAgent bot@gaagent.ai