Skip to content

feat(installer): reload the agent after updates instead of prompting for sudo - #1215

Open
JamieRuderman wants to merge 6 commits into
mainfrom
feat/sudo-free-agent-reload
Open

JamieRuderman wants to merge 6 commits into
mainfrom
feat/sudo-free-agent-reload

Conversation

@JamieRuderman

@JamieRuderman JamieRuderman commented Sep 12, 2026

Copy link
Copy Markdown
Member

Why

Every desktop update re-ran the full sudo agent uninstall + agent install because the running agent's version no longer matched the bundled CLI. Nothing in that sequence needs root after the first install: the service definition and the /usr/local/bin symlinks point at fixed paths that the update overwrites in place.

What

  • binaryInstaller.check() now asks the running agent to adopt the installed binaries via the new unprivileged remoteit agent reload (remoteit/cli-source#432) before falling back to the existing sudo install.
  • Reload is attempted only when the bundled CLI is usable and the agent is running; the agent decides platform support (Windows answers 409, a pre-reload agent answers with an unknown-message error, a job that predates staging answers 410). A refusal is latched per agent version so it is not retried every heartbeat, and cleared once an install or a successful reload brings the agent current.
  • A reload counts as success only if the agent then reports the bundled CLI version; a no-op reply that leaves another version running falls back to the install prompt.
  • reload() is guarded against re-entry, the completion sequence is shared with install(), and updateVersions() reuses the version already read during the status check. The dead sudo restart() path is removed.
  • Expected reload refusals (409, 410, unknown-message) are added to the existing Airbrake allowlists in Command.ts; signature and staging failures (411, 412) still report.

Verified

  • binaryInstaller and Command specs (34 tests), tsc, prettier.
  • Against the shipped legacy agent the new reload path returns the expected error and the sudo fallback is reached, so this is safe to ship before the CLI change.

Pairs with

remoteit/cli-source#432, which adds the agent reload command this calls. The two are independent: against an agent that predates the command this gets an unknown-message error, latches the refusal, and falls back to the sudo install, so either can ship first.

The macOS privilege-escalation work is deliberately not part of this pairing. It is in remoteit/cli-source#430 and is being reviewed separately, at Nicolae's request, so the sudo-free update is not held up behind it.

Scope note

Reload is attempted wherever the agent is running and the bundled CLI is usable, and the agent itself decides whether it can adopt the binaries, so the sudo fallback stays correct on every platform. Codes 411 and 412 in the permanent-refusal list only occur once the staging work in remoteit/cli-source#430 lands; they are harmless until then.

Rollout

Ships independently. Once the paired CLI is bundled, Macs see one final password prompt on that update, then none.

@JamieRuderman

Copy link
Copy Markdown
Member Author

@codex review

@aws-amplify-us-west-1

Copy link
Copy Markdown

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-1215.d20k671nqqv4kl.amplifyapp.com

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 964674b4c3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@JamieRuderman

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 964674b4c3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread electron/src/backend/binaryInstaller.ts Outdated
@JamieRuderman

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: e3f8f01194

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@JamieRuderman

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: d407da8fa0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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