Skip to content

fix(app): re-enable Check now after an update install fails - #4745

Merged
yomgui merged 4 commits into
devfrom
e2e/settings-check-now-after-failed-install
Sep 11, 2026
Merged

yomgui merged 4 commits into
devfrom
e2e/settings-check-now-after-failed-install

Conversation

@yomgui

@yomgui yomgui commented Sep 10, 2026

Copy link
Copy Markdown
Member

Root cause

Follow-on of triage cluster 7/K (reports/e2e-red-2026-09-09/triage.md, "Dismiss-then-notSee races") and the trace in #4724: once dismissal is synchronous, background-desktop-update test 1 fails later at the install-failure loop added by #4714 (merged as Verification — Incomplete, spec never executed): click({role:"button", text:"Check now"}) finds the Settings button visible=true, hitTestOk=false for 30 s.

Reproduced with a probe (local Electron, cherry-pick of #4724 on top of origin/dev). Sequence after Restart & update fails:

  1. installUpdateAndRestart sets updateStatus = { state: "error", failedAction: "install" } — the button is enabled at this point.
  2. world.openSettings() mounts the Settings route → useDenSession's syncCurrentDenSettings → writeDenSettings → denSettingsChangedEvent → DesktopConfigProvider bumps settingsVersion → signed-out branch applies DEFAULT_DESKTOP_CONFIG. The spec had injected custom branding through the dev bridge just before, so this re-apply has actions (brandAppName, brandLogoUrl cleared; document.title "Studio" → "OpenWork") and the config object identity changes.
  3. useElectronUpdaterState's auto-check effect depends on that identity (via resolvePolicyReleaseChannel → runCheckForUpdates) and re-runs, calling check(). check() only skipped checking | downloading | ready; the status was error, and >15 min of mocked time had passed since the last automatic check, so it ran runCheckForUpdates(undefined, false) → available → auto-download → downloading with the mock's finishDownload unresolved → Check now disabled (updateState === "downloading").

The same happens for any real trigger (window focus/online/interval) after a failed install: the update is already downloaded, so a background re-check just re-downloads it and re-offers the same restart.

What changed

  • electron-updater-state.ts: the automatic check additionally skips state === "error" && failedAction === "install". Download failures are unchanged; manual Check now and the native menu request still run in that state.
  • background-desktop-update.e2e.test.ts (claims re-expressed, nothing loosened):
    • The install-failure loop now calls world.returnToApp() (focus + online, +16 min) before opening Settings, then asserts Settings shows Couldn't install the update and that checks/downloads did not move — the observable form of "a failed install does not restart the download loop; the person retries from Settings". This step is red on dev and green here.
    • The custom-branding claim (customLogoLoaded, Restart Studio?) moves to the final confirmed restart, where it sat before fix(desktop): wait for native update readiness before restart #4714. The eval injects branding through the dev-only desktop-config bridge for a signed-out app, and that injection does not survive the Den settings sync that opening Settings performs (step 2 above), so asserting Restart Studio? inside a loop that visits Settings was never satisfiable. The failure loop asserts the default Restart OpenWork? prompt instead; the brand claim is still asserted once, as before.
  • Includes fix(app): close the restart prompt and command palette synchronously on dismiss #4724's commit a42676ec1 (fix(app): close the restart prompt and command palette synchronously on dismiss) as an unmodified cherry-pick (b2527b337): the spec cannot reach the failing step without it. Those two files are untouched here; once fix(app): close the restart prompt and command palette synchronously on dismiss #4724 lands on dev the cherry-pick becomes a no-op in this diff.

Proof

pnpm evals:e2e background-desktop-update --daytona with OPENWORK_EVAL_REF=2df0042ea5ac11f36754b346086360d12da7c7d9 (sandbox log: HEAD is now at 2df0042e test(evals): prove a failed install …):

  • placement: {"command":"evals:e2e","lane":"e2e","daytona":true,"placement":"daytona","engine":"legacy","surface":"legacy","case":null,"vision":"defer","files":["background-desktop-update"],"passed":2,"failed":0,"skipped":0,"skips":[],"consented":["OPENWORK_EVAL_E2E_TESTS"],"verdict":"passed"}
  • ✓ updates download outside Settings and offer a persistent, optional restart (175 s) — trace shows both see(text=Couldn't install the update) → click(text=Check now) → eventually(the user re-downloads after the failed install through Settings) iterations passing, then see(text=Restart Studio?) and eventually(restart only after confirmation).
  • ✓ a confirmed update relaunch resumes only the unfinished task on its original engine (259 s)
  • Verdict: Passed (2 passed / 0 failed / 0 skipped). All three sandboxes of the run were deleted by the testkit.

Also: pnpm --dir apps/app typecheck exit 0.

Noticed, not touched

  1. The automatic check's check() runs on every effect re-run (any dependency identity change), not only on mount/focus/online/interval. The 15-minute guard hides this in practice; it surfaced here because the world advances Date.now. Left as is.
  2. Local lane on macOS cannot run this spec: [data-sidebar-brand]/Notifications are not rendered in the collapsed mac layout, the titlebar Restart to update is covered by Toggle Sidebar, and CDP clicks fire window focus events when the Electron window is not frontmost (which trigger automatic checks). Daytona is unaffected.
  3. After a download failure (failedAction: "download") the next focus/online/interval trigger still auto-retries and auto-downloads. Loop 1 of the spec passes only because no such trigger occurs between the failure and Check now; the spec does not claim otherwise.
  4. Signed-out apps re-apply DEFAULT_DESKTOP_CONFIG on every Den settings sync, so a dev-bridge-injected desktop config (any eval using __openworkApplyDesktopConfig without a sign-in) is cleared when Settings opens.

…on dismiss

Base UI keeps a dialog popup mounted (and partially opaque) until its exit
animation or transition finishes, so the restart prompt and the command
palette stayed visible for 100-200 ms after Keep working / Escape. Hide the
popup with display:none as soon as it is closed; Base UI then unmounts it on
the next frame.
After a failed install the updater status is error/install, which the
automatic check treated like idle: the next focus/online/interval trigger
(or an effect re-run once the 15-minute window had passed) re-checked,
auto-downloaded the same update and left Settings' Check now disabled
behind "Downloading update…". The update is already downloaded, so a
background re-check cannot fix an installer failure; keep the failure and
let the person retry from Settings.
…ownload loop

Return to the app after the check interval before retrying from Settings,
and assert Settings still shows the install failure with no new download.
Apply the custom branding only for the final confirmed restart: the eval's
dev-bridge branding does not survive the Den settings sync that opening
Settings performs for a signed-out app (the failure loop visits Settings).
@vercel

vercel Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated
openwork-app Ready Ready Preview Sep 10, 2026 4:28pm UTC
openwork-den Ready Ready Preview Sep 10, 2026 4:28pm UTC
2 Skipped Deployments
Project Deployment Actions Updated
openwork-diagnostics Ignored Ignored Preview Sep 10, 2026 4:28pm UTC
openwork-landing Ignored Ignored Preview Sep 10, 2026 4:28pm UTC

@github-actions

github-actions Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Warden review summary — Clear

Native findings: 0. Blocking policy matches before consolidation: 0. Full finding text remains in Warden's native checks and review threads. This comment retains only native IDs, severity, skill attribution, and safe locations. Analysis run

Reported trigger coverage (not proof of complete repository or context coverage): diff-security-review (13779 ms), confidentiality-review (13956 ms), spec-provenance-review (23661 ms), desktop-den-sync-review (17887 ms).

Blockers

  • None.

Advisories

  • None.

Needs recheck

  • None.

Observed review-thread metrics

  • Unique observed run attempts in retained window: 2
  • Distinct heads in retained window: 2
  • Current unresolved Warden threads: 0 of 0 observed
  • Observed resolved/unresolved transitions in retained snapshots: 0 / 0
  • First observed resolved/unresolved (state at first collection, not event time): 0 / 0
  • Precision: unavailable (no adjudications; no TP/FP values are inferred)
  • Observation window: 2/20 run attempts retained; truncated: false
  • Transition snapshot: 0/0 current attributed threads retained (limit 500); truncated: false

Thread states are read-only collection snapshots. These metrics are neither lifetime totals nor exact resolution times, and this summary is not clearance authority.

diff-warden[bot]
diff-warden Bot previously approved these changes Sep 10, 2026

@diff-warden diff-warden 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.

Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (2df0042ea5ac11f36754b346086360d12da7c7d9). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

@github-actions

github-actions Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Passed · 10/10 tests · 15/15 assertions · 5 images

Commit c6174cafdaa5dffd0be9650c1fe2efe6d72f3361 · selected evidence

Open review report

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

Deploying openwork with  Cloudflare Pages  Cloudflare Pages

Latest commit: c6174ca
Status: ✅  Deploy successful!
Preview URL: https://3d1d0209.openwork.pages.dev
Branch Preview URL: https://e2e-settings-check-now-after.openwork.pages.dev

View logs

@diff-warden diff-warden 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.

Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (c6174cafdaa5dffd0be9650c1fe2efe6d72f3361). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

@yomgui

yomgui commented Sep 10, 2026

Copy link
Copy Markdown
Member Author

Resync with dev — merge commit c6174cafdaa5dffd0be9650c1fe2efe6d72f3361

origin/dev (6909f4ea0) merged into e2e/settings-check-now-after-failed-install as a merge commit (no rebase, no force-push). PR is MERGEABLE again.

Conflict resolved — evals/specs/background-desktop-update.e2e.test.ts (dev side: #4761). Both sides changed the install-failure loop of test 1; every claim from both is kept:

  • From dev (fix(updater): re-validate the desktop version policy before installing a downloaded update #4761): revokedTest (auto-merged); Keep working dismissal via probe.eventually; before the loop, Check automatically is switched off (automaticChecksEnabled: false) and custom branding is applied, so the loop asserts the branded Restart Studio? and dismisses it via probe.eventually("the failed restart dismisses its dialog").
  • From this PR: inside each loop iteration, after the failed install, world.returnToApp() → openSettings() → see("Couldn't install the update") → checks: index + 6, downloads: index + 3 unchanged → Check now re-downloads. The product change (electron-updater-state.ts: automatic check skips error/install) and the fix(app): close the restart prompt and command palette synchronously on dismiss #4724 sync-dismiss cherry-pick are untouched; dev's pre-install policy re-validation from fix(updater): re-validate the desktop version policy before installing a downloaded update #4761 sits next to it in the same file (auto-merged).
  • Not kept from this PR: moving setCustomBranding() after the loop and asserting the default Restart OpenWork? inside it. That move was a workaround for branding being cleared by the Settings-open Den sync at this PR's base; dev's world now feeds the branded config back through __openworkSetDesktopConfigRefreshResult, and dev's proof (and this run) show Restart Studio? holds inside the loop. Keeping dev's placement asserts the brand claim three times instead of once and drops the duplicated post-loop block. Net spec delta vs dev is exactly the 5 returnToApp lines above.

⚠️ Flag — the spec no longer exercises this PR's product guard. With dev's Check automatically switched off before the loop, returnToApp() (focus + online + 16 min) cannot trigger an automatic check regardless of the error/install skip added in electron-updater-state.ts. The assertions still hold and nothing was loosened, but "a failed install does not restart the download loop on its own" is now guaranteed by the disabled switch in the test, not observed against the guard. The guard still matters in the product (real users leave automatic checks on; dev's installUpdateAndRestart refresh also re-runs the auto-check effect). If reviewers want the guard proven, a follow-up can re-enable the switch inside the loop for one returnToApp() — I did not add that here to avoid inventing flow during a conflict resolution.

Proof at the merge sha

  • Unit: pnpm --dir apps/app typecheck exit 0; bun test --isolate tests/electron-updater-install-policy.test.ts tests/version-gate.test.ts → 26 passed / 0 failed; pnpm --dir evals typecheck reports no errors in the spec.
  • Daytona: OPENWORK_EVAL_REF=c6174cafdaa5dffd0be9650c1fe2efe6d72f3361 pnpm evals:e2e background-desktop-update --daytona
    • placement: daytona (--daytona) · [openwork/testkit] ==> source verified c6174cafdaa5dffd0be9650c1fe2efe6d72f3361
    • 3 passed / 0 failed / 0 skipped (verdict: passed): revoked-version 226 s, background/persistent-restart 162 s, relaunch-recovery 281 s.
    • Trace of test 1 (results/test-runs/2026-09-10T16-35-35-611Z-…/test-run.json, gitSha c6174cafd): click(label=Check automatically) ×1, see(text=Restart Studio?) ×3, the failed restart dismisses its dialog ×2, see(text=Couldn't install the update) ×2, the user re-downloads after the failed install through Settings ×2.
    • All five sandboxes deleted by the harness.

@yomgui
yomgui merged commit a7748b2 into dev Sep 11, 2026
29 checks passed
yomgui added a commit that referenced this pull request Sep 11, 2026
Resolves evals/specs/background-desktop-update.e2e.test.ts after #4745 was
squash-merged to dev (a7748b2): keep this PR's version, which is a superset of
#4745 and #4761 and adds only its own step (automatic checks stay on through the
first failed install, asserted, then are switched off inside iteration 0). The
merged tree differs from dev in this spec only.

This branch was successfully deployed

2 active deployments
Preview – openwork-app — c6174caf Deployed Sep 10, 2026 by vercel[bot]
Preview – openwork-den — c6174caf Deployed Sep 10, 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