feat(vta): bounded retry on transient admin-VTA round-trips#132
Merged
Conversation
A stale always-on admin DIDComm session (mediator drops the idle WebSocket) made the first key-creation round-trip during join pack into a dead socket and time out after 30s — surfaced as "Failed to create persona keys: timeout waiting for DIDComm response". The session was never retried anywhere, so a single transient fault aborted the join. Add `vta_retry()` (pub(crate)) in setup_sequence/vta.rs: 3 attempts, 0.5s→1s backoff, retrying only transient VtaError variants (DidcommTransport / Network / Server 5xx) via `vta_retryable()`. Deterministic faults (validation/conflict/not-found/auth) are not retried. A plain re-send on the *same* client is the correct fix: the mediator enforces one socket per DID, so a full reconnect would duel on the mediator, while ATM already auto-reconnects the WebSocket underneath — the second send lands once it re-establishes. Wrapped: create_key / get_key_secret / list_webvh_servers / create_did_webvh in vta.rs, plus create_relationship_keys and the best-effort delete_did_webvh in relationship_actions.rs. Add 5 unit tests (paused clock) covering classification, no-retry on success, retry-then-succeed, give-up-at-max, and no-retry on deterministic errors. Signed-off-by: Glenn Gore <glenn.g@affinidi.com>
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
Joining a community could fail at "Creating persona keys…" with:
Root cause is a stale always-on admin DIDComm session: the mediator quietly drops the idle WebSocket, so the first
create_keyround-trip packs into a dead socket and times out after the SDK's hardcoded 30s. The session was never retried anywhere — a single transient transport fault aborted the whole join. A restart (fresh session) worked first time, which pointed straight at staleness.Fix
Add
vta_retry()(pub(crate)) insetup_sequence/vta.rs: 3 attempts, 0.5s→1s backoff, retrying only transientVtaErrorvariants (DidcommTransport,Network,Server5xx) viavta_retryable(). Deterministic faults (validation / conflict / not-found / auth / gone) are never retried.A plain re-send on the same client is the correct approach — not a session reconnect:
didcomm_session.rs), so tearing down and re-opening the admin session would duel on the mediator and time out.Wrapped call sites
vta.rs:create_persona_keys,create_update_keys,list_webvh_servers,create_did_via_server(allcreate_key/get_key_secret/create_did_webvhcalls)relationship_actions.rs:create_relationship_keys+ the best-effortdelete_did_webvhIdempotency note
On the rare "VTA processed it but the reply was lost" timeout, a retried
create_keyleaves at most an orphan key and a retriedcreate_did_webvhcould mint a duplicate DID. In the stale-socket case the send is lost (server never processes), so this is unlikely, and the join flow already rolls back a half-minted persona. Documented in the helper's doc comment.This is mitigation, not the root fix
The session has no keepalive/liveness probe and the 30s op timeout is hardcoded in vta-sdk. The durable fix (proactive reconnect or a pre-flight trust-ping) belongs in
verifiable-trust-infrastructure.Tests
5 unit tests in
vta::tests(paused clock, instant): retryable classification, no-retry-on-success, retry-then-succeed, give-up-at-max-attempts, no-retry-on-deterministic-error.cargo build -p openvtc✅cargo test -p openvtc vta::tests✅ (5 passed)