Skip to content

paykit private_payments policy error stalls restore and profile re-creation #984

Closed

Description

@jvsena42

Observed

Policy(code: "policy_error", context: "cannot disable Paykit app capability private_payments while app-owned work is still active") blocks three flows:

  1. Wallet restore waits ~5 min. On a wallet restored from a seed that had USDT and Paykit activity, restore sits on "Setting up your wallet 100%" while METADATA is restored. The wait ends exactly when the Paykit app publish fails:
    [16:22:22.058 UTC] DEBUG: VSS 'getObject' success for 'METADATA' at version 1 - VssBackupClient
    [16:27:38.928 UTC] WARN⚠️: Failed to publish Paykit app: Policy(code: "policy_error", context: "cannot disable Paykit app capability private_payments while app-owned work is still active") - PaykitSdkService
    [16:27:38.945 UTC] INFOℹ️: Restore success for: 'METADATA' - BackupService
    
  2. Re-creating a profile after deleting one with contacts. After deleting a profile with 62 saved contacts, creating a profile again logs Failed to publish Paykit app: Policy(… private_payments …). Cleanup retries keep failing the same way (Failed to reconcile public Paykit state: Policy(…), AppScene.retryPendingPaykitEndpointRemoval). This happened on master and on fix: pause paykit work during profile deletion #954.
  3. Pay Contacts Continue. Once, the first Continue failed with Failed to enable contact payments: Policy(code: "policy_error", context: "Paykit App operation already in progress for 'bitkit'") and the screen stayed. A second tap worked after 44 s. This may share a cause with [Bug]: Continue on Let your contacts pay you does not finish #861.

During profile deletion, the same policy error appears on iOS and Android (Failed to remove public Paykit state before clearing session / Failed to remove Bitkit payment endpoints). Deletion still completes there.

Expected

Restore finishes without a multi-minute wait. A new profile publishes its Paykit app, and Pay Contacts succeeds on the first Continue.

Steps to reproduce

  • Restore: on device A, use USDT and Paykit (send a USDT request), then wipe and restore the same seed (staging VSS). Time "Setting up your wallet" and look for the METADATA / Failed to publish Paykit app lines.
  • Re-create: create a profile, save ~60 contacts, delete the profile, create a new one, and watch for Failed to publish Paykit app: Policy(…).

Root cause (suspected)

App-owned Paykit work (private-payment preparation, payment-request intake or polling) is still registered with the SDK when the app publishes a capability set without private_payments. On restore, METADATA's restore action seems to wait on that publish, probably behind the SDK's shared-state lock (cooldown_seconds=300 on Android). Not traced to a line; needs SDK confirmation.

Suggested fix

Before disabling the capability, stop or wait for the app-owned work. Or don't make METADATA restore wait on the Paykit app publish. Treat the policy error as retry-later rather than holding restore.

Related: pubky/paykit-rs#197, synonymdev/bitkit-android#1522, #861.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions