Repository navigation
fix(update): always install the newest build, never a superseded download - #21979
Conversation
UX Review (Opus 5.5, fork) — ✅ PASS (a BLOCK with no Trigger and no Outcome does not block)UX-level review of UX-Verdict: PASS cannot evaluate: missing the new desktop notification "Update not installed — A version check was still running at quit…". The renderer states are all covered by the 12 attachments; no first-time reader has seen any of them, because this lane has no blind read. Evidence gaps
Notes
[UX-REVIEWED] bc5a13e Description read[DESCRIPTION-READ] 0cd6105cfdcb0a977ad2126ccabbb4766907dc8a0609a04c07644e08b2ea1e6b That sha256 names everything this verdict read: the PR description, plus the 15 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS No item blocks. The re-check reuses the existing supersede, direction and retraction handlers, and Notes
What this change shipsInventory (9 items) — 8 justifiedIntent: an update always installs the newest build the feed serves. FIX.
[FIRST-PRINCIPLES-REVIEWED] bc5a13e Description read[DESCRIPTION-READ] 45206e1741663dc924d3d2c392d1e9d209f1d9455c0f315be1dea00c7aae06d6 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: every path that downloads or installs now re-checks the feed through the existing handlers, so the rules for which version wins are not duplicated. Notes
[DESIGN-REVIEWED] bc5a13e Description read[DESCRIPTION-READ] b28bd0c19ad18943cd4690c00dbae5a2f9703a83991536de7e0dabd37f53f756 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
81e0cfd to
4e61162
Compare
|
|
|
|
|
|
|
|
|
4e61162 to
f32b549
Compare
e052e63 to
b0b066f
Compare
|
|
|
Repaired: e052e63 -> b0b066f, rebased onto main 3897633. Both GPT BLOCKING findings on e052e63 are fixed (see the two disposition records): verifyStageIsLatest's timeout/failure exits go through the channel guard, and AboutPanel observes the armed click's |
iamwhatever
left a comment
There was a problem hiding this comment.
Request changes at b0b066f.
- File-size rule.
feed-lane.jsgoes from 780 to 1,663 lines. AGENTS.md requires a change past 1,600 lines to split the file in the same PR. The Design lane raised this on this head and there is no reply. The smallest fix is to move the freshness gate (withinFreshnessBound,verifyStageIsLatest,refuseStageFromChangedChannel,stageVerdictand the abandonment helpers) into a sibling module underruntime/update/and keepfeed-lane.jsas the caller. - Unanswered current-head notes. Please add the
Update deferrednotification to the description's quit-time table (UX). Also name in the description that the removed "no install proceeds with a check outstanding" pin is now narrowed to a versionless stage (First Principles item 3). - Human review needed. Separately,
api_update_armcan now arm a newer version than the one the user clicked (L260), and the quit path holds and replays Cmd+Q around an install. Both touch the update approval and process lifecycle, so a human reviewer should sign off.
The freshness design itself reads sound. Both GPT blockers from e052e63 are fixed with tests, the flag-lattice deferral is tracked in #22825, and CI is green. I read CI and source and ran nothing.
— crew-pr-reviewer (r119)
b0b066f to
8d387f1
Compare
|
Re: review 5610368221 (crew-pr-reviewer r119, head b0b066f). Addressed at 8d387f1 (rebased onto
|
8d387f1 to
ba7868d
Compare
|
Rebased: main moved in the 12 locale catalogs under |
…load The desktop updater committed to an install on `updateReady` alone. Supersede detection lived only in the `update-available` handler, reachable only when a check ran -- every 4 hours. A download that waited (auto-download stages eagerly, then the install waits for a click or the next natural quit) installed whatever had been staged back then: the app relaunched on an already-superseded build, the next check found the newer one, and the ~350MB transfer ran again. The feed lane (website/electron/runtime/update/feed-lane.js) now re-consults the feed as the last step of every path that spends bytes or commits an install: the consent download, the manual install and the deferred install on quit. The gate drives an ordinary check, or waits for the one already in flight (abandoning it if the wait runs out), bounded at 8s and failing OPEN; a verdict about a lane the user switched away from mid-check authorizes nothing. A feed that cannot answer never makes downloaded bytes uninstallable, and a hanging feed cannot hold a quitting app open. Only a positive "the stage is gone" stops an install; a superseded stage is refused and the newest build pursued, and the quit path refuses quietly with a notification. A gate that issues a check is a second writer of updater state, so its collisions with the first are closed explicitly: an abandoned check's late failure is recognised by the rejection object rather than by flag timing; a check straddling an install dispatch has its own failure reported as the check's; a Cmd+Q while an install path owns the stage is held and replayed; a gate (an install, or a Retry of the download) that joins a check an earlier click abandoned lifts the abandonment so its answer still counts; a re-check after a channel switch waits until electron-updater has released its in-flight request, and a second click that wakes behind it stands down; and the gates' own re-checks keep their `checking`, their failure and a restated offer off the renderer, which would unmount the card the user just clicked or the installing overlay. A Download click is answered at once with `downloading`. A failed install recovers in place on the manual path and finishes the quit on the deferred one. The renderer resets its one-way install latch when the main process refuses or aborts the handoff (shared by UpdateModal and the About card through useInstallDispatch), so the newer build's Install button is not left disabled, and the modal reports a rejected install request under a failure header. An agent request's install click stays armed only while it waits for a download, and is released when that download is dropped (a retraction or a channel switch), so it cannot re-fire on a later build. A click made while the state is already `checking` or `not-available` is not a dropped download: only those states after the click's own `downloading` release it. On the dashboard, `api_update_arm` re-checks before arming and returns `version_display`. The re-check fails open by restoring the pre-check snapshot only while `_check_generation` still matches, so a channel switch cannot resurrect the previous lane's verdict. A positive "no longer offered" answers `arm_no_longer_offered`, and an upgrade click the re-check turns into a channel-move downgrade is refused with `arm_offer_withdrawn` rather than armed; the panel localizes both, and only the "no longer offered" notice is retired by a newer offer. Co-authored-by: Bolin Chen <bolichen@amazon.com>
ba7868d to
bc5a13e
Compare
|
Problem / Motivation
Goal: an update always installs the newest build the feed serves, never a download the feed has already moved past.
The desktop app downloads an update, then waits for a click on "Install Update & Restart App" or for the next natural quit after "Later". Nothing in that window re-consulted the feed, so when a newer release shipped the app installed the superseded stage anyway:
1.1.0;1.2.0publishes while the ready card sits unclicked;1.1.0and the app relaunches on an already-stale build;1.2.0and the ~350MB transfer runs again.The consent path (auto-download off) had the same waste: a click on a stale "found" card fetched the version printed on the card. On the dashboard's in-app update,
api_update_armarmed a cached verdict up to 12 hours old, which the apply then refuses once the feed has moved.Why it matters
Every affected user pays the transfer twice and restarts twice, and the second restart looks unprompted: the app they just updated immediately announces another update. On metered or slow links ~350MB of avoidable traffic is the whole cost. The in-app arm path is worse: it hands the user an approval command that cannot succeed.
Not a goal
auto_update, update pauses).What changed (motivation → approach → change)
Root cause. Supersede detection lived only in the
update-availablehandler, which runs only when a check runs (every 4 hours). The install paths committed onupdateReadyalone.Approach. Put the freshness question at the last step of every path that spends bytes or commits an install, and answer it with an ordinary check, so the direction gate, retraction path and supersede path decide, not a second copy of the rule.
Change.
website/electron/runtime/update/feed-lane.js(the feed lane split out ofauto-update.json main): a freshness gate runs before the consent download, the manual install and the deferred install on quit. It issues a check or waits for the one already in flight, bounded at 8s and failing open (a check it stops waiting for is abandoned, so its late outcome cannot touch the dispatch); only a positive "the stage is gone" refuses an install. A Download click is answered at once withdownloading. The quit path signalsinstallingfirst, holds a second Cmd+Q while it waits, and refuses quietly with a notification.website/electron/runtime/update/freshness-gate.js(new, composed by the feed lane): the check lifecycle (claim, settle, abandon, and the two identity-matched rejections) andverifyStageIsLatest, the pre-install verdict.feed-lane.jsreads the check flags through the gate and keeps the handlers, the download gate and both install paths; it is 1,383 lines after the split, under the 1,600 the file-size rule allows. The facadeauto-update.jsis unchanged.finally; a gate that joins an abandoned check lifts the abandonment so its answer counts; a channel switch re-checks the new lane once the old request has settled (reportingcheckingat once on both gates, so a refused click never sits on the stale card while a hung request holds its socket), and a gate that wakes behind a newer check stands down; the gates' ownchecking, failure and restated offer stay off the renderer.check-in-flight, formerly a test inauto-update.feed-lane.test.js) is narrowed, not kept. The gate abandons every check it waits out and promises that install, so the post-stopGatewayabort now fires only for a check the gate did not wait on at all, which is a stage that carries no version (nothing to compare).auto-update-freshness.test.jspins the narrowed rule on both install paths; the straddling-check tests inauto-update.feed-lane.test.jsnow assert that an abandoned check's late answer is inert and its own failure is not reported as the install's.website/src/hooks/useInstallDispatch.ts(shared bywebsite/src/components/UpdateModal.tsxand the About card inwebsite/src/pages/settings/AboutPanel.tsx) resets the one-way install latch when the handoff is refused or aborted; the modal reports a rejected install request throughErrorNoticeunder an "Update failed to install" header. The About card's agent-request click is armed only while its download runs, and is released when the gate drops that download.api_update_arm(src/kiro_crew/dashboard/handlers/updates_step_up.py) re-checks before arming and returnsversion_display(typed inwebsite/src/api/client/updates.ts). A check that cannot reach the feed refuses the arm (arm_no_verdict) and leaves the failed check in the cache for the panel to show: the managed-venv apply fetches the signed manifest before it installs, so an arm the feed cannot confirm is an approval the apply cannot carry out (unlike the desktop, whose staged bytes are already on disk). A positive "no longer offered" answersarm_no_longer_offered, and an upgrade click the re-check turns into a channel-move downgrade answersarm_offer_withdrawn(no "already up to date" claim, since the next frame offers that move).arm_no_longer_offered,arm_offer_withdrawn), in all 12 catalogs underwebsite/src/i18n/locales/.Backwards compatibility
Compatible:
api_update_armkeeps every field and code it returned and addsversion_displayand thearm_no_longer_offeredrefusal; the renderer tolerates a gateway without the field. The updater's IPC surface is unchanged.Tests
website/electron/test/auto-update-freshness.test.js(new): superseded, latest, retracted and versionless stages on both install paths; fail-open on unreachable, silent and hanging feeds; waiting for an in-flight check; the abandoned-check and straddling-check attribution; the held and replayed quit; no nudge or download while quitting; the Download gate's channel switch, joined-check lift and stand-down, againstfeedLikeElectronUpdater(), a harness that models electron-updater's in-flight dedupe.website/electron/test/auto-update.test.js: existing straddle tests drive the 8s bound with mocked timers; the load-time test listsfreshness-gate.jsamong the update runtime's modules and pins which file composes each one (the facade for the lanes and the reporter,feed-lane.jsfor the gate).website/electron/test/electron-updater-error-identity.test.js(new): asserts against the installedelectron-updatersource thaterrorand the rejection carry the same object; fails under CI when the library is missing, and is visibly skipped elsewhere.test/test_update_stepup.py: re-check pins the newest version, a failed re-check refuses and keeps the failed verdict visible, the downgrade refusal, both refusal codes, and the straddling check is joined rather than refetched.website/src/test/AboutPanel.inAppApply.test.tsx: armed copy, the click-time offered version, an older armed build, both localized refusals, and which notice a new offer retires.AboutPanel.agentUpdateRequest.test.tsx: the agent-request click installs once, and is released by a dropped download but not by the state it was clicked from.AboutPanel.installFailureReplay.test.tsxandUpdateModal.cov80.test.tsx: the latch re-arms after a refused install, and a rejected install request is reported.Each fix added in the last two rounds was mutation-checked: reverting it fails its test.
Manual verification
The armed panel was captured against the built SPA with the gateway stubbed by
website/scripts/capture-update-freshness-armed.mjs. Its copy is unchanged by the latest round; the refusal now renders from the catalog with the same English text. The native notifications on the install-on-quit path are drawn by the operating system's notification centre; the three quit-time ones fire during quit, after the window is gone, so neither the browser harness nor a running window can show them, and a mock-up would be evidence of a surface nobody could verify. Their copy is listed verbatim below.main; it now goes through the sameshowNoticehelper as the three belowScreenshots / video
The offer, from a verdict up to 12h old:
Armed after the pre-arm re-check found a newer version; the note replaces the plain line and explains the change:
Armed on the version the button offered; no note, one declarative line:
The arm button while the re-check runs:
The refusal when the offer is gone (now rendered from the catalog):
The refusal when the clicked upgrade became a channel-move downgrade; it names the withdrawal and the offer that replaces it, and stays up when that offer arrives:
Channel move, armed as offered (
armed_switches_to_version):Channel move whose target moved between the offer and the arm (
armed_version_changed_channel_move):The desktop "update ready" modal when the install request itself is rejected (the main process threw before pushing any state). The header and the notice both say it failed, and the primary action says it retries:
Dark mode
Related Issues
No linked issue: reported directly by a user in a chat session. Follow-up refactors: #22825 (replaces #10282), #10333.
Continues #9367 from a fork: the author's account lost push access to this repository, so that PR could not take the rebase. Same single commit, rebased onto current
main; its review thread and dispositions stay on #9367.Pattern harvest
Rule candidate: review-prompt
Pattern: a bounded wait (
Promise.raceagainst a timeout) that clears flags owned by the request in its timeout branch. The wait ended; the request did not, so its late outcome lands in a window the code believes is impossible. Release request-owned state from the request's own continuation.Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)