Skip to content

fix(mobile): let the newest answer win on the phone's Orca update sheet - #52817

Merged
AmoabaKelvin merged 1 commit into
mainfrom
mobile-update-ordering
Nov 30, 2026
Merged

AmoabaKelvin merged 1 commit into
mainfrom
mobile-update-ordering

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator

ELI5

After you update a computer's Orca from the phone, closing the sheet could put the row back to an older version. That happened if the computer had moved on again by then. Separately, the "what this restart stops" list could briefly go back to an older list. Now whichever answer the phone asked for last is the one it shows.

Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​115 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​115
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​120 $\color{#cf222e}{\Huge{\mathbf{−}}}$​82 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​38

What Changed

  • Closing a finished sheet:
    • Before: closing republished the version the update verified, numbered as if it had just been read. It replaced a newer status a later read had already shown, for example after a reconnect. It also made a newer read still on its way get dropped.
    • Now: the verified version is shown at the moment it's verified, both when Restart lands and when a retry finds the computer already current. Closing only clears the sheet.
  • Restart's recheck of what stops:
    • Before: it wrote its list outside the sheet's own read order, so a late recheck could replace a newer list from a sheet refresh.
    • Now: both are numbered in one sequence, and only the newest list is written.
    • Restart stays guarded as before: it compares against the list on screen when the user tapped.
  • No behaviour change: the pure entry builders moved to host-orca-update-entry.ts to stay under the line cap.

Why

  • Root cause: two writes in the phone's Orca update store weren't ordered by when their answer was read. Settle stamped an old value with a new read number, and the recheck skipped the impact sequence.
  • The fix: each value is published when it's known, under the number it was read at, so the existing newest-read rule decides every case. A guard at close time would have been one more special case.

Linked Issue

No GitHub issue. These are review follow-ups to #52206 and #52612.

One more item from those reviews no longer reproduces: "a discarded failure should start the download path". Since #52332, prepareHostOrcaUpdateSheet reads the store after the discard. A run against main went from a failed 2.0.0 to downloaded 3.0.0, with the restart list read.

Visual Proof

N/A: no new screens or copy. This fixes which version and list existing rows show in race cases, which a capture can't reproduce on demand. The scripted runs below show it against the real store.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below
  • Every added test fails without this change and avoids the test anti-patterns

Scripted runs drive the real phone store against a fake computer (stateful updater, held replies). Before → after:

  • Update to 2.0.0, the computer moves to 3.0.0, a reconnect read shows it, then the sheet closes: main shows 2.0.0; now 3.0.0.
  • Restart recheck held while a sheet refresh lists a second SSH terminal: main ends on ['a']; now ['a','b'].
  • Unchanged behaviour:
    • A recheck that finds a new item still blocks the restart, and a second tap installs.
    • The verified version still stands when every status read after the restart fails.
    • A retry that finds the computer already updated shows its version straight away.

host-orca-update-ordering.test.ts pins both orderings through the real store, stages and transport, with a fake client and no real-time waits. It fails on main. pnpm check:changed passes.

Performance

None, because the only new work is one status read when a retry finds the computer already current. That's the same read a finished restart already makes. Closing a sheet now does one store write instead of two. Unchanged or stale answers still publish nothing.

Risk

Level: Low

  • Scope: the phone's Orca update store only. No RPC, persisted state or host changes.
  • Riskiest part: the verified version is now shown at verification instead of at close. Every place an update can reach "updated" or "current" now shows it then.
  • Back out: a plain revert.

AI Disclosure

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Mobile only. The relayed server sheets share this store and get the same ordering.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

Closing a finished sheet republished the version the stage verified under a fresh read number, so
it replaced a newer status a later read had shown, and dropped one still on its way. The verified
version is now shown when the stage verifies it, and closing only clears the sheet. Restart's
recheck of what stops is numbered with the sheet's own reads, so a late recheck never puts an older
list back.
@greptile-apps

greptile-apps Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Confidence Score: 5/5 · The PR appears safe to merge.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

The phone now keeps newer host status when a finished update sheet closes.

  • The phone keeps the newest Orca version after an update sheet closes.
  • The restart sheet keeps the newest list of what Orca would stop.

No actionable issues were found. Tests were inspected but not run.

Reviews (1) · Last reviewed commit: "fix(mobile): let the newest answer win o..." · Reviewed by Greptile

@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The update module now imports phone update timing and entry helpers from a separate module. Restart-impact reads use owner-specific sequence numbers, and only the newest result is applied. When an update is current or updated, the verified version is written to the snapshot and a fresh status read starts. Settling a completed update clears its entry and impact without changing the snapshot version. New tests cover version preservation and delayed restart-impact responses.

Merge Risk: Minimal · up to 77908

This change makes the newest answer win on the phone's Orca update sheet. A finished sheet no longer overwrites a newer version or restart list when it closes. No concrete merge-blocking risk was found, and the new ordering tests cover the changed behavior.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the phone's Orca update sheet now lets the newest read answer win. It fits the changeset, which orders reads so that the newest value is kept. The title uses the fix(m…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description is thorough and follows the template closely. It has a clear ELI5, a What Changed section with before/after behavior, a Why section with root cause and rationale, and a Linked Issue se…
Full details: Title check

Explanation

The title names the main change: the phone's Orca update sheet now lets the newest read answer win. It fits the changeset, which orders reads so that the newest value is kept. The title uses the fix(mobile) convention and is 71 characters long, within a typical limit.

Full details: Description check

Explanation

The description is thorough and follows the template closely. It has a clear ELI5, a What Changed section with before/after behavior, a Why section with root cause and rationale, and a Linked Issue section that explains there is no GitHub issue and cites review follow-ups #52206 and #52612. It includes a Visual Proof N/A with reason, Testing with checked items and scripted before/after runs, a Performance line, a Risk section with level Low and a back-out plan, and the upstream boundary and checklist items. Gaps: the Linked Issue section does not use the 'Fixes #' form, which is acceptable since the author says no issue exists. The AI Disclosure section is empty. The template says to fill it in unless the author is a StablyAI team member, so the author should confirm membership or state AI use. The Review section is empty but is not a required field in the template.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9c2e28a5-118a-49b1-9ce1-cf8934199e71
Commits

Reviewing files that changed from the base of the PR and between 0050f4a and 779080c.

Files selected for processing: 4

  • mobile/src/host-screen/identity/updates/host-orca-restart-impact.ts
  • mobile/src/host-screen/identity/updates/host-orca-update-entry.ts
  • mobile/src/host-screen/identity/updates/host-orca-update-ordering.test.ts
  • mobile/src/host-screen/identity/updates/host-orca-update.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.

@AmoabaKelvin
AmoabaKelvin merged commit 8ee3e71 into main Nov 30, 2026
29 of 30 checks passed
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