Skip to content

feat(vta): bounded retry on transient admin-VTA round-trips#132

Merged
stormer78 merged 1 commit into
mainfrom
feat/vta-retry-stale-session
Jun 17, 2026
Merged

feat(vta): bounded retry on transient admin-VTA round-trips#132
stormer78 merged 1 commit into
mainfrom
feat/vta-retry-stale-session

Conversation

@stormer78

Copy link
Copy Markdown
Contributor

Problem

Joining a community could fail at "Creating persona keys…" with:

Failed to create persona keys: Failed to create signing key: didcomm transport error: timeout waiting for DIDComm response

Root cause is a stale always-on admin DIDComm session: the mediator quietly drops the idle WebSocket, so the first create_key round-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)) 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 / gone) are never retried.

A plain re-send on the same client is the correct approach — not a session reconnect:

  • The mediator enforces one socket per DID (vta-sdk didcomm_session.rs), so tearing down and re-opening the admin session would duel on the mediator and time out.
  • ATM already auto-reconnects the WebSocket underneath, so the second send lands once it re-establishes.

Wrapped call sites

  • vta.rs: create_persona_keys, create_update_keys, list_webvh_servers, create_did_via_server (all create_key / get_key_secret / create_did_webvh calls)
  • relationship_actions.rs: create_relationship_keys + the best-effort delete_did_webvh

Idempotency note

On the rare "VTA processed it but the reply was lost" timeout, a retried create_key leaves at most an orphan key and a retried create_did_webvh could 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)
  • no new clippy warnings

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>
@stormer78 stormer78 requested a review from a team as a code owner June 17, 2026 13:31
@stormer78 stormer78 merged commit 927cc4b into main Jun 17, 2026
6 of 13 checks passed
@stormer78 stormer78 deleted the feat/vta-retry-stale-session branch June 17, 2026 13:32
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