Skip to content

fix(desktop): replace a stale staged update with the newest release - #8186

Merged
waleedlatif1 merged 3 commits into
stagingfrom
fix/desktop-update-redownload
Sep 23, 2026
Merged

waleedlatif1 merged 3 commits into
stagingfrom
fix/desktop-update-redownload

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Once an update reached ready, the updater stopped checking. A shell left running across several releases installed the stale staged build on restart, then immediately offered the next one — so users updated twice in a row
  • ready updates now keep re-checking on the normal cadence; a strictly newer release downloads in the background and replaces the staged one (Squirrel.Mac keeps the staged bundle while re-checking, and relaunchToInstallUpdate installs whatever is staged, so restarting mid-replacement stays safe)
  • Background re-checks never clobber a ready/available update: equal versions, update-not-available, network errors, and failed replacement downloads all keep the current update
  • available offers (auto-download off, and manual-download builds) also refresh to the newest release so "Update" never fetches a superseded version
  • Restart confirmation installs whatever is staged instead of dropping the click when a replacement finished while the prompt was open
  • Known Squirrel.Mac limitation, unchanged: a reboot before quitting drops the pending ShipIt job, so the same version is offered again on next launch (served from the updater cache, no network download)

Type of Change

  • Bug fix

Testing

  • Added state-machine tests for replacement, re-check failure/no-op, auto-download off, prompt race, and manual-mode refresh; 4 fail without the fix
  • Desktop suite (1663 tests), tsc, lint, and check:audits pass

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

🤖 Generated with Claude Code

@vercel

vercel Bot commented Sep 23, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Sep 23, 2026 2:11am UTC

Request Review

@cubic-dev-ai cubic-dev-ai Bot 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.

All reported issues were addressed across 3 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread apps/desktop/src/main/updater.ts Outdated
Comment thread apps/desktop/src/main/updater.ts Outdated
@greptile-apps

greptile-apps Bot commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge; no outstanding correctness, security, or repository-rule violations remain.

Summary

This PR keeps staged and offered desktop updates refreshed so users install the newest eligible release rather than a stale update.

  • Periodically re-checks staged and offered updates while preserving the existing update on no-op checks and failures.
  • Uses Squirrel.Mac’s native staging event to distinguish downloaded replacements from installable bundles.
  • Keeps restart confirmation valid when a replacement finishes staging while the prompt is open.
  • Adds state-machine coverage for replacement, cancellation, rollback, failure, and manual-download behavior.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart TD
  Offered[Offered or staged update] --> Check[Scheduled feed re-check]
  Check --> Invalid{Valid eligible release?}
  Invalid -->|No or check fails| Preserve[Preserve current offer or staged bundle]
  Invalid -->|Yes| State{Current state}
  State -->|Available| Refresh[Refresh offer to feed candidate]
  State -->|Ready and strictly newer| Download[Download replacement]
  Download --> Native[Squirrel stages replacement]
  Native --> Ready[Mark replacement ready]
  Ready --> Restart[Install staged bundle on restart]
Loading

Reviews (3) · Last reviewed commit: "fix(desktop): clear a cancelled update r..."

Comment thread apps/desktop/src/main/updater.ts Outdated
Comment thread apps/desktop/src/main/updater.ts Outdated
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot 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.

All reported issues were addressed across 4 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread apps/desktop/src/main/updater.ts
Comment thread apps/desktop/src/main/updater.ts
Comment thread apps/desktop/src/main/updater.ts
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot 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 issues found across 4 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit fb2c3f3 into staging Sep 23, 2026
37 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/desktop-update-redownload branch September 23, 2026 02:18

This branch was previously deployed

1 inactive deployment
Preview c39021d4 Deployed Sep 23, 2026 by vercel[bot]
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