Skip to content

fix(transactions): retry submitIntent on server-side stale state race#661

Merged
bmc08gt merged 2 commits intocode/cashfrom
fix/retry-submit-intent-on-stale-state-race
May 4, 2026
Merged

fix(transactions): retry submitIntent on server-side stale state race#661
bmc08gt merged 2 commits intocode/cashfrom
fix/retry-submit-intent-on-stale-state-race

Conversation

@bmc08gt
Copy link
Copy Markdown
Collaborator

@bmc08gt bmc08gt commented May 3, 2026

No description provided.

…w to retryable

Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
@bmc08gt bmc08gt self-assigned this May 3, 2026
Bugsnag reports SubmitIntentError.StaleState errors with reason "race
detected: cached balance version is stale". This is a server-side
optimistic version lock — the client sends no balance version. When
concurrent intents advance the version before the DB transaction commits,
the check fails and the transaction rolls back (no nonces consumed).

- Add isRaceCondition property to StaleState, matching the "race
  detected:" prefix — the only StaleState variant safe to blindly retry
- Wrap submitIntent in retryableOrThrow with retryIf narrowed to race
  conditions only (other StaleState reasons like stale exchange rates,
  closed accounts, or claimed gift cards require client-side state
  refresh and would fail identically on retry)
- Move gift-card-claimed Bugsnag suppression from
  InternalTransactionRepository to ReceiveGiftCardTransactor where the
  context-specific handling belongs

Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
@bmc08gt bmc08gt force-pushed the fix/retry-submit-intent-on-stale-state-race branch from 3794ab0 to 99b0c01 Compare May 3, 2026 17:06
@bmc08gt bmc08gt added type: fix Bug fix area: payments Payments, transfers, intents, billing area: intents Intent construction, submission, server-side state next release Slotted for inclusion in next release and removed area: payments Payments, transfers, intents, billing labels May 3, 2026
@bmc08gt bmc08gt merged commit a450629 into code/cash May 4, 2026
1 check passed
@bmc08gt bmc08gt deleted the fix/retry-submit-intent-on-stale-state-race branch May 4, 2026 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: intents Intent construction, submission, server-side state next release Slotted for inclusion in next release type: fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant