Conversation
Editing an earlier message fails with canonical_args_hash_conflict whenever the model paged a truncated tool result. The ledger clone rewrites a copied Read/ArchiveRead call's args to name the copied tool result, but the paired tool_dispatch event was copied verbatim and kept the hash of the source's args — so the copy failed its own T1 re-scan and every revision retry was refused as a corrupt ledger. Record the rewritten args per (invocation, tool call) during the identity-rewrite pass and re-authenticate the paired dispatch's canonicalArgsHash, so the copied ledger authenticates the args it actually carries. Dispatches without a recorded hash keep their shape. The new regression test clones a ledger whose Read points at a copied tool result and whose dispatch authenticated the source args: it fails with the issue's exact canonical_args_hash_conflict before the fix and passes after, with the dispatch hash equal to the rewritten args. Fixes apache#5329 Generated-by: GLM-5.3-Flash (ZCode)
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
Fixes #5329
Editing an earlier message fails with
canonical_args_hash_conflictwhenever the model paged a truncated tool result: the ledger clone rewrites a copiedRead/ArchiveReadcall's args to name the copied tool result, but the pairedtool_dispatchevent was copied verbatim and kept the hash of the source's args. The copy then fails its own T1 re-scan (importConversationCopyRuntimeEvents→scanToolLedger), and every revision retry is refused as a corrupt ledger — while the source Session's ledger is, in fact, fine.The fix lives where the rewrite happens: during the identity-rewrite pass, the clone records the rewritten args per (invocation, tool call) and re-authenticates the paired dispatch's
canonicalArgsHash, so the copied ledger authenticates the args it actually carries. Dispatches without a recorded hash keep their shape. The existing copy tests never caught this because theirReadcalls had no pairedtool_dispatchevent, leaving the scanner nothing to compare.Verification
Readis paired with a dispatch that authenticated the source args)canonical_args_hash_conflictbefore the fix; passes after, with the dispatch hash equal to the rewritten argsconversation-copysuiteupstream/mainin this environment (Windows sqlite-cleanup EBUSY in test cleanup, one per failing test) — CI is expected to run them cleanbiome checkon both touched filesAI use
Implemented with GLM-5.3-Flash (ZCode); the reproduction, fix, and tests were verified locally as described above.
Checklist
@maka/core/tool-args-identity