fix(CI): retry on transient wallet desync during commit#1570
Merged
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e675a9a. Configure here.
After org creation, the wallet temporarily desyncs while processing on-chain confirmations. The middleware assertWalletIsAvailable check and test commitStagedRecords both failed instantly with no retry, causing spurious CI failures. Server-side: assertWalletIsAvailable now retries up to 5 times (25s) when the wallet is reachable but not synced, while still failing fast on connection errors (checked on every retry iteration). Test-side (V1): commitStagedRecords retries up to 5 times (50s) on wallet availability/sync errors before giving up. V2 already has createRetryableRequest at the transport layer handling this, so the V2 commitStagedRecords is left unchanged.
e675a9a to
8390ac9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
After org creation, the wallet temporarily desyncs while processing a burst of on-chain confirmations (store creation, mirror adds, data pushes). Two code paths failed instantly with no retry, causing spurious live API test failures:
Server-side (
src/utils/data-assertions.js):assertWalletIsAvailablein the middleware rejected non-GET requests immediately whenwalletIsSynced()returned false — even for transient desync. Now retries up to 5 times (25s total) when the wallet is reachable but temporarily not synced, while still failing fast on connection errors (ECONNREFUSED etc.).Test-side (
tests/{v1,v2}/live-api/helpers/live-api-helpers.js):commitStagedRecordsthrew on the first non-200 response with no retry. Now retries up to 5 times (50s total) when the commit fails due to wallet availability/sync errors, matching the retry pattern already used in org creation tests.Root cause from CI run #2429
POST /v1/staging/commithit middleware,assertWalletIsAvailablefailed in 16msTest plan
Note
Medium Risk
Adds retry/backoff behavior to wallet availability checks and V1 live-api commit helper, which can change request latency and error timing when the wallet is unhealthy. Scope is limited to wallet gating and test helpers, but it affects a core prerequisite for write operations.
Overview
Reduces flaky failures when the Chia wallet is temporarily desynced after bursts of on-chain activity by adding bounded retries instead of failing immediately.
On the server,
assertWalletIsAvailablenow distinguishes connection failures from transient sync lag and retrieswalletIsAvailable()up to 5 times (5s delay) before throwing. In V1 live API tests,commitStagedRecordsnow retriesPOST /v1/staging/commitup to 5 times (10s delay) only when responses look like wallet availability/sync errors; V2’s commit helper is left without an extra wrapper since its request layer already retries.Reviewed by Cursor Bugbot for commit 8390ac9. Bugbot is set up for automated code reviews on this repo. Configure here.