Add idempotent mutation transaction identities - #486
Merged
Conversation
…ncomplete ids Review follow-up on the mutation transaction identity epic (#449). Retention was bounded by count only. A retained entry is a complete serialized MutationBatchResult, which emits every step's results twice plus patch.markdown and the semantic delta sets — a measured ~3.2 KB even for a one-step batch on a blank document — so 128 responses per session is not a memory bound. Adds a 32 MiB per-session byte budget alongside the count cap, evicting oldest-first until both hold. A response larger than the whole budget evicts itself rather than raising the ceiling; the identity stays bound and answers transaction_result_evicted. Byte accounting is decremented on every path a retained response leaves the record map. A reservation that never recorded a terminal response returned transaction_conflict quoting the RETRY's own fingerprint — the exact opposite of what happened — and could never be reclaimed. It now has its own decision kind and EditErrorCode.TransactionIncomplete ("outcome unknown"), the Dispatcher abandons any reservation it cannot complete, an abandoned reservation becomes an outcome-unknown tombstone, and uncompleted reservations are FIFO-bounded like completed ones. Also: - CHANGELOG [Unreleased] entry covering the new transactionId field, all four error codes, and the retention bound. - HttpTransport's doc comment said SessionStore assumes single-threaded access, which this epic made false. Corrected to state that per-session dispatch is forward-looking: Handle runs inline on the serial accept loop, so the lock is not what serializes requests, and making concurrency real means moving handling off the accept loop AND dropping the lock — a deliberate behaviour change, not a comment fix. Notes the same for the lifecycle gate around open. - ToolCatalog and the schema description interpolate MaxTransactionIdLength instead of repeating 256. - Document the retention cost, the validation-failure-burns-the-id rule, the tombstone-expiry re-apply hazard, and that idempotency is MCP-only. Tests: five new MCP449 facts (byte-budget eviction incl. the oversized-response boundary, measured real retained cost, incomplete-vs-conflict truthfulness and evictability, reservation FIFO bound, Dispatcher mapping), plus wire-string parity assertions on both client surfaces.
JSv4
marked this pull request as ready for review
August 15, 2026 04:34
Brings the branch up to date with main, which had advanced by 20 commits (PRs #479, #481, #477, #480, #482, #485 and #484). CHANGELOG.md was the only conflict: both sides appended to the same [Unreleased] / ### Added region. Resolved by keeping every entry from both sides, with this branch's idempotent mutation transaction entry ahead of main's accumulated entries. Main's block is otherwise unchanged, and the historic "[Unreleased] - .NET 8" heading further down the file is untouched. EditErrorCode gained four transaction codes on this branch and image and revision codes on main; the merged enum retains all of them, and the npm and Python mirrors carry this branch's four. The enum has no explicit ordinals and is serialized by name, so the reordering #485 introduced does not affect the wire. This PR remains MCP-transport-only: DocxSessionOps, DocxSessionJson and the WASM bridge are byte-identical to main after the merge.
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.
Closes #449
Summary
transactionIdfor applyingdocxodus_mutationsbatches, scoped to the lifetime of one open sessionatomicdefault, and duplicate keys fail before reservationValidation
Stack
Base:
agent/issue-452-content-controls/ PR #484. This is the final child issue in epic #435.