You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(updater): list plain SSH terminals on the phone's restart confirm - #52612
When a phone updates a desktop's Orca, it first shows what the restart will stop. That list left out plain SSH terminals, which the restart ends and never brings back. Now they're listed by host. The phone also checks the list again the moment you tap Restart, so something opened after you looked at it can't be ended without you seeing it.
Files
Added
Deleted
Net
Test
1
$\color{#1a7f37}{\Huge{\mathbf{+}}}$36
0
$\color{#1a7f37}{\Huge{\mathbf{+}}}$36
Prod
18
$\color{#1a7f37}{\Huge{\mathbf{+}}}$114
$\color{#cf222e}{\Huge{\mathbf{−}}}$19
$\color{#1a7f37}{\Huge{\mathbf{+}}}$95
What Changed
Before:
updater.restartImpact named chats and in-process terminals, but not plain SSH terminals. Those are the SSH sessions Orca offers for a host whose server couldn't be set up.
Those terminals aren't in terminal.list. Quit's SSH shutdown drain ends them (*plain-ssh → closeAllPlainSshTerminals), and nothing restores them.
The phone's "Will restart" list could be empty while a live SSH session was about to end.
The phone read the list once when the confirm opened, then restarted without looking again.
After:
The host reports plainSshTerminals: [{ targetId, label }], read from the same session inventory the shutdown drain closes. That covers sessions that are open and ones still opening.
The phone shows one row per SSH host, titled with the saved host name and labelled "SSH terminal", next to the existing chat and terminal rows.
When Restart is tapped, the phone reads the list again and compares it with the list on screen at the tap. If something would now stop that wasn't shown, it shows the new list instead of restarting, and the user taps again.
Why
Root cause:restartImpact assembled its answer from the chat host's quit rule and the in-process PTY map. It never read the SSH shutdown path, which ends a third kind of session.
Why the session module's state:plainSshTerminalTargetIds() reads the same slots map that closeAllPlainSshTerminals clears. The confirm and the drain can't disagree about which sessions end.
Why the recheck compares this way:
The confirm was a snapshot, and work can start between reading it and tapping Restart.
Chats and SSH terminals are compared by identity, because they're shown one by one. In-process terminals are compared by count, because that's how they're shown.
A confirm that already said "couldn't check what's running" lets the restart through, since it warned about everything.
No phone capture. The confirm only appears for a host whose update has finished downloading, which a dev build can't reach. The new rows reuse the sheet's existing ListRow pattern (title, subtitle, terminal icon).
Host evidence from a hidden dev build of this branch. The SSH host was a real loopback sshd whose Orca server setup failed, so Orca offered a plain SSH terminal there:
On main the field doesn't exist, so the phone listed nothing.
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
macOS dev build: a real plain SSH terminal appeared in updater.restartImpact while open and left it once closed.
host-orca-restart-impact.test.ts: pins the restart recheck invariant on the real function. A newly opened SSH terminal refuses the restart, and anything already shown lets it through. It fails if SSH terminals are ignored.
Checks:pnpm check:changed, tc:node, mobile typecheck and verify:mobile-localization pass. The new string is translated in all 11 locales.
Needs a store build: the phone half is in the native app (mobile/src/host-screen), so it reaches users with the next release.
Performance
None, because updater.restartImpact runs only when the confirm opens or Restart is tapped. With no SSH terminal open it reads one empty Map. The phone adds one read per Restart tap, capped at 15 s, and skips it when a restart was already requested.
Risk
Level: Low
Riskiest part: the recheck. A wrong comparison could make Restart need a second tap. It can't loop: each refusal needs a new tap, and the next tap compares against the list just shown.
Mixed versions:
An older host sends no plainSshTerminals, and the phone treats that as none, the same as before.
An older phone ignores the extra field.
Back out: 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
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Other SSH state that quit ends comes back after the restart: port forwards are restored, and SSH workspace terminals reconnect. Plain SSH terminals were the only SSH item with nothing to restore them.
SSH host labels already reach paired phones through ssh.listTargetSummaries at the same permission, so this exposes nothing new.
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)
…before a phone restart
Plain SSH terminals aren't in terminal.list and quit's SSH drain ends them,
so updater.restartImpact now names them from the same session inventory the
drain closes. The phone lists them on the update confirm and reads the impact
again when Restart is tapped, showing anything new instead of restarting.
The PR adds plain SSH terminals to the phone’s restart confirmation and checks the impact again when Restart is tapped.
Restart confirmations now list plain SSH terminals by host.
The phone checks the restart list again when you tap Restart.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User taps Restart] --> B{Restart already requested?}
B -->|Yes| C[Wait for host to return]
B -->|No| D[Read current restart impact]
D --> E{Covered by accepted warning?}
E -->|No| F[Show new list and wait for another tap]
E -->|Yes| G[Request install]
G --> C
The reason will be displayed to describe this comment to others. Learn more.
Restart action lacks test coverage
This test checks restartImpactShown, but never calls restartHostOrcaUpdate. It would still pass if the restart action ignored false and called updater.install anyway.
Add a test that drives the restart action with a newly opened SSH terminal, checks that install was not called, and checks that the new list was published. A second tap against that list should allow install.
Restart-impact data now includes active plain SSH terminals and their saved labels. The mobile update flow reads this data and checks it against the impact shown when the user tapped. If the current impact was not shown, the flow updates the displayed impact and does not start a new install. The update sheet displays SSH terminal entries alongside chats and in-process terminal PTYs. Locale files add SSH terminal labels.
Merge Risk: Low · up to cbbf6
In a narrow timing case the restart confirmation list can briefly omit an item. Restart remains protected by the recheck on the next tap. Low risk; fix the newest-read check before or soon after merge.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: the phone's update-restart confirm now lists plain SSH terminals. It uses the conventional fix(updater) prefix, is one sentence, and matches the raw summary, which add…
Description check
The description follows the template. It has ELI5, What Changed (before and after), Why, Linked Issue (STA-19683, a follow-up to #51246 and #51708), Visual Proof with host evidence and an explanation …
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main change: the phone's update-restart confirm now lists plain SSH terminals. It uses the conventional fix(updater) prefix, is one sentence, and matches the raw summary, which adds plain SSH terminals to restart-impact rows. Scope is clear.
Full details: Description check
Explanation
The description follows the template. It has ELI5, What Changed (before and after), Why, Linked Issue (STA-19683, a follow-up to #51246 and #51708), Visual Proof with host evidence and an explanation of why no phone capture exists, Testing, Performance, Risk with level and back-out plan, and Notes. The AI Disclosure section is empty, which is acceptable for a maintainer. The Review section is empty. The final pnpm checklist item is unchecked, and the description says these checks passed only in the Testing section. These are minor gaps.
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.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
The restart recheck can overwrite a newer impact list with an older one.
The recheck at line 254 writes its result without the newest-read check used by refreshHostOrcaRestartImpact. If a sheet refresh starts during the recheck and its result lands first, a late recheck result that includes an item not in the accepted list replaces the newer list. The re-prompt then omits that item until the next tap.
The restart remains guarded. The next tap rechecks against the list accepted at that tap and re-prompts for any item not shown.
Count rechecks in the same impactReads sequence, and apply the newest-read check to the write at line 254. The write must not replace a newer list, and the update must not leave impact in loading.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
When a phone updates a desktop's Orca, it first shows what the restart will stop. That list left out plain SSH terminals, which the restart ends and never brings back. Now they're listed by host. The phone also checks the list again the moment you tap Restart, so something opened after you looked at it can't be ended without you seeing it.
What Changed
updater.restartImpactnamed chats and in-process terminals, but not plain SSH terminals. Those are the SSH sessions Orca offers for a host whose server couldn't be set up.terminal.list. Quit's SSH shutdown drain ends them (*plain-ssh→closeAllPlainSshTerminals), and nothing restores them.plainSshTerminals: [{ targetId, label }], read from the same session inventory the shutdown drain closes. That covers sessions that are open and ones still opening.Why
restartImpactassembled its answer from the chat host's quit rule and the in-process PTY map. It never read the SSH shutdown path, which ends a third kind of session.plainSshTerminalTargetIds()reads the sameslotsmap thatcloseAllPlainSshTerminalsclears. The confirm and the drain can't disagree about which sessions end.Linked Issue
STA-19683. Follow-up to #51246 and #51708.
Visual Proof
No phone capture. The confirm only appears for a host whose update has finished downloading, which a dev build can't reach. The new rows reuse the sheet's existing
ListRowpattern (title, subtitle, terminal icon).Host evidence from a hidden dev build of this branch. The SSH host was a real loopback sshd whose Orca server setup failed, so Orca offered a plain SSH terminal there:
On main the field doesn't exist, so the phone listed nothing.
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
macOS dev build: a real plain SSH terminal appeared in
updater.restartImpactwhile open and left it once closed.host-orca-restart-impact.test.ts: pins the restart recheck invariant on the real function. A newly opened SSH terminal refuses the restart, and anything already shown lets it through. It fails if SSH terminals are ignored.Checks:
pnpm check:changed,tc:node, mobile typecheck andverify:mobile-localizationpass. The new string is translated in all 11 locales.Needs a store build: the phone half is in the native app (
mobile/src/host-screen), so it reaches users with the next release.Performance
None, because
updater.restartImpactruns only when the confirm opens or Restart is tapped. With no SSH terminal open it reads one empty Map. The phone adds one read per Restart tap, capped at 15 s, and skips it when a restart was already requested.Risk
Level: Low
plainSshTerminals, and the phone treats that as none, the same as before.AI Disclosure
Review
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
ssh.listTargetSummariesat the same permission, so this exposes nothing new.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)