Skip to content

[PR] fix: locate root message arrays in cache-diff attribution - #6691

Merged
ranxianglei merged 1 commit into
ranxianglei:masterfrom
Afloat16:2026-11-14_cache-diff-root-array
Nov 14, 2026
Merged

ranxianglei merged 1 commit into
ranxianglei:masterfrom
Afloat16:2026-11-14_cache-diff-root-array

Conversation

@Afloat16

Copy link
Copy Markdown
Contributor

Problem

bili acp-cache diff can hide a real proxy rewrite when a tool schema before the root history includes a same-named example array. The old msgArrayInfo regex 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, or contents only 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 with JSON.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

  • Thirteen new public compareWires/runDiff regressions: 12 fail on unchanged base 9495c764d36909eec263f404d4802d68b608f23f, 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.
  • 38/38 targeted tests pass across the new suite, acp-cache-diff.test.ts, and issue3476-mid-insertion-append.test.ts. Existing mid-insertion append/rewrite controls retain their behavior.
  • npm run typecheck, npm run build, and git diff --check pass.
  • The freshly built dist/index.js acp-cache diff <isolated fixture> --no-log --json command returns mid-stream-rewrite, attribution: proxy, message index 0, and role user for the original false-append scenario. CLI data/config/cache/state roots were isolated with the repository's test preload.
  • The full repository test verdict remains with hosted CI; it was not claimed from a local full-suite run.

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.

@ranxianglei ranxianglei changed the title fix: locate root message arrays in cache-diff attribution [PR] fix: locate root message arrays in cache-diff attribution Nov 14, 2026
@ranxianglei
ranxianglei merged commit cb1edd0 into ranxianglei:master Nov 14, 2026
48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cache-diff can mistake nested schema examples for the root conversation array

2 participants