Skip to content

fix(mobile): keep a phone's managed server update to Update anyway - #52610

Merged
AmoabaKelvin merged 1 commit into
mainfrom
fix-mobile-managed-update-scope
Nov 29, 2026
Merged

AmoabaKelvin merged 1 commit into
mainfrom
fix-mobile-managed-update-scope

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Nov 29, 2026 •

Copy link
Copy Markdown
Collaborator

ELI5

A paired phone could ask the computer to force-update a server it installed over SSH, in a way that could end terminals running on that server. Only the computer and the CLI should be able to do that. Now the computer turns those requests away when they come from a phone, and the phone's normal "Update anyway" still works.

Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​54 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​54
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​8 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​6

What Changed

  • Phone callers: managedServer.update now refuses force and endInProcessTerminals from a caller with phone scope, with the error managed_server_update_option_not_allowed. Phone scope is assigned by the transport from the paired device's record, so request params can't fake it.
  • Unchanged:
    • The phone's own flow: Update, then on a deferral Update anyway (pastLiveTerminals).
    • The desktop (renderer IPC, owner scope), the CLI and paired desktops.

Why

#52332 let phones call managedServer.update so they could update SSH-managed servers. The phone allowlist gates which methods a phone may call, not which options. The shared handler then trusted every option from any caller that passed the host-admin permission. So a phone-scope request could add endInProcessTerminals or a bare force, which skip the confirmed-incumbent check and can end terminals the server runs itself. The phone UI never sends them, but the host has to enforce that.

The check sits in the handler, where the caller's transport-assigned scope and the options meet. That is the one place every phone path reaches:

  • a direct socket;
  • a relay through the desktop (the desktop answers this method itself);
  • a delegated phone.

Dropping the options instead of refusing them would quietly turn a forced request into a normal one. A clear refusal is easier to see and to reason about.

Linked Issue

STA-19882 (release-blocking, from the release scan of #52332).

Visual Proof

N/A: no visible change. The phone never sent these options, and its Update and Update anyway flow is the same. The proof is the live RPC run below.

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

Live run on macOS. The setup:

  • A hidden dev desktop built from this branch, which deployed an orcad over SSH to a loopback sshd.
  • One terminal running on that server.
  • A newer template on the desktop, so an update was offered and deferred over the terminal.
  • A real phone-protocol client (mobile-scope E2EE socket) paired to the desktop.

Results:

  • Refused from the phone: {endInProcessTerminals: true}, {force: true} and {force: true, endInProcessTerminals: true} all returned managed_server_update_option_not_allowed. The server stayed on 0.1.0+1afd687989b3, and its terminal (sleep 100000, pid 13292) kept running.
  • The phone's normal flow: Update returned deferred (orcad_update_terminals_running). Update anyway with pastLiveTerminals: {incumbentVersion: '0.1.0+1afd687989b3'} returned updated. The server then ran 0.1.0+c445e30ea2e1, and the same terminal was still running.
  • Desktop owner (local CLI client): managedServer.update {force: true, endInProcessTerminals: true} went through to the actions and returned already-current.

Automated:

  • managed-server.test.ts calls the real handler and params schema, with only the update action replaced through the real registry. Phone force and endInProcessTerminals are refused, phone pastLiveTerminals passes, and owner and runtime-paired scopes keep both options. It fails on main.
  • pnpm check:changed passes.

Traced by hand: the direct, relay and delegated phone paths all reach this handler with phone scope. The other managed-server methods are not allowed for phones, IPC is owner-only, and no shipped phone ever sent these options.

Performance

None, because this adds one constant-time scope check per managedServer.update call, before any work starts.

Risk

Level: Low

  • Riskiest part: a phone that somehow needed force. No shipped phone sends it; the phone only sends selector and pastLiveTerminals.
  • Desktop, CLI and paired desktops: unchanged.
  • Back out: a plain revert, which reopens STA-19882.

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

  • Security: narrows what a phone can do, with no new inputs.
  • Cross-platform: no platform code.
  • SSH: exercised live.
  • Mobile: no client change needed.

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)

A paired phone reached managedServer.update through the shared handler, so it could pass the
desktop-only force and endInProcessTerminals options and end the terminals a server runs. The
host now refuses both for a mobile-scope caller; the phone's Update anyway (pastLiveTerminals)
and the desktop and CLI paths are unchanged.
@greptile-apps

greptile-apps Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Confidence Score: 5/5 · The PR appears safe to merge; the restriction preserves the phone's normal update flow and desktop force options.RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge; the restriction preserves the phone's normal update flow and desktop force options.

Summary

Restricts managedServer.update so phone callers cannot pass force or endInProcessTerminals.

  • Phone updates reject force options but keep Update anyway.

Reviews (2) · Last reviewed commit: "fix(mobile): keep a phone's managed serv..." · Reviewed by Greptile

@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

managedServer.update now rejects mobile callers who set force or endInProcessTerminals to true. Other callers continue to the update action. Tests check both the rejection behavior and forwarding of allowed options, including pastLiveTerminals.

Merge Risk: Minimal · up to 17897

Paired phones can no longer force an update or end terminals on an SSH-managed server. The normal Update and Update anyway flow is unchanged, as are desktop and CLI behavior. No concrete merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(mobile): keep a phone's managed server update to Update anyway" does not match the changeset. The change refuses the force and endInProcessTerminals options for phone-scope callers of 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 covers nearly every required section of the template. It has an ELI5 summary, a detailed What Changed section with before and after behavior and the mechanism (scope as…
Full details: Title check

Explanation

The title "fix(mobile): keep a phone's managed server update to Update anyway" does not match the changeset. The change refuses the force and endInProcessTerminals options for phone-scope callers of managedServer.update. The title describes a narrower phone update flow, and it does not name the main change (blocking desktop-only options from phones). It is partially related, so the title check passes with a note.

Full details: Description check

Explanation

The description is thorough and covers nearly every required section of the template. It has an ELI5 summary, a detailed What Changed section with before and after behavior and the mechanism (scope assigned by the transport, checked in the shared handler), a Why section that explains the alternatives (dropping options versus refusing them), and a linked issue (STA-19882). It includes a Visual Proof section marked N/A with a reason and a live macOS run as proof. Testing lists the automated test and the manual run. Performance and Risk are filled in, with risk level Low and a back-out plan. The checklist is completed. Minor gaps: the 'Fixes #' line in the Linked Issue section uses a Linear-style ID (STA-19882) rather than a GitHub issue link, which the template's 'there should ALWAYS be one' rule may not accept for outside contributors. The AI Disclosure section is empty. The author may be a maintainer, in which case that section can be skipped, but this is not stated. The Review section is empty in the template too, so that is not a real gap. None of the gaps makes the description incomplete.

  • 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: 3c4292d5-ec9c-4826-9657-053355d30e7c
Commits

Reviewing files that changed from the base of the PR and between bb306fe and 1789770.

Files selected for processing: 2

  • src/main/runtime/rpc/methods/host-management/managed-server.test.ts
  • src/main/runtime/rpc/methods/host-management/managed-server.ts

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

@AmoabaKelvin
AmoabaKelvin merged commit bf356f4 into main Nov 29, 2026
58 of 59 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