Skip to content

fix: recheck paykit request authorization at submission - #2070

Merged
ovitrif merged 14 commits into
masterfrom
fix/paykit-request-recheck
Nov 26, 2026
Merged

ovitrif merged 14 commits into
masterfrom
fix/paykit-request-recheck

Conversation

@ovitrif

@ovitrif ovitrif commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #1962
Closes #2069
Closes #2118
Twin: synonymdev/bitkit-ios#1493

Description

  • Fixes a Paykit payment request being paid after its contact is blocked while its Lightning or on-chain send is prepared. The request's authorization (PaykitPaymentRequestRepo.ensurePaymentAllowed) ran once, before the send's journal writes, which suspend.
  • LightningRepo.payInvoiceRecheckedAtSubmission runs the caller's check again right before submission, for a check with no side effects: on Spark in SparkRepo.payInvoice's late check (added by fix: recheck spark send authorization at submission #2053) and before a leaf-selection resend; on the node after the send hash is written, right before LightningService.send. Refused there, nothing is sent and the result fails with ServiceError.PaymentStoppedAtSubmission.
  • Allowance (automatic) payments go through it too: PaykitAllowancePayer.payLightning rechecks with PaykitPaymentRequestRepo.ensureAutomaticPaymentAllowed, which refuses an expired request or a blocked contact. PaykitPaymentProofRepo.failLightningPayment now treats a stop at submission and an abort before send as unsent, so a refused allowance payment ends its attempt and releases its reservation.
  • AppViewModel sends a manual payment request through it. The refusal ends the request as a refusal before the send does: the proof is failed, the private list released, no pending screen. That cleanup now runs only when the result shows nothing left, so a Spark resend refused after an earlier try that may have committed stays pending.
  • On-chain request sends recheck too. On the node, LightningRepo.sendOnChain takes recheckBeforeSubmission, run after the transaction is prepared and its spend approved, before its receipt is kept; a refusal releases the prepared inputs and ends as OnchainSendNotDispatchedError, which the send flow treats as unsent. On Spark, SparkRepo.withdraw rechecks after its journal write and before the withdrawal goes out; a refusal closes the journal and fails with ServiceError.PaymentStoppedAtSubmission, which the service-routed send ends as a refusal.
  • A node Lightning send refused at submission drops only the send record it made, so the invoice can be retried on Spark, and keeps any record another send of the same invoice made, before or after it.

Out of Scope

Design

N/A — no UI changes.

Preview

N/A — no user-visible changes.

QA Notes

Setup

Device run on 6a08924 (#2070 (comment)): a Spark Lightning payment request and an on-chain payment request, both paid on a dev build against bitkit-docker's local Spark stack and payment request fixture (regtest). The block itself lands inside a window a few cache writes wide, which unit tests reach and a device can't time.

Journeys

N/A — no user-visible behaviour change.

Manual Tests

N/A

Automated Checks

  • added AppViewModelSendFlowTest.kt — a payment request blocked right before submission sends nothing and clears its proof
  • added AppViewModelSendFlowTest.kt — a payment request blocked before a Spark resend stays pending and keeps its proof
  • added LightningRepoTest.kt — a payment request's Spark send checks its authorization again right before sending, and its node send stops at submission when it lapses
  • added PaykitAllowancePayerTest.kt — an allowance's Lightning payment checks its contact again right before submission
  • added PaykitPaymentRequestRepoTest.kt — an automatic payment is refused once its contact is blocked or its request expired
  • added AppViewModelSendFlowTest.kt — an on-chain payment request blocked while its send is prepared sends nothing, and a Spark leg refused at its last check releases the request proof
  • added LightningRepoTest.kt — an on-chain send refused at its recheck releases the prepared transaction; a refused node Lightning send keeps an earlier send's record and one a send started meanwhile made, and stays refused when dropping its own record fails
  • added SparkRepoTest.kt — a Spark withdrawal refused after its journal write sends nothing, closes the journal, and stays refused when closing it fails
  • updated PaykitPaymentProofRepoTest.kt — a stop at submission or an abort before send clears the proof as unsent

Evidence

  • The first send-flow test fails with the recheck turned off (the payment is dispatched); the second fails without the pending guard (the proof is cleared).
  • The allowance payer test fails on master, where the allowance send passes { true } and never rechecks.
  • The on-chain and withdrawal tests fail with their recheck removed, the refused-withdrawal test fails when closing its journal can mask the refusal, and the send-started-meanwhile test fails with the earlier rollback.
  • Local verification: just compile, just test, just lint.

Gaps

None.

Models used

  • Planning/scoping: Not used
  • Implementation: Claude Opus 5.5 (reasoning: medium), Claude Sonnet 5.5 (reasoning: high)
  • Review: Gemini 4 Neon (reasoning: high)
  • Review rounds: 8

A payment request's Lightning send checks its authorization once more
right before submission, after the last journal write: on Spark in its
late check and before a leaf-selection resend, on the node right before
its queue. Refused before anything left, the request ends like a refusal
before the send; a resend refused after an earlier try stays pending.

Verified: AppViewModelSendFlowTest (new tests fail with the recheck or the guard off), LightningRepoTest, QuickPayRepoTest, just lint
@ovitrif ovitrif self-assigned this Nov 26, 2026
@ovitrif
ovitrif requested review from jvsena42 and pwltr November 26, 2026 12:05
Verified: none (changelog text only)
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 26, 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-26T12:07:28.191432Z 97d305c 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.

@greptile-apps

greptile-apps Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · This change appears safe to merge.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] This change appears safe to merge.

Summary

Rechecks Paykit request authorization after payment records are written and before Lightning submission.

  • Incoming Paykit requests recheck permission at Lightning submission.

Acknowledged scope: ovitrif explicitly leaves blocks arriving while a node send waits in its queue outside this change because the Paykit check suspends. Automatic allowance payments are also deferred to #2069.

Reviews (1) · Last reviewed commit: "fix: recheck paykit request authorizatio..." · Reviewed by Greptile

jvsena42
jvsena42 previously approved these changes Nov 26, 2026

@jvsena42 jvsena42 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approving at 97d305c with one LOW open, below. It's in the review body because the file isn't in the diff. Fix it here or in a follow-up, your choice; please reply with which.

LOW: changelog.d/next/1962.fixed.md still describes only QuickPay. At head it reads "QuickPay Lightning payments through Spark now stop if the wallet locks while the send is being prepared." It was narrowed in #2053 (3abdd06) because a Paykit request's authorization was still checked once. This PR fixes that on both rails and closes #1962, but the release notes would leave out the user-facing part: a request is no longer paid after its contact is blocked mid-send. Widen that same fragment rather than adding a second one for the issue, e.g. "Lightning payments now stop if QuickPay's wallet lock or a payment request's authorization lapses while the send is being prepared."

Checked and clean:

  • Gate at submission, both rails. On Spark, payInvoiceRecheckedAtSubmission → authorizeSend runs the full onBeforeSend() after the last journal write (SparkRepo.kt:684) and before each leaf resend (:804). Only non-suspending checks follow before sparkService.send. On the node, the recheck runs after addLdkSendHash and before lightningService.send (LightningRepo.kt:1869-1872), and a refusal releases admission in the finally. The ServiceQueue.LDK wait is the declared out-of-scope window.
  • ensurePaymentAllowed(forExecution = true) is read-only. There's no runBlocking, and Spark holds no mutex across the recheck.
  • Wrong refusals: a late refusal on either rail happens before anything leaves, so it ends like a first-check refusal (toast or error screen, proof failed, allowance finished, no pending row). At a leaf resend it settles as PaymentPendingException with cleanup skipped, so a refusal can't mark a dispatched send failed, and a retry can't double pay.
  • Callers: only the request send (AppViewModel.kt:8815) is newly rechecked. QuickPay is unchanged. Allowance, swap hold, move-to-Spark and transfer keep their existing checks (allowance tracked in #2069).
  • Cancellation: the send runs in AppViewModel's viewModelScope, so only finishing the activity can cancel the new suspending recheck. That leaves the same held-until-expiry state SparkRepo already documents for a cancel inside the send.

perf: marginal (one linkedPeers() read per request send and per leaf resend; background refreshes are refused admission during a submission), not measured.
Device gate: no device check needed — no UI change, and the window can't be timed on a device.

Reviewer model: Opus 5.5 (claude-opus-5-5) coordinating and verifying; Fable 5.2 (claude-fable-5-2) primary review
Reasoning effort: Not exposed

@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Regtest APK

Built from 6a08924 (run).

Download bitkit-dev-debug universal APK (expires in 30 days).

Verified: PaykitAllowancePayerTest, PaykitAllowanceExecutorTest, PaykitPaymentProofRepoTest, PaykitPaymentRequestRepoTest, LightningRepoTest, AppViewModelSendFlowTest
Verified: none (changelog text only)
Verified: just lint; just test passed before formatting

@talosmachina talosmachina 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.

No findings. Runs a Paykit payment request's authorization again right before submission on both rails: inside Spark's late check and before a leaf-selection resend, and on the node after the send hash is written; a refusal there ends the request only when the result shows nothing went out. Reviewed 97d305c, full tier, static: an auto review on bitkit-android does not build the branch here, so this rests on the code and on CI.

What I checked, and 5 candidates I ruled out

Read in full: LightningRepo.payInvoiceChecked and payInvoiceWithLdk, SparkRepo.payInvoice and sendRetryingLeafSelection, AppViewModel.proceedWithLightningPayment and clearFailedLightningPayment, PaykitPaymentRequestRepo.ensurePaymentAllowed and hasCurrentExecutionContext, QuickPayRepo.dispatchBolt11.
Call sites traced: sendLightning has one caller; payInvoiceRecheckedAtSubmission is reached only when incomingPaymentRequest != null, whose check only sets authorizationError, so running it again has no side effect. The rechecks call the caller's onBeforeSend directly, not authorizeSend, so admission and rail recording still run once.
CI at review time: build-and-test, build-local and Greptile green; lint and two e2e suites still running.

Ruled out

  • The sentNothing gate drops an old cleanup case: before this PR authorizationError was set only by the pre-update check (same throwable, caught by ===) or by the first check, whose refusal is PaymentAbortedBeforeSend on both rails and is not wrapped by executeOperation. Both still match.
  • A refusal with a result that is neither sent-nothing nor pending: a false resend check returns the earlier leaf-selection failure, which SparkRepo always turns into PaymentPendingException, and clearFailedLightningPayment keeps that pending. No other path sets the error after something could have gone out.
  • The node refusal leaves its send hash and record behind: true, but payInvoiceAuthorizedAtSubmission already stops after the same write. earlierNodeSend reads recordsBefore per call and drops a hash the node does not list, so a later send of the invoice is not held by it.
  • linkedPeers() waits on the Paykit operation lock inside Spark's journal window: only a process death during that wait leaves a hold, and the hold ends at the invoice's expiry. That needs an unlikely precondition.
  • A spurious refusal from the app's own state between the two checks: nothing on the send path between them touches request history, acceptance, processingSubscriptionIds or stateGeneration, and isCurrentState compares a generation read in the same call.

Merge confidence: 4/5. No findings, but I could not build the branch here and lint and two e2e suites had not finished.

Reviewer model: claude-opus-5-5
Reasoning effort: Not exposed (this run's metadata does not report an effort setting)

Verified: PaykitAllowancePayerTest, PaykitAllowanceExecutorTest, PaykitPaymentRequestRepoTest; just lint
Drops the identity guard of 1af4c14: a refusal after an identity switch left the attempt stuck as sending, while master already sends in that case.

Verified: PaykitAllowancePayerTest, PaykitAllowanceExecutorTest, PaykitPaymentRequestRepoTest; just lint
@ovitrif

ovitrif commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator Author

LOW: changelog.d/next/1962.fixed.md still describes only QuickPay. [...] Widen that same fragment rather than adding a second one for the issue

@jvsena42 Widened in 1d346e9: "Lightning payments now stop if QuickPay's wallet lock lapses, or a payment request's contact is blocked, while the send is being prepared." It's this PR's only fragment.

@ovitrif

ovitrif commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator Author

7e234a5 also fixes #2069 here: an allowance's automatic Lightning payment now rechecks its request right before submission (expired request or blocked contact), and a stop at submission ends its attempt as unsent and releases the reservation. The description lists the new tests; an identity switch during a send stays out of scope, as on master.

pwltr
pwltr previously requested changes Nov 26, 2026

@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 7e234a5.

SparkRepo.kt:804 checks the payment deadline and exit hold before awaiting the new Paykit authorization lookup. Recheck both after the lookup and before resending. If either check fails, keep the earlier leaf-selection result so its outcome can still settle.

Medium: A Paykit payment can reach Spark after its deadline if the lookup waits across the cutoff. This can affect an automatic allowance payment or a manual payment whose reviewed quote expires while the invoice is still valid.

Low: An emergency exit can place Spark on hold while a retry waits for authorization. The retry still reaches Spark when the lookup returns, which can prolong the exit’s wait for in-flight spending.

Low candidate: If a Paykit lookup fails during an automatic payment and the subsequent failure report also fails, PaykitAllowanceExecutor.kt:998 can leave an unsent attempt in SENDING. Recovery has no rail result to clear it, so it may continue counting against the monthly allowance. Verify that recovery releases it after both failures and a relink.

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

Verified: SparkRepoTest, LightningRepoTest; just lint; the new test fails with the old check order
@ovitrif

ovitrif commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator Author

@pwltr

Medium: A Paykit payment can reach Spark after its deadline if the lookup waits across the cutoff.

Low: An emergency exit can place Spark on hold while a retry waits for authorization.

Fixed in 16cf317: a resend now runs the authorization check first, then reads the deadline and exit hold, and returns the earlier leaf-selection result if either fails. A new SparkRepoTest case moves the clock past the deadline inside the authorization check and expects no resend.

Low candidate: If a Paykit lookup fails during an automatic payment and the subsequent failure report also fails, PaykitAllowanceExecutor.kt:998 can leave an unsent attempt in SENDING.

Out of scope: tracked in #2115, because it predates this PR and applies to every refusal before send, not only this recheck.

@ovitrif
ovitrif requested a review from pwltr November 26, 2026 13:57
pwltr
pwltr previously approved these changes Nov 26, 2026

@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 16cf317.

Low: A Paykit payment stopped by the final LDK authorization check still leaves its invoice hash in the send cache (LightningRepo.kt:1869). If the same valid invoice is retried with enough Spark balance while LDK is unavailable, earlierNodeSend refuses it as a possible node payment (LightningRepo.kt:1736). Clear the record made by the refusal while preserving any record of an earlier real submission.

Low candidate: Spark can stop a retry at submission while keeping the earlier transfer's hold under the same key (SparkRepo.kt:653, SparkRepo.kt:683). If a separate same-invoice send becomes uncertain after the request resolves its endpoint and before the Lightning repository starts its checks, that refusal can clear the manual request's proof (AppViewModel.kt:8264) or clear the automatic proof and release the allowance reservation (PaykitPaymentProofRepo.kt:937, PaykitAllowanceExecutor.kt:998). If the original transfer then settles, the request may lose its receipt or allowance accounting. Verify that ordering and preserve the earlier transfer's pending outcome when refusing the retry.

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

Verified: just compile, just test, just lint
@ovitrif

ovitrif commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator Author

Low: A Paykit payment stopped by the final LDK authorization check still leaves its invoice hash in the send cache

@pwltr fixed in 6e143c0: a refused node send drops only the record it made, so the invoice can be retried on Spark, and keeps any record another send of the same invoice made.

Low candidate: Spark can stop a retry at submission while keeping the earlier transfer's hold under the same key

out of scope: tracked in #2124, because it needs a separate same-invoice send to turn uncertain inside the window between endpoint resolution and the repository's checks; it is listed under Out of Scope.

@ovitrif
ovitrif requested a review from pwltr November 26, 2026 16:06
pwltr
pwltr previously requested changes Nov 26, 2026

@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 6e143c0 against 576ac14.

Medium: The new recheckBeforeSubmission parameter in LightningRepo.kt:2117 breaks four SparkExitRepoTest.kt verifications carried in from 576ac14 (base lines 1615, 1654, 1692 and 1853). Each still registers 19 matchers, and the merged call passes a twentieth argument as a default lambda. Add recheckBeforeSubmission = any() to all four on the merge candidate.

Medium candidate: A direct on-chain request checks contact authorization before retaining the signed receipt (LightningRepo.kt:2200–2206). If a contact deletion can commit during that write, the prepared transaction can still reach native broadcast (LightningService.kt:1144–1154). The confirmation sheet blocks ordinary navigation during submission. An independently running contact deletion that can commit during receipt retention would establish the user-facing trigger.

Low: A failed journal clear at SparkRepo.kt:1452 masks a withdrawal's definite authorization refusal. The send has never reached Spark, but AppViewModel.kt:8128–8165 can show it as unresolved and hold its proof, private list and allowance attempt for reconciliation. Preserve the definite refusal when the cleanup write fails.

Low candidate: At LightningRepo.kt:1868–1884, two LDK attempts for the same invoice can leave a send hash if both stop at the final check and the older attempt refuses first. The later refusal restores the older attempt's mark, and a Spark retry can be blocked until LDK can list its payments. This needs two separate request contexts that can get the same invoice past the proof and private-list guards.

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

Verified: just compile, just test, just lint
Verified: LightningRepoTest, SparkRepoTest, just lint
@ovitrif

ovitrif commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator Author

Medium: The new recheckBeforeSubmission parameter in LightningRepo.kt:2117 breaks four SparkExitRepoTest.kt verifications carried in from 576ac14

@pwltr fixed in 1f3440b: master is merged in and the four verifications take recheckBeforeSubmission = any().

Medium candidate: A direct on-chain request checks contact authorization before retaining the signed receipt

out of scope: tracked in #2130, because it is the same node-side boundary as the Lightning queue wait: the block check suspends on the Paykit SDK and can't run inside the receipt write or the node queue. Out of Scope now names both.

Low: A failed journal clear at SparkRepo.kt:1452 masks a withdrawal's definite authorization refusal.

Fixed in f045823: the journal closes best-effort, so the refusal reaches the caller even when that write fails.

Low candidate: At LightningRepo.kt:1868–1884, two LDK attempts for the same invoice can leave a send hash if both stop at the final check and the older attempt refuses first.

No change: the record left behind fails safe. It only holds a Spark retry of that invoice until the node's payment listing shows no send and clears it, and nothing is sent twice.

@ovitrif
ovitrif requested a review from pwltr November 26, 2026 17:01
…recheck

Verified: just compile, just test (AppViewModelSendFlowTest rerun after its fix), just lint
Verified: just test file AppViewModelSendFlowTest, detekt
@ovitrif

ovitrif commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator Author

Merged master into this PR in 79fc467 to resolve conflicts and pushed it with 6a08924:

  • AppViewModel.kt: the refused-before-submission cleanup keeps this PR's check that nothing was sent, and passes the request id master now gives failLightningPayment.
  • PaykitAllowanceExecutorTest.kt and AppViewModelSendFlowTest.kt: the stubs and checks follow that new requestId argument; the check that no proof fails now matches any request id.

Also added an Out of Scope entry for the hardware-wallet path: #2138.

@ovitrif

ovitrif commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator Author

Device run on 6a08924

Ran on an Android 15 emulator (API 35, arm64), dev debug build of 6a08924 against bitkit-docker's local Spark stack and the Pubky marketplace testnet with the payment request fixture (E2E=true E2E_BACKEND=local, E2E_HOMESERVER_PUBKY, E2E_LOCAL_HOST, SPARK_LOCAL_CONFIG_B64, SPARK_LOCAL_CHAIN_URL). The installed APK's sha256 matches the build. The app was linked as a contact with the fixture's issuer, which sent each request.

  • 1. Payment request paid over Lightning from Spending (Spark): a 5 000 sat request whose only endpoint is an LNURL-pay, served locally with invoices from the Spark stack's Lightning node (the stock LNURL fixture's invoices come from LND on the other regtest chain, which Spark can't reach). Swipe To Pay → Bitcoin Sent. Spark logged the send, PaymentSuccessful followed and the payment proof was queued. The issuer's record moved to ProofSubmitted with a preimage matching the payment hash, and the request left the pending list.

    case1-spark-ln-request2x.mp4

  • 2. Payment request paid on-chain from Savings: a 20 000 sat request with only the regtest address endpoint. Swipe To Pay → Bitcoin Sent; the transaction confirmed to the issuer's address, the proof was queued, and the issuer's record moved to ProofSubmitted with the txid. The request left the pending list; the activity shows it as Confirmed with the issuer as contact.

    case2-onchain-request2x.mp4

The PR lists no manual tests or journeys (QA Notes: N/A), so these two cases carry no PR IDs.

No refusal at submission was logged in either case. The refusal window itself is covered by the PR's unit tests (not rerun here).

@jvsena42 jvsena42 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Re-approving at 6a08924. The changelog LOW from my last review is fixed in 1d346e9: the 1962 fragment now covers the request and allowance rechecks.

Delta since 97d305c checked and clean:

  • Allowance recheck: ensureAutomaticPaymentAllowed checks only the deadline (the same paymentDeadlineAt the executor already passes) and a BLOCKED linked peer. A linkedPeers() failure fails closed to MANUAL. linkedPeers() takes operationLock at Ordered, which admission never refuses, and the executor holds no SDK lock at payLightning, so there's no self-refusal or deadlock. Both refusal errors now count as unsent in failLightningPayment.
  • On-chain request recheck (LightningRepo.kt:2197-2205): runs after checkApprovedSpend and before retainPreparedReceipt. A refusal releases the prepared tx and the attempt (OnchainSendNotDispatchedError), so a retry can't double pay or be blocked.
  • Node Lightning refusal rollback: a hash is dropped only when this send created it and nothing else holds it. I traced it against concurrent and earlier sends of the same key.
  • Spark resend: authorization runs first, then the synchronous deadline and exit checks, with nothing suspending before sparkService.send.
  • Withdrawal refusal with a failed journal close: the refusal surfaces as PaymentStoppedAtSubmission, and a kept journal blocks further withdrawals with WithdrawalPending until a sync drops it, so there's no double withdrawal.
  • Cancellation: the allowance runs under NonCancellable; on-chain releases the prepared tx in finally; the withdraw journal closes under NonCancellable.
  • Merges: 1f3440b has no conflict resolutions; a0b84ee keeps the sentNothing gate with master's requestId.

perf: marginal (one or two extra linkedPeers() reads per allowance, on-chain request and withdrawal send), not measured.
Device gate: no device check needed — no UI change; the refusal windows can't be timed on a device.

Reviewer model: Opus 5.5 (claude-opus-5-5) coordinating; Fable 5.2 (claude-fable-5-2) delta review
Reasoning effort: Not exposed

@ovitrif

ovitrif commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator Author

Merging: approved on 6a08924, CI green, and the device run on this head passed both cases.

@ovitrif
ovitrif merged commit 7a1e096 into master Nov 26, 2026
23 checks passed
@ovitrif
ovitrif deleted the fix/paykit-request-recheck branch November 26, 2026 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants