fix(renderer-client): normalize empty content like token client#1290
Merged
willccbb merged 1 commit intofeat/renderer-inference-v1-generatefrom May 5, 2026
Conversation
…x match Mirrors the coercion already in OpenAIChatCompletionsTokenClient: tool-call-only assistant messages can be serialized with content=None or content="" depending on the upstream pipeline (reasoning parsers strip to "" while other paths leave it None), and incremental-prompt prefix matching must not split on that. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
OpenAIChatCompletionsTokenClient.normalize_for_comparison: tool-call-only assistant messages can be serialized withcontent=Noneorcontent=""depending on the upstream pipeline (reasoning parsers strip text to"", other paths leaveNone), and incremental-prompt prefix matching must treat them as equivalent or it spuriously falls back to MITO.renderer_client._normalize_for_comparisonalready dropsNonevalues from mappings, so acontent=Nonemessage normalizes to "nocontentkey" whilecontent=""would stay as"content": "". We extend the same filter to also dropcontent == "", unifying the two shapes.Test plan
content=Noneand the next prompt presents the same step withcontent=""(e.g. via a reasoning parser): bridge succeeds instead of falling back.🤖 Generated with Claude Code
Note
Low Risk
Low risk: a small normalization tweak that only affects incremental prompt prefix-matching by treating
content:""like missing/None, reducing spurious bridge failures without changing generation behavior.Overview
Improves incremental prompt prefix-matching in
renderer_client._normalize_for_comparisonby dropping mapping keys wherecontent == "", making tool-call-only assistant messages serialized ascontent=Nonevscontent=""compare equal.This prevents format-only drift in upstream pipelines from forcing a full re-render/fallback when stitching multi-turn prompts.
Reviewed by Cursor Bugbot for commit 2aaac1a. Bugbot is set up for automated code reviews on this repo. Configure here.