Skip to content

Fail pull with a visible error when a backup is already in progress on the remote site - #4315

Draft
epeicher wants to merge 2 commits into
trunkfrom
stu-2098-pull-hangs-silently-with-no-backup-id-found-when-a-backup-is
Draft

Fail pull with a visible error when a backup is already in progress on the remote site#4315
epeicher wants to merge 2 commits into
trunkfrom
stu-2098-pull-hangs-silently-with-no-backup-id-found-when-a-backup-is

Conversation

@epeicher

Copy link
Copy Markdown
Contributor

Related issues

  • Related to STU-2098 (the server-side half — rejecting deduped backup requests with a 409 — ships separately)

How AI was used in this PR

The investigation and implementation were done with Claude Code: it traced a customer's No backup ID found log line through the pull flow to the backup dedupe response, cross-checked the diagnosis against the site's backup history and the server-side findings, and wrote the fix plus tests. The code was reviewed by the PR author.

Proposed Changes

When a pull is requested while the remote site already has a backup queued or running, the backup service dedupes the request. Studio treated that as a successful start, then silently stopped polling — the pull sat at "in progress" forever with no error, and the only trace was a No backup ID found log line. Users hit this by restarting Studio mid-pull (losing the in-memory backup ID) and retrying while the original backup was still running server-side.

With this change the pull fails fast instead of hanging: the user gets a dialog explaining that a backup is already in progress for the site and to retry in a few minutes, and the pull enters the normal failed state so it can be retried. Both server response shapes are handled — the current 200 with backup_id: 0 and the upcoming 409 with code: backup_already_in_progress — so behavior is identical across the server rollout. The 409 is an expected transient condition and is not reported to Sentry.

As a defensive measure, the backup-status poller now also surfaces an error and marks the pull failed if it ever finds no backup ID, instead of silently abandoning the operation.

Testing Instructions

  • npm test -- apps/studio/src/stores/tests/sync-operations-slice.test.ts — covers the valid-ID happy path, both "backup already in progress" response shapes, and the poller guard.
  • Manual reproduction (against current production servers): connect a site and start a pull, quit Studio while "Initializing remote backup…" is shown, reopen it, and immediately pull the same site again.
    • Before: the second pull hangs at "in progress" indefinitely; the log shows No backup ID found.
    • After: an error dialog reports that a backup is already in progress and suggests retrying in a few minutes; the pull shows the failed state and can be retried. Retrying after the remote backup finishes (a few minutes; visible in the site's backup activity) succeeds.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

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.

1 participant