fix(reflect): reject serialized parameter tails in done answers - #3074
Closed
Alan5168 wants to merge 2 commits into
Closed
fix(reflect): reject serialized parameter tails in done answers#3074Alan5168 wants to merge 2 commits into
Alan5168 wants to merge 2 commits into
Conversation
Collaborator
|
seems like a model issue, let's not open the pandora's box |
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
Reject a parsed
donetool call when itsanswercontains a serialized sibling parameter tail such as</answer><parameter name="memory_ids">....Some provider responses can return a valid tool call while blending XML tool serialization into the JSON
answervalue. Because a tool call exists, the no-tool-call guard added in #3013 does not run, and the corrupted tail gets persisted verbatim intomental_models.content.This validates the exact
answer/sibling-parameter boundary against the declareddone()fields and raisesReflectToolCallError(matching the existing fail-loud contract). It does not truncate or silently clean the answer, and it does not touch #3013's no-tool-call guard.Tests
test_done_tool_rejects_serialized_parameter_tail, a regression test that is red on currentmainand green with the fix (verified locally by reverting just the production fix and re-running).40 passedacross the related pure unit tests intest_reflect_agent.py(excluding RealLLM/Integration/DirectiveLeakageOnEmptyBank, which need external providers/deps not available here).ruff checkandruff format --checkpass for all changed Python files.Closes #3048