Skip to content

fix: let confirm take a swipe after a failed send - #1430

Open
ovitrif wants to merge 2 commits into
masterfrom
fix/swipe-after-failed-send
Open

ovitrif wants to merge 2 commits into
masterfrom
fix/swipe-after-failed-send

Conversation

@ovitrif

@ovitrif ovitrif commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Companion: synonymdev/bitkit-android#2017 (its failed-send fix; its iOS twin is #1418)

After a failed send, Try again brought back the confirm screen with its swipe still spinning, and every new swipe was ignored, so the payment could not be retried from there (also on master). The swipe only reset when its action threw, and a failed payment moves on to the failure screen without throwing. This PR resets the swipe whenever the confirm screen comes back with no swipe or payment running.

Description

  • ConfirmSwipeLock counts each return to the confirm screen while nothing runs for it, and SwipeButton takes that count as resetCount: a change puts a submitted knob back at the start and accepts a new swipe.
  • Applies to the send confirm screen and the LNURL pay confirm screen.
  • A knob not yet swiped is left alone, so a swipe made right after the screen appears keeps its spinner.

Out of Scope

None.

Design

N/A — no UI changes.

Preview

Try again after a failed payment from a link-opened invoice, at 2x: the knob is back at the start and a second swipe sends again.

flow-link2x.mp4

QA Notes

Setup

Debug build on a regtest simulator with Spark connected (Capabilities in journeys/README.md), QuickPay off, and a wallet funded with about 100 000 sats. A local LND node issues hold invoices (lncli addholdinvoice) and cancels them (lncli cancelinvoice) to make the payment fail after the swipe.

Journeys

N/A — not drivable; see Manual Tests.

Manual Tests

A payment that fails after the swipe needs a hold invoice cancelled while it is in flight, which the Capabilities table does not list.

  • 1. Open a 3 000-sat hold invoice as a lightning: link, swipe, cancel the invoice, then tap Try again on Payment Failed. The knob is back at the start and a second swipe sends the payment again.
  • 2. The same through Send → Paste Invoice.

Automated Checks

  • added SendConfirmationSwipeTests.swift: returning to confirm with nothing running resets the swipe, and a running swipe or payment keeps it

Evidence

  • The unit suite passes at f2f38ad on an iPhone 17 simulator (iOS 26.5).
  • 1 and 2 passed at f2f38ad on a regtest iPhone 17 simulator (iOS 26.5) against a local Spark stack, paying LND hold invoices cancelled after the swipe. In both, the app logged a second Sent Spark payment after Try again and the new swipe. On master the same steps leave the knob spinning, with no send logged after Try again.
  • Payment Failed offers no Back, only Try again and Contact Support, so Try again is the only way back to the confirm screen there.

Gaps

None.

Models used

  • Planning/scoping: Claude Opus 5.5 (reasoning: medium)
  • Implementation: Claude Opus 5.5 (reasoning: medium), Claude Sonnet 5.5 (reasoning: high)
  • Review: gemini-4-neon-high (reasoning: Not exposed)
  • Review rounds: 1

Metadata note: the review ran through Gemini Neon's CLI, whose record names the model but not a reasoning setting.

Verified: none (unit suite running on the simulator)
@ovitrif ovitrif self-assigned this Nov 25, 2026
@ovitrif
ovitrif requested review from jvsena42 and pwltr November 25, 2026 13:13
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-25T13:15:02.748230Z f2f38ad PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Verified: none (changelog text only)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f2f38ad35e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +130 to +134
.onChange(of: resetCount) {
if isSubmitting {
reset()
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Add the required changelog fragment for the retry fix

This user-facing fix: restores payment retries, but the commit adds no changelog fragment. I checked the changed-file list and searched changelog.d/; the existing 1418.fixed.md describes locking confirmation during payment, not restoring the swipe after failure. Add one <issue-or-pr>.fixed.md fragment under changelog.d/next/ so release automation includes this fix in the release notes, as required by AGENTS.md.

AGENTS.md reference: AGENTS.md:L625-L628

Useful? React with 👍 / 👎.

@greptile-apps

greptile-apps Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The change affects retry behavior in two payment confirmation flows.

The PR appears safe to merge, with a non-blocking gap in the regression test.

Findings

  1. P2 Button reset remains untested ▶

Summary

Restores the confirmation swipe after a failed send.

  • Send confirmations reset the swipe when they return idle.

No blocking behavior issue was found. The new test checks the counter but does not cover the button reset itself.

Reviews (1) · Last reviewed commit: "fix: let confirm take a swipe after a fa..." · Reviewed by Greptile

Comment on lines +38 to +59
@MainActor
func testReturningToConfirmWithNothingRunningResetsTheSwipe() {
let lock = ConfirmSwipeLock()
lock.setVisible(true)
let shown = lock.idleReturns

lock.begin()
lock.setVisible(false)
lock.setVisible(true)
XCTAssertEqual(lock.idleReturns, shown, "A swipe still running keeps its knob")
lock.setVisible(false)
lock.end()
lock.setSubmittingPayment(true)
lock.setVisible(true)
XCTAssertEqual(lock.idleReturns, shown, "A payment still running keeps its knob")
lock.setVisible(false)
lock.setSubmittingPayment(false)

lock.setVisible(true)
XCTAssertEqual(lock.idleReturns, shown + 1, "Try again or Back after a failed payment takes a new swipe")
lock.setVisible(false)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Button reset remains untested

The new test checks idleReturns, but never checks whether SwipeButton resets. It would still pass if the resetCount handler or either screen's connection to it were removed.

Add a test that submits a swipe, lets its action return without throwing, changes resetCount, and checks that another swipe runs the action. Also check that an untouched button stays unchanged.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@pwltr pwltr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 48b535e.

Medium candidate: The reset in Bitkit/Views/Wallets/Send/LnurlPayConfirm.swift:215 can make Try again payable while the first Spark payment's outcome is still unknown. If Spark reports an error after dispatch, the manual LNURL flow can show Payment Failed and return to the same confirmation with the slider enabled. The next swipe fetches a fresh invoice at Bitkit/Views/Wallets/Send/LnurlPayConfirm.swift:389. If it has a different payment hash, the first invoice's duplicate-payment guard does not apply, and both invoices could settle. Keep the original invoice pending after an ambiguous submission, and fetch a replacement only after the original is known to have failed.

Review details

Quick review
Model: Claude Opus 5.5
Reasoning effort: high

General review
Model: GPT-6.2 Sol
Reasoning effort: high

Combined review
Model: GPT-6.2 Sol
Reasoning effort: high

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.

2 participants