Repository navigation
[PR] fix: preserve image recovery for escaped JSON markers - #6701
Merged
ranxianglei merged 1 commit intoNov 14, 2026
Merged
Conversation
This was referenced Nov 15, 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.
Problem
The raw-body image precheck only recognizes literal spellings of its JSON markers. A valid request can encode ASCII string characters with Unicode escapes; after JSON parsing it contains the same image, but the precheck returns false. The server consequently skips both the initial image index and its post-prepare refresh, leaving no archived pixels available for image recovery.
This affects OpenAI and Responses data URLs, Anthropic base64 sources, and Google
inlineData. A real HTTP regression sends the same PNG through the public proxy with literal and escaped markers: the literal request has an image index, while the escaped request has an empty one on unchanged base.Change
Compile the small marker patterns once, accepting each marker character as literal text or its JSON Unicode escape. Preserve case-insensitive data-URL tokens and case-sensitive JSON field names. The precheck still scans the raw body directly; it neither parses a second copy nor decodes/copies the full request. This implements the string spelling equivalence in RFC 8259 section 7.
Verification
9495c764d36909eec263f404d4802d68b608f23f, the new suite has 7 failing regressions and 8 passing controls. After the fix, 34/34 related tests pass: all 15 new tests, the 15 existing image-recovery tests, and the four existing [性能回归] 0.1.193 长会话本地耗时从 1.3s 升至 3.2s:无用 SimHash 计算与重复历史转换 #2824 guard/index parity tests.npm run typecheck,npm run build, andgit diff --checkpass. Full repository tests were not run locally; hosted CI remains pending.Prior work checked
The complete Afloat16 production-patch index has only #6089 (incomplete image spill repair) and #6147 (Gemini tool-response image parity) touching this file; neither changes the raw-body guard. The original #2828 guard and the actual head of related #5901 retain the literal-only patterns. #6646 has no file patch. All-state escaped-image/index searches found no matching fix.
Closes #6700