Skip to content

fix(update): refuse a stage or offer from a channel the user left - #33771

Merged
bolichen97 merged 1 commit into
mainfrom
crew/mate/update-stage-lane
Nov 9, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
crew/mate/update-stage-lane

Conversation

@cixuuz

@cixuuz cixuuz commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: a desktop update never installs or downloads a build from a release channel the user has left, even when the newly chosen channel's feed is down or slow.

The freshness gate refuses a staged build from a channel the user stopped following only when the switch happens during the gate's own wait. Switch from insider back to stable while offline, then click "Install Update & Restart App" or quit after "Later": the gate's check on stable fails, fail-open installs what is staged, and that is the insider build. A Download click on an insider offer after the same switch downloads the insider build.

Three smaller defects in the same code: a Retry after a recovered installer failure exits on Cmd+Q without installing, the quit-time notice for a channel refusal says the update was "withdrawn or superseded", and the Electron tests hard-code the 8s bound, so changing it makes about thirty tests hang instead of fail.

Why it matters

Anyone who changes channel while offline or on a slow network, with an update already downloaded, gets the channel they left: a stable user on an insider build, or the reverse, and another update cycle to get back. The fail-open rule exists so a network outage never strands bytes the user chose; it was never meant to install bytes from a channel they turned away from. The quit notice then states a reason that is false, the Retry gap turns the user's Cmd+Q into a quit with the update not installed, and the hard-coded bound turns a future change to it into a CI job that never finishes.

Not a goal

What changed (motivation → approach → change)

Every build the lane can install now carries the channel whose feed served it, and one guard refuses a build from a channel the install no longer follows.

Symptom Root cause Change
fail-open installs or downloads the old channel's build after a switch made before the click the guard compared only the channel the judging check was sent to, every check re-points that first, and the stage and the offer recorded only a version feed-lane.js records the channel on the offer and on the stage; refuseFromChangedChannel in freshness-gate.js refuses when that channel, or the check's, is not the selected one, on every exit of verifyStageIsLatest and in the Download gate
a refusal reads "withdrawn or superseded" on quit the channel refusal reused the superseded verdict a channel-changed verdict, and an "Update not installed" notice that names the channel change
a Cmd+Q during a Retry quits without installing the dispatch removes the before-quit listener, and an installer failure does not put it back applyUpdateAndRestart arms the listener, once, when it starts
a change to the 8s bound hangs the Electron suites they tick 8 * 1000 they tick FRESHNESS_CHECK_TIMEOUT_MS, and one test pins its value

A promoted release is the same build on both channels, so when the selected channel's check confirms the staged version, it takes the stage over and the install proceeds. docs/build/release.md lists the fourth outcome, the Download gate's channel rule and the quit notices, and names updates_step_up.py as the arm endpoint's home.

Backwards compatibility

Compatible: the updater's IPC surface and the states it pushes to the renderer are unchanged; the new verdict lives inside the feed lane, and the only new copy is one native notification.

The gate object stops exporting refuseStageFromChangedChannel and exports refuseFromChangedChannel, which takes the build's channel, in its place. On main nothing outside freshness-gate.js called the old export (git grep over website/electron, tests included); the Download gate in feed-lane.js is the first outside caller of the new one.

Reader: website/electron/runtime/update/freshness-gate.js:verifyStageIsLatest -- release -- still calls refuseStageFromChangedChannel, directly and through stageVerdict, now a file-local wrapper over refuseFromChangedChannel -- auto-update-freshness.test.js, auto-update.stage-lane.test.js

Tests

  • website/electron/test/auto-update.stage-lane.test.js (new): a stage from the channel the user left is not installed when the selected channel's feed fails or hangs past the bound, nor on quit, where the notice names the channel change; a Download click on an offer from the left channel asks the selected channel instead; a stage the selected channel also serves still installs; a Retry after a recovered installer failure holds a quit pressed during its gateway stop; the bound is 8s.
  • auto-update-freshness.test.js, auto-update.feed-lane.test.js: tick FRESHNESS_CHECK_TIMEOUT_MS. With the bound changed to 9s or to 5s, only the test pinning the 8s value fails (353 of 354 pass). The same 9s change without this PR fails 31 of 347, 22 of them by hanging until the 20s test timeout.
  • With feed-lane.js and freshness-gate.js reverted to origin/main, five of the new tests fail; the bound pin and the same-build install pass on both, as they should.
  • Electron update suites (test/auto-update*.test.js, test/electron-updater-error-identity.test.js): 354 passed.
  • Determinism: the new and changed files (auto-update.stage-lane, auto-update-freshness, auto-update.feed-lane, 120 tests) passed 20 runs in a row one file at a time, 10 runs at --test-concurrency=4 beside auto-update-install-timing.test.js and electron-updater-error-identity.test.js, and one run with --test-randomize --test-random-seed=1008851110.
  • Local backend scoped tests: 84 failures, and every one also fails on a clean main worktree run with the same settings. The worktree and pytest's basetemp sit inside ~/.kiro/crew, where the product refuses to serve files, so these are the environment, not this change; CI decides.

Proof: not provable -- frontend test (prove.py runs Python only)

Manual verification

The only new user-visible surface is a native OS notification drawn during quit, after the window is gone, so no browser capture can frame it. Its copy, pinned by the quit test above:

Title Body Fires when
Update not installed You changed the update channel, so the update downloaded from the previous channel was not installed. You'll be offered your channel's version next launch. the quit-time gate finds the stage came from a channel the install no longer follows

Screenshots / video

N/A: this diff changes no renderer surface; the new native notification's copy is listed under Manual verification.

Related Issues

Closes #33718

Related: #33721 tracks the side-effect-free feed read deferred from #21979 (#10333, which it was deferred to, closed as not planned; #22825 covers only the phase enum).

Sibling sweep

Swept: git grep -nE "feedChannel|currentChannel()" -- website/electron/runtime/update/
Sibling: website/electron/runtime/update/freshness-gate.js -- changed here
Sibling: website/electron/runtime/update/feed-lane.js -- changed here
Sibling: website/electron/runtime/update/state-reporter.js -- not affected -- recordLaneVersion stores the channel the fetch was sent to and compares it with currentChannel() at read time

Pattern harvest

Rule candidate: review-prompt
Pattern: a guard on where a cached artifact came from that compares the latest request's target instead of provenance recorded on the artifact when it was fetched

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@cixuuz
cixuuz requested review from a team and KiroCrewCaptain as code owners November 9, 2026 07:14
@cixuuz
cixuuz requested a review from Zedmor November 9, 2026 07:14
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 9, 2026
@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 987fa1dfa23406ace832625d2eef9d2a2fb458a5 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: recording the channel on each offer and stage, then checking it in one guard, fixes the root cause the description names, and both callers of the gate handle the new channel-changed verdict.

Notes

  • The Retry quit-hold fix in applyUpdateAndRestart is a separate defect riding along. The description declares it, but it would revert more cleanly as its own commit.

[DESIGN-REVIEWED] 987fa1d

Description read

[DESCRIPTION-READ] fbc16c7894eafd3611d5d55f02216f9edaeb5df70986e1e56c64673946f292f5

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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of 987fa1dfa23406ace832625d2eef9d2a2fb458a5 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

This PR adds no renderer control. The only new surface is one native quit-time notice with no buttons, and the description quotes its text in full. That text says what happened and what comes next.

Notes

  • An OS-level screenshot of the "Update not installed" notification (e.g. macOS Notification Center) would let the blind read run on it. A browser capture can't frame it, but an OS screenshot can.
  • The body says "the update downloaded from the previous channel". The code knows which channel the stage came from, so name it: "…the Insider update you downloaded was not installed. You'll be offered the Stable version next launch."

[UX-REVIEWED] 987fa1d

Description read

[DESCRIPTION-READ] 3bfb059829857a492ee3128547e29a4b940f4f58d9fa0082b1a0cb73c47073c3

That sha256 names everything this verdict read: the PR description, plus the 3 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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 987fa1dfa23406ace832625d2eef9d2a2fb458a5 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

Nothing blocks: the channel guard is fixed where the defect comes from (a stage or offer with no record of its source channel), under linked issue #33718. The riders are small, declared, and each fixes a bug of its own.

Notes

  • Item 6 — rides along: the Retry before-quit re-arm is a separate defect bundled into a channel fix ("Three smaller defects in the same code"). Subtraction: none needed. It has its own failing test, but it could ship on its own.

What this change ships

Inventory (8 items) — 5 justified

Intent: a desktop update never installs or downloads a build from a release channel the user left, even when the new channel's feed is down. This is a FIX.

  1. Clicking Install, or quitting after "Later", no longer installs a staged build from the channel the user left when the selected feed fails or hangs — justified
  2. A Download click on an offer from the channel the user left re-checks the selected channel instead of downloading — justified
  3. A promoted release that the selected channel also serves still installs, because the stage moves over to that channel — justified
  4. A new quit notice, "Update not installed", that names the channel change instead of "withdrawn or superseded" — justified
  5. New internal verdict channel-changed, handled at both verifyStageIsLatest callers (2 counted) — justified
  6. A Cmd+Q pressed during a Retry after a recovered installer failure is now held, and the update installs — rides along
  7. Electron tests tick FRESHNESS_CHECK_TIMEOUT_MS, with one test pinning 8s — rides along
  8. release.md now points to updates_step_up.py for api_update_arm (checked: it exists there) — rides along

[FIRST-PRINCIPLES-REVIEWED] 987fa1d

Description read

[DESCRIPTION-READ] 9eac1087f1a6a3a1c4abdea6f2683157c7732f498d19bf0950a44a369d3d6d37

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 987fa1dfa23406ace832625d2eef9d2a2fb458a5 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 987fa1d

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 987fa1dfa23406ace832625d2eef9d2a2fb458a5 false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 987fa1dfa23406ace832625d2eef9d2a2fb458a5 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 987fa1d

Verdict parsed from the review's SHA-scoped output markers for commit 987fa1dfa23406ace832625d2eef9d2a2fb458a5.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 987fa1dfa23406ace832625d2eef9d2a2fb458a5 false-positive: <reason, 20 to 500 characters>

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 9, 2026
@cixuuz
cixuuz force-pushed the crew/mate/update-stage-lane branch from 858f7ba to 3d1aa05 Compare November 9, 2026 10:53
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Nov 9, 2026
The desktop freshness gate refused a build from a channel the install
no longer follows only when the switch landed during its own wait: every
check re-points the feed's channel first, and nothing recorded where the
staged bytes or the offer came from. A switch made before the click,
followed by a feed that fails or hangs, let fail-open install or
download the old channel's build.

The offer and the stage now carry the channel whose feed served them,
and one guard compares that, and the channel the judging check was sent
to, with the selected channel. A build the selected channel also serves
is taken over by that channel's check and still installs. The refusal
is its own verdict, so the quit path names the channel change instead
of a withdrawal.

A Retry after an installer failure re-arms the before-quit listener, so
a quit pressed during its wait is held as it is on the first click. The
Electron suites tick FRESHNESS_CHECK_TIMEOUT_MS instead of a copy of it,
and one test pins its documented 8s.
@cixuuz
cixuuz force-pushed the crew/mate/update-stage-lane branch from 3d1aa05 to 987fa1d Compare November 9, 2026 12:27
@cixuuz

cixuuz commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in website/electron/runtime/update/feed-lane.js, website/electron/test/auto-update.feed-lane.test.js since this head went green (941c3bd -> 6cff114); CI re-running. The Electron update suites pass on the rebased head (354 tests).

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Nov 9, 2026

@bolichen97 bolichen97 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.

Approve on 987fa1d. I read the whole diff (874 lines). This closes #33718.

  • Main already refuses a stage when the channel changes during the freshness wait (refuseStageFromChangedChannel). This PR records stagedChannel / foundChannel where the bytes and the offer came from. The same refusal then also covers a switch made before the click. That closes a gap in an existing rule, so it adds no new strictness. Fail-open on the followed channel is unchanged, and the "unchanged channel still installs fail-open" test still pins it.
  • A promoted release that the selected channel also serves takes the stage over (stagedChannel = feedChannel on the same-version branch), so it still installs. That has a test.
  • The new channel-changed verdict and its quit notice replace the false "withdrawn or superseded" text.
  • applyUpdateAndRestart re-arms the before-quit listener with remove-then-once, so a Retry can't register it twice.
  • The suites tick FRESHNESS_CHECK_TIMEOUT_MS, and one test pins 8s.
  • The product code has no regex. The assert.match calls are in tests only.
  • All 98 checks are green, and nobody else has an open change request.

@bolichen97
bolichen97 merged commit 710d5e9 into main Nov 9, 2026
98 checks passed
@bolichen97
bolichen97 deleted the crew/mate/update-stage-lane branch November 9, 2026 14:13
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 9, 2026
bolichen97 pushed a commit that referenced this pull request Nov 10, 2026
…3771)

The desktop freshness gate refused a build from a channel the install
no longer follows only when the switch landed during its own wait: every
check re-points the feed's channel first, and nothing recorded where the
staged bytes or the offer came from. A switch made before the click,
followed by a feed that fails or hangs, let fail-open install or
download the old channel's build.

The offer and the stage now carry the channel whose feed served them,
and one guard compares that, and the channel the judging check was sent
to, with the selected channel. A build the selected channel also serves
is taken over by that channel's check and still installs. The refusal
is its own verdict, so the quit path names the channel change instead
of a withdrawal.

A Retry after an installer failure re-arms the before-quit listener, so
a quit pressed during its wait is held as it is on the first click. The
Electron suites tick FRESHNESS_CHECK_TIMEOUT_MS instead of a copy of it,
and one test pins its documented 8s.

(cherry picked from commit 710d5e9)
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.

Desktop update installs a staged build from a channel the user left when the new channel's feed fails

2 participants