Repository navigation
feat(protocol): define recoverable download handoff contract - #4
Merged
Merged
Conversation
This was referenced Nov 19, 2026
agalwood
marked this pull request as ready for review
November 19, 2026 16:13
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 and contract
Browser takeover cannot safely treat a lost submit reply as permission to restart the browser download. Add an opt-in handoff v1 wire contract for extension-owned confirmation:
download/handoff.prepare,.commit,.status, and.abort.The new optional initialize capability binds operations to a durable ledger instance. Prepare freezes direct HTTP(S) GET payloads; commit also carries the approved payload hash. Method-specific results distinguish prepared, committed, aborted, expired and observational not-found. Instance changes and payload conflicts have dedicated error codes. All four methods are excluded from the agent catalog; actual authorization and transport exposure remain host responsibilities.
Shared canonical payload encoding normalizes schema defaults and object key order before SHA-256, binding destination, filename, headers, cookies and source metadata. Strict request schemas reject unsupported method/body options instead of silently turning POST into GET. Existing submit and old-peer initialization remain compatible.
Independent browser-store rollout
Store review delays and users retaining old extensions are supported configurations. The host must keep the original
download/submit, initialization, pairing and task behavior, without raising the extension minimum version for this feature. New extensions must retain the legacy path for old hosts.Both new-operation gates default closed: server
acceptingNewand the client flag passed tocanStartDownloadHandoff. Unsupported or invalid optional handoff capabilities no longer break the base handshake. Disabling new handoffs must keep handlers and the durable journal available for in-flight recovery; an operation already transmitted must never downgrade to a second legacy submission. See the bilingual contract for release order and compatible rollback requirements.Cross-version tests use the actual published
@motrix/mdxp@0.8.1SDK through an exact dev-only alias. They cover old/old, old/new, new/old, disabled rollout, and a future capability, using serialized RPC initialize and submit messages. These tests do not replace released-extension/production-host E2E, which remains required before enablement.Scope
This PR supplies schemas, inferred types, typed RPC entries, tool registration, canonical encoding and a bilingual normative contract. It does not implement or claim a durable ledger, transactional outbox, engine reconciliation, or browser ownership controller. It does not publish a package or switch the extension to this protocol.
The contract specifies abort tombstones for absent operations, terminal-state retention, same-key recovery after lost replies, instance rotation after ledger loss, expiry serialization and the integration fault matrix required before a host may advertise support. Download confirmation stays in the extension. V1 does not support POST or request bodies; one-use URLs are not guaranteed replayable.
This follows motrixapp/motrix-extension#46. A host must keep the capability absent until the documented persistence and browser integration requirements are implemented and verified.
Validation
MDXP contract checksCI: frozen dependency install, full lint, typecheck, tests, build and package verification.0950100, including all 192 tests and packaged entry verification.Integration update
Head
55b4f71integrates the 0.9.0 media-format capability with handoff v1. All 278 SDK tests passed locally; the packed root, Node and browser entry points were verified. This PR is the protocol dependency for the host journal in agalwood/Motrix#2535 and the paired extension candidate in motrixapp/motrix-extension#78. The independently reviewable browser ownership fix is motrixapp/motrix-extension#77. The candidate SDK was exercised from a local checkout.