Repository navigation
Description
What happened
"Revise before turn" (editing an earlier message) fails with the toast "Action failed — The task action failed. Try again later." Retrying does not help. The main-process log shows:
Error occurred in handler for 'sessions:reviseBeforeTurn': RuntimeHostOperationError:
Session conversation copy could not be committed:
Conversation copy RuntimeEvent ledger is corrupt: canonical_args_hash_conflict
at SqliteRuntimeStore.importConversationCopyRuntimeEvents (@maka/storage/dist/sqlite-runtime-store.js:250)
at cloneConversationRuntimeLedger (@maka/runtime/dist/conversation-copy.js:471)
at #copyAdmitted (@maka/runtime-host/dist/server/session-revision-coordinator.js:395)
The source Session's ledger is not corrupt: running scanToolLedger over its stored runtime_events reports zero issues, and every tool_dispatch.canonicalArgsHash matches its function_call.args.
Root cause
cloneConversationRuntimeLedger rewrites the arguments of a Read (and ArchiveRead) call when the path points at a tool result — maka://runtime/tool-results/<runtimeEventId> or its maka://read/<base64> continuation form — because the embedded RuntimeEvent id belongs to the source Session and must name the copied event instead. The paired tool_dispatch event, however, is copied verbatim and still carries the hash of the source bytes. importConversationCopyRuntimeEvents re-scans the copied ledger, recomputes the hash from the rewritten args, and rejects the copy with canonical_args_hash_conflict.
The existing copy tests only had Read calls without a tool_dispatch event, so the scanner never had anything to compare.
How to reproduce
- In a Session, run a tool whose output is large enough to be truncated (e.g.
Bashprinting ~10 KB), so the result ends with anextcontinuation address. - Let the model follow it, i.e. call
Readwithpath: maka://read/…that decodes tomaka://runtime/tool-results/toolop_…_response. - Send at least one more turn.
- Edit / "revise" that later turn (anything after the paging
Read).
Expected: a new revision Session is created.
Actual: "Action failed" toast; canonical_args_hash_conflict in the log on every retry.
It looks intermittent only because all of the following must hold: the model paged a tool result, and the revised turn is after that call so the copy slice includes it. Sessions that only page files (maka://read/<base64 file path>) are unaffected — those args are rewritten to identical bytes.
Environment
- Maka: 0.2.0-dev.31.20260913 (nightly, packaged)
- OS: macOS darwin 25.6.0 (arm64)
- Surface: Desktop → Runtime Host
- Electron 43.4.1 / Node 24.18.1
Fix
After rewriting a Read/ArchiveRead call's args in cloneConversationRuntimeLedger, recompute canonicalArgsHash on the dispatch event paired with it (same invocationId + providerToolCallId, matching how scanToolLedger pairs them). Only do so when the source dispatch matched its source call, so a genuinely corrupt source ledger is still refused. tool_operations / tool_journal_events are rebuilt from events on import, so no separate table fix is needed.
Test: a copy fixture with Bash → Read of the Bash result, each with its tool_dispatch. Fails with the exact production error before the fix, passes after.
Activity
ggbdpq commentedon Sep 17, 2026
take
fix(runtime): re-authenticate a copied paging Read with its dispatch (a…