Repository navigation
Conversation
Build the node without the Paykit Server accounts, each of which added about 2 s to the build, and load them into the running node after start in a detached task with background time, so the load keeps going when the app closes right after start. - Reconcile loads each account in its own LDK queue hop. - Wallet sync no longer reconciles accounts; the load retries a transient failure every 15 s while the same node runs, and skips a rejected xpub. Verified: xcodebuild test (LightningServiceConfigTests, WatchOnlyAccountServiceTests, BackgroundTimeTests, PubkyAuthApprovalSheetTests), swiftformat --lint
Verified: none (docs only)
Address the pre-PR self review: - Check the node before and inside each LDK queue hop, so a stopped or replaced node gets no more accounts. - Run the load also when only unloads are pending, and sync only when there are accounts to load. - Sync after a rejected account too, re-check the node before syncing, and hold background time per attempt instead of across retry sleeps. Verified: xcodebuild test (LightningServiceConfigTests, WatchOnlyAccountServiceTests, BackgroundTimeTests, PubkyAuthApprovalSheetTests), swiftformat --lint
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Confidence Score: 5/5
[Medium impact] The reviewed changes appear safe to merge; no actionable issues were found. SummaryMoves Paykit server account loading out of node construction and into background work after startup.
Verification: Reviewer model: gpt-6.1-sol Reviews (1) · Last reviewed commit: "fix: stop the account load once the node..." · Reviewed by Greptile |
The check before the account load now reads the store under the lifecycle lock, so an approval that began before the node ran counts. Each load failure is logged once, unload failures are logged too, and "Loaded Paykit Server accounts" logs only while the node is current. The approval-before-node-starts journey no longer expects the build log line, since the build loads no accounts. Verified: xcodebuild test (LightningServiceConfigTests, WatchOnlyAccountServiceTests, BackgroundTimeTests, PubkyAuthApprovalSheetTests), swiftformat --lint
talosmachina
left a comment
There was a problem hiding this comment.
No findings. Builds the node without the Paykit Server accounts and loads them into the running node after start, in a detached task holding background time, retrying transient failures while the same node runs. Reviewed 357038b, full tier, static: per the repo's Bitkit rules iOS is not built on this reviewer's Linux host, so this is reasoned from the code and CI.
What I checked, and 5 candidates I ruled out
Read in full: the diff of LightningService.swift (start, sync, setWatchOnlyAccountTracking, loadWatchOnlyAccountsInBackground, loadWatchOnlyAccounts, isRejectedPaykitServerAccount, reconcileWatchOnlyAccountTracking), LightningServiceConfigTests.swift, the AGENTS.md and changelog additions.
Call sites traced: WatchOnlyAccountManager.reconcileTracking / setTrackingEnabled / beginSetupAuthorization, WatchOnlyAccountStore.reconciliationSnapshot / finishReconciliation, BackupService restore into the store, WalletViewModel.start and its own sync, ServiceQueue error wrapping, AppError(ldkError:).
ldk-node at the pinned 0.7.0-rc.85 (3f45b8e): Wallet::add_onchain_wallet_account, NodeMetrics::get_wallet_sync_timestamp, collect_additional_sync_requests, Electrum sync_onchain_wallet.
CI at review time: SwiftFormat, validate and Greptile green; Run Tests, Run Integration Tests and build-local still pending.
Ruled out
- Rejected xpub retried forever: ldk-node returns
Error::InvalidSeedBytesfor a mismatched xpub,ServiceQueuewraps it inAppErrorwithunderlyingErrorset, andisRejectedPaykitServerAccountunwraps it, so the loop stops; a transient error is rethrown ahead of it, as the comment says. - Accounts loaded after start miss their history: derived-account scan completion is runtime-only in ldk-node (
get_wallet_sync_timestampreturnsNoneforaccount_index != 0), so each runtime registration full-scans on the next sync, the same as a build-time account. - Post-load sync joins an in-flight sync and skips the new accounts: possible when it lands during
WalletViewModel.start's own sync, but the 10 s background wallet sync reads the account list again, so the accounts are picked up a cycle later rather than lost. - Load into a stopped or replaced node:
isCurrentcompares node identity before each attempt and before the sync, andreconcileWatchOnlyAccountTrackingchecksself.node === nodearound and inside every LDK hop. - Toggle or approval racing the background load: both go through
WatchOnlyAccountManager.lifecycleCoordinator, whichreconcileTrackingalso holds, andsetWatchOnlyAccountTrackingwith no node still only stores, which the load after the next start picks up.
Merge confidence: 4/5, static review only (iOS not built here) and the unit and integration jobs had not finished.
Reviewer model: claude-opus-5-5
Reasoning effort: Not exposed
Metadata note: the run exposes the model id; it does not expose a reasoning-effort setting.
The account reconcile throws when the node is stopped or replaced between hops, so pending unloads are kept for the next node instead of cleared. The loader holds the node weakly, checks it before each retry, and a repeated start of a running node keeps the loader it has. An invalid xpub is no longer retried. Adds tests for the snapshot lock wait, the skipped sync and the failure order, and corrects the companion claims doc and the AGENTS.md background work example. Verified: xcodebuild test (LightningServiceConfigTests, WatchOnlyAccountServiceTests, BackgroundTimeTests, PubkyAuthApprovalSheetTests), swiftformat --lint
|
QA for f9da6d5: 🟢 J1, 1. Cold start, 2. Close right after start, 3. Toggle trackingJ1: approval-before-node-starts With VSS held, the setup URL cold-started the app and Approve and Authorize ran before the node started. The success screen showed with no error toast, and the account's tracking was stored without a node. Once VSS was released, account 1 loaded 0.6 s after the node started, and the list shows one account at m/84'/1'/1' with tracking on.
1. Cold start With three tracked accounts, the node built in 24 ms and started without them; all three loaded within 0.8 s of start.
2. Close right after start The app was terminated 0.25 s after the node started, before any account loaded. On reopen all three accounts loaded, and Savings shows the 70,000 sats held by account 1.
3. Toggle tracking Tracking on, off and on again: Savings went to 70,000, then 0, then 70,000.
|
Closes #1583
Twin: synonymdev/bitkit-android#2248
Description
BackgroundTime,beginBackgroundTask), so the load keeps going when the app closes right after start; a transient failure retries every 15 s while the same node runs, a rejected xpub does not, and the wallet syncs afterwardssync(), which the load after start replacesDocs/pubky-auth-companion-claims.md, which said the accounts load before the node startsAGENTS.mdrule: network work that must survive the app closing runs in a detached task withBackgroundTime, andBGTaskSchedulerfor work that must run later while the app stays closedOut of Scope
Design
N/A — no UI changes.
Preview
N/A — no user-visible changes.
QA Notes
Setup
Journeys
journeys/pubky-marketplace/approval-before-node-starts.xml— route changed: an account approved before the node starts now loads after start instead of at build; step 22 now expects only "Registered derived on-chain wallet account"Manual Tests
Loaded Paykit Server accountslogs shortly afterNode startedAutomated Checks
LightningServiceConfigTests.swift,WatchOnlyAccountServiceTests.swiftxcodebuild test(LightningServiceConfigTests,WatchOnlyAccountServiceTests,BackgroundTimeTests,PubkyAuthApprovalSheetTests),swiftformat --lintEvidence
Gaps
Models used
Claude Opus 5.5(reasoning:medium)Claude Opus 5.5(reasoning:medium)Gemini 4 Neon(reasoning:high)