Skip to content

feat(add): idempotency key + single network retry - #5

Merged
agalwood merged 3 commits into
mainfrom
feature/add_idempotency_key_retry_20260817
Aug 17, 2026
Merged

feat(add): idempotency key + single network retry#5
agalwood merged 3 commits into
mainfrom
feature/add_idempotency_key_retry_20260817

Conversation

@agalwood

Copy link
Copy Markdown
Member

What

  • motrix add now generates a fresh idempotencyKey (UUID) per invocation on all three variants (url/magnet/torrent)
  • On a network-level failure (EXIT.NETWORK — fetch threw, the response may have been lost after delivery) the same request is retried exactly once with the same key; JSON-RPC errors never retry; no other command gains retry
  • rpcCall adds an upgrade hint when a host rejects with -32602 InvalidParams (protocol drift: older Motrix rejecting the new field)
  • @motrix/mdxp bumped ^0.3.0^0.5.0

Contract: MDXP idempotency & retry contract (§8.5) — a keyed replay returns the first submission's task snapshot, so the single retry can never mint a duplicate task. Requires Motrix with @motrix/mdxp@0.5.0 schema for motrix add; older hosts reject loudly with the new upgrade hint.

Verification

  • pnpm lint / pnpm typecheck / pnpm build clean; 221/221 tests
  • New tests: retry reuses the identical key across both attempts; exactly one retry then EXIT.NETWORK; JSON-RPC errors surface without retry; -32602 hint preserves the original error as data

Note before next npm publish: bump package version (currently 0.4.0).

@agalwood
agalwood merged commit c7a201d into main Aug 17, 2026
6 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.

1 participant