Skip to content

PDO-only approach for <unavailable> doesn't reliably deliver — add retry receipt #508

Description

@mcaldas

Context

PR #506 fixed <unavailable> by requesting PDO from the primary phone. However, in testing, the PDO-only approach doesn't reliably deliver messages.

What Works

The original approach in #506's first commit (handle_decrypt_failure with RetryReason::NoSession) worked reliably — messages arrived via PDO relay within 1 second. This sends both:

  1. A retry receipt to the sender
  2. A PDO request to the primary phone (via spawn_pdo_request inside handle_decrypt_failure)

What Doesn't Work Reliably

The second commit changed to spawn_pdo_request_with_options(&info, true) only (no retry receipt). In testing:

  • PDO request is sent successfully
  • Primary phone acknowledges with a Delivered receipt
  • But the PDO response never comes back (waited 60+ seconds)
  • The phone is confirmed online (delivery receipt proves it)

Hypothesis

The retry receipt may be needed because:

  1. It tells the sender to re-encrypt for this specific device
  2. The sender's re-encryption triggers the WA server to route properly
  3. Without the retry receipt, the phone receives the PDO request but doesn't know it needs to relay

Proposed Fix

Add self.spawn_retry_receipt(&info, RetryReason::NoSession) alongside the existing spawn_pdo_request_with_options, similar to how handle_decrypt_failure does both:

if let Some(unavailable) = unavailable_node {
    // ... existing code ...
    self.spawn_pdo_request_with_options(&info, true);
    self.spawn_retry_receipt(&info, RetryReason::NoSession);  // ADD THIS
    self.core.event_bus.dispatch(&Event::UndecryptableMessage(...));
    return;
}

Testing

  • Tested with two wa-rs companion devices on different WA accounts
  • With retry receipt: message delivered via PDO in <1 second
  • Without retry receipt (current code): PDO request sent, phone acks, but no relay

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions