Skip to content

Add in-app Pi updates - #20

Merged
MRL-00 merged 1 commit into
mainfrom
agent/update-pi-from-app
Jul 31, 2026
Merged

Add in-app Pi updates#20
MRL-00 merged 1 commit into
mainfrom
agent/update-pi-from-app

Conversation

@MRL-00

@MRL-00 MRL-00 commented Jul 31, 2026

Copy link
Copy Markdown
Owner

What changed

  • Replaced the Settings copy-command control with a native Update Pi button.
  • Added updating, disabled, retry, and inline error states. The update section disappears after the refreshed version reports Pi is current.
  • Added an authenticated POST /pi-update companion endpoint that runs pi update --self --no-approve on the selected Mac.
  • Prevented Pi updates from racing with active turns, concurrent updates, or new messages.
  • Refreshed Pi version, model, and skill caches after a successful update.
  • Fixed fresh companion installs exiting early when the LaunchAgent does not exist yet.

Why

The app detected an available Pi release but only exposed a command for users to copy into Terminal. The companion server had no mutation endpoint, so the phone could not perform the maintenance action it was recommending.

Pi processes are launched per turn, so the next turn automatically uses the new executable. The Bun companion remains valid during a Pi-only update and does not need to restart. Active turns are rejected before updating so no running Pi process is disrupted.

The installer fix addresses set -euo pipefail treating a missing LaunchAgent as a fatal fresh-install error.

Validation

  • xcodebuild Debug build for iPhone 17 simulator
  • bun build server/server.ts --target=bun --external qrcode-terminal
  • bash -n server/install.sh
  • End-to-end companion test with a fake Pi executable, verifying the update command and version transition without changing the real installation

Summary by CodeRabbit

  • New Features

    • Added in-app Pi update controls for Macs with available updates.
    • Updates now show progress, retry options, accessibility labels, and clear error messages.
    • Version information refreshes automatically after a successful update.
  • Bug Fixes

    • Improved update safety by preventing conflicting updates and activity during the update process.
    • Improved service startup reliability when process information is unavailable.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 8ea4d745-fff3-46f5-b7ec-e45c0278f807

📥 Commits

Reviewing files that changed from the base of the PR and between 66aa742 and 1085c01.

📒 Files selected for processing (4)
  • PiMobile/APIClient.swift
  • PiMobile/Views/SettingsView.swift
  • server/install.sh
  • server/server.ts

📝 Walkthrough

Walkthrough

The server now supports authenticated Pi self-updates with concurrency and active-turn protection. The API client sends long-running update requests to a selected Mac. Settings provides progress, retry, error, and version-refresh states. Installation tolerates an unloaded LaunchAgent.

Changes

Pi self-update

Layer / File(s) Summary
Server update lifecycle
server/server.ts, server/install.sh
The server resolves PI_PATH, performs serialized Pi self-updates, verifies the installed version, refreshes models and skills, blocks turns during updates, and exposes POST /pi-update. Installation tolerates missing service PIDs.
Update API client
PiMobile/APIClient.swift
The POST helper accepts a target Mac and timeout. updatePi(on:) sends the authenticated update request with a 180-second timeout.
Settings update controls
PiMobile/Views/SettingsView.swift
Settings replaces terminal-command controls with an asynchronous update button. It tracks progress per Mac, supports retry, displays errors, and refreshes the Pi version after success.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant SettingsView
  participant APIClient
  participant PiUpdateRoute
  participant PiUpdater
  participant PiExecutable

  SettingsView->>APIClient: updatePi(on: mac)
  APIClient->>PiUpdateRoute: POST /pi-update
  PiUpdateRoute->>PiUpdater: invoke update
  PiUpdater->>PiExecutable: run self-update
  PiUpdater->>PiExecutable: verify version
  PiUpdateRoute-->>APIClient: PiVersionInfo
  APIClient-->>SettingsView: updated version
Loading

Possibly related PRs

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/update-pi-from-app

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

Comment @coderabbitai help to get the list of available commands.

@MRL-00
MRL-00 marked this pull request as ready for review July 31, 2026 22:41
@cursor

cursor Bot commented Jul 31, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@MRL-00
MRL-00 merged commit da0c6f8 into main Jul 31, 2026
1 check was pending
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