feat(web): auto-retry transient "Cannot reach Maple API" errors#250
Merged
Conversation
Network blips previously failed straight to the error UI and stuck there until a manual reload: transport errors were explicitly excluded from the HTTP clients' retry predicates, and nothing ever re-probed a failed atom. HTTP layer: both atom clients now retry transient transport failures via a shared retry policy — up to 3 extra attempts with 300ms/600ms/1.2s backoff, idempotent methods only (mutations never replay), excluding the 45s client timeout and aborted requests. The existing 5xx retries gain the same backoff. UI layer: formatBackendError tags connectivity failures with kind: "network", and a new useNetworkAutoRetry hook probes on a jittered 5s→10s→20s→30s backoff plus immediately on the window `online` event / tab-visible, pausing while hidden or offline. ErrorState shows "Retrying automatically…" and RouteError self-recovers route-loader failures; the manual "Try again" button stays as an instant probe. Verified end-to-end: killed the API mid-session, watched GETs retry with backoff and POSTs fail fast, then restarted the API and the dashboard repopulated with zero user interaction. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
|
Your Pullfrog Router balance is exhausted. You have a card on file but auto-reload is disabled, so runs paused once your balance went past the overdraft buffer. Top up balance → · Enable auto-reload →
|
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.

What
Makes transient connectivity failures ("Cannot reach Maple API") recover automatically instead of sticking until a manual page reload.
Why
Users frequently saw the error persist even though reloading fixed it — the failures are transient. Two gaps caused this:
HttpClient.retrypredicates explicitly excluded transport errors (only 500/502/503 retried).How
HTTP layer — new shared
retry-policy.tsused byatom-client.tsandv2-atom-client.ts:TimeoutError) and aborted requests are excluded so a hang isn't multiplied.UI layer —
formatBackendErrornow tags connectivity failures withkind: "network"; a newuseNetworkAutoRetryhook (no-useEffect convention,useMountEffect+useEffectEvent) probes:onlineevent or when the tab becomes visible again,ErrorStateauto-probes whenever a retry callback exists and appends "Retrying automatically…" to the copy;RouteErrorgets the same treatment for route-loader failures. The manual "Try again" button stays as an instant probe.Reviewer notes
/api/query-engine/execute), so they intentionally skip the HTTP-layer replay; they recover via the UI-layer probe re-running the query atom (verified working).InvalidUrlErrorkeeps the same error copy but is not taggednetwork— a bad URL never self-heals.Testing
kind: "network"assertions inerror-messages.test.ts; method-scoping + timeout-exclusion inretry-policy.test.ts. Full apps/web suite: 97 files / 738 tests pass.bun typecheckclean.🤖 Generated with Claude Code
Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.