Repository navigation
[PR] fix: locate root message arrays in cache-diff attribution - #6691
Merged
ranxianglei merged 1 commit intoNov 14, 2026
Merged
Conversation
This was referenced Nov 14, 2026
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
bili acp-cache diffcan hide a real proxy rewrite when a tool schema before the root history includes a same-named example array. The oldmsgArrayInforegex searches every JSON nesting level and selects an array with a matching length. Its spans can describe a tool default while its items describe the actual conversation. A changed conversation message then appears to be a harmless trailing-field change.Change
Locate
messages,input, orcontentsonly at the root object. Scan past quoted strings without treating their braces or brackets as JSON structure, decode escaped property names, and use the last matching root property consistently withJSON.parse. Keep the existing message-key priority and element-span comparison.This concerns root-array identity, independently of #6496's UTF-8 byte-to-text coordinate fix. The new rewrite fixtures are ASCII and reproduce without that coordinate issue. No kernel, wire transformation, or configuration surface changes are included.
Verification
compareWires/runDiffregressions: 12 fail on unchanged base9495c764d36909eec263f404d4802d68b608f23f, one control passes. Coverage includes nested schema defaults for all three message keys, correct root append classification, pre-array changes, escaped keys and delimiters in strings, duplicate root keys, and exact report attribution from real dump files.acp-cache-diff.test.ts, andissue3476-mid-insertion-append.test.ts. Existing mid-insertion append/rewrite controls retain their behavior.npm run typecheck,npm run build, andgit diff --checkpass.dist/index.js acp-cache diff <isolated fixture> --no-log --jsoncommand returnsmid-stream-rewrite,attribution: proxy, message index 0, and roleuserfor the original false-append scenario. CLI data/config/cache/state roots were isolated with the repository's test preload.Historical deduplication checked the complete Afloat16 changed-file/patch index and relevant upstream patches: #1269 introduces the length-based heuristic; #3479 adds the distinct mid-insertion fallback; #5487 changes retained-log reading; #1618 does not change this file. No earlier root-property locator fix was found.
Closes #6690.