Repository navigation
Update PC bridges in the background, with progress and time left - #26
Merged
Merged
Conversation
Every bridge install downloaded the bundle (~130MB) into memory and piped it to the PC as one blob: a second PC or a retry downloaded it again, several PCs at once held several copies, and nothing could say how far it got. bundleFile() now returns a verified file: a local manifest's own, or a release asset downloaded once per checksum into <stateDir>/bundles (the newest four kept), streamed to disk with its hash checked on the way and shared by concurrent installs. SshConnection.run() can stream a file to a command's stdin, writing each chunk once ssh took the last one, and installBundle() reports download, upload and install progress. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A bridge update needed its dialog open from start to finish: the dialog cancelled the job when it closed, and the approval step waited on it. - A bridge update can run as an automatic job: key-only SSH (BatchMode), approval already given, and no setup timeout once installing. A PC that needs a password fails with the reason and waits. - When a PC is refused for an out-of-date bridge (or has only an older runtime and no bridge running), the server queues such a job, one at a time, if machine-settings.json has auto_update_bridges (default true). - POST /api/machines/:id/update-bridge starts the same job from one tap; GET/PATCH /api/machines/settings read and change the preference. - Jobs carry progress (stage, bytes, rate), and a PC mirrors its running update as `updating` over the machine events. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…nning - The PC's notice shows a running update: step, bar, bytes and time left, and Cancel update. Update bridge starts the background update in one tap; Sign in and update… opens the dialog for PCs that need a password. - The header line shows the running update's step and percentage. - The setup dialog shows the same progress, and closing it after approval leaves the install running (Continue in background). - Settings → Remote PCs toggles automatic bridge updates, and the app update hint says bridges follow. - docs/remote-pcs.md and the CHANGELOG describe the new flow. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
… the older-runtime check - A background or one-tap bridge update that failed with an ordinary error (no network, SSH refused) cleared action_required, so the PC lost its Update bridge / Sign in and update… notice. It now keeps update_bridge and shows the reason. - The "older runtime, no bridge" check also fired for Add PC and Reconnect dialogs, telling a PC that was never registered to update its bridge. It now applies only to automatic reconnects. - A download cut short by a restart left its .part file in the bundle cache; part files older than an hour are removed on the next download. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Owner
Author
|
Follow-up commit 1feea9f fixes two failure-path bugs found while reviewing:
Verified end to end in the isolated harness:
|
devswha
pushed a commit
that referenced
this pull request
Oct 6, 2026
…ersion mismatch (#506) ## Change A connect (Add PC) or a reconnect that is refused on the bridge version check used to dead-end in its dialog: the job failed with the raw server text and a **Retry connection** that repeated the same refusal, and because a first connect that fails never registers the PC, no sidebar row appeared to offer the update. The dialog now turns that refusal into the action itself: - `SetupJob` carries an optional `action_required` (`shared/machines.ts`), set in `setup()`'s catch alongside the existing `Machine.action_required`. A PC that was never registered has no machine to carry it, and an interrupted `update_remote` retry keeps offering itself (`job.update` alone). - On `action_required === "update_bridge"` the dialog replaces **Retry connection** with **Update bridge and connect**, which re-runs the setup with `update_remote: true` — through the same approval list a first install shows, so passwords and host keys still work and nothing installs unattended. Approving installs the bundle, restarts the verified bridge and connects; herdr sessions keep running. - An approved replacement accepts a different bridge protocol only for identity verification, preserving authenticated socket, managed ownership and PID checks. The replacement must match the current protocol and bundle version before connecting. Restart waits for the verified old process with a deadline and ignores its stale descriptor. - Both Connect and Update submit the same form: Enter works, required addresses and SSH port limits are enforced, and requesting an update still requires the separate installation approval. - New string `Update bridge and connect` in ko, ja and zh; the hint reuses the sidebar's translated line. This closes the gap left by #22 and #26, which give a registered PC the sidebar/banner button and the background update. Raising `REMOTE_BUNDLE_VERSION` is the moment every reconnecting PC lands exactly here. | Failure offers the update | Approval before install | | --- | --- | |  |  | ## Validation Latest main merged; original contribution by @suho-han is retained and credited in CHANGELOG.md. - Generated-type check, typecheck and production build passed on Bun 1.4.2. - Full unit suite: **1,457 passed, 15 skipped, 0 failed**. - Nine new loopback/fake-SSH regression cases cover first-connect failure, explicit approval, old-protocol replacement, authentication/socket/PID/ownership refusal without stopping a process, and strict verification of the replacement. - Real MachineDialog browser regression passed at **1280px and 390px**: Enter submission, required address, SSH port range, explicit update intent, separate approval and Open PC. Added to browser CI. - Required **Fast checks** and **Integration and browser** passed on `75ee1f304ebf16ffc47beff8aca07417c9dd83e4`. Native Windows installation, all Linux/macOS/Windows bundle checks, real SSH bridge updates and password authentication also passed. All new local tests use disposable state, synthetic endpoints and a fake SSH host; they do not update a real PC or touch a user's herdr session. --------- Co-authored-by: e2e <[email protected]>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
A bridge update on a phone meant tapping Update bridge… and then sitting on the dialog until it finished: closing the dialog cancelled the job (
MachineDialog.tsxdid that on unmount), the approval step waited on it, and "Installing…" gave no sense of how long. Every install also downloaded the ~130MB bundle again into memory.Automatic, with the app update as the approval. When a PC is refused for an out-of-date bridge, the server updates it in the background, one PC at a time. This also covers a PC that only has an older runtime and no bridge running.
BatchMode) and skips the approval step, since installing the app update was the approval.<stateDir>/machine-settings.json, on by default. With it off, the PC's Update bridge button starts the same background job in one tap (POST /api/machines/:id/update-bridge).Doesn't block. The job runs on the server. After approval, closing the dialog leaves it running (Continue in background), and Cancel update stops it. The setup's 10-minute timer stops once installing starts, and the install itself allows 30 minutes.
Progress. Jobs report their stage (download → upload to the PC → verify and install → restart), plus bytes and rate. A PC mirrors its running update as
updatingover the machine events. The sidebar shows the step, a bar, "45 MB of 130 MB · about 1 min left" and a live seconds count for stages with no size. The header shows the step and percentage.Faster and lighter. Bundles are kept by checksum under
<stateDir>/bundles(the newest four) and re-verified on use. Each checksum is downloaded once, even when PCs update together. The file is streamed to the PC with backpressure instead of being held in memory: a local 130MB pipe test peaked at 22MB RSS.No
remote-v3is needed: all of this is on the connection-server side.Commits
feat(remote): bundle cache, streaming download and upload, progress callbacks.feat(pcs): automatic and one-tap background jobs, progress, the setting and its API.feat(ui): sidebar, header and dialog progress, the Settings toggle, docs and CHANGELOG.Each one typechecks on its own.
Testing
bun run typecheckpasses,bun testpasses 300/300 (new: the bundle cache, and progress wording),bun run test:uipasses 7/7, andbun run test:sshpasses 8/8 (the dialog install path, the streamed upload, failed-install recovery).remote-v1, then this branch with the publishedremote-v2): no approval call. The PC reachedconnectedon v2 in 20s, all four stages were reported (download went 0→100%), the remote workspace was kept, and the bundle was cached. A phone screenshot during the download showed the sidebar progress and the header percentage.action_required=update_bridgeand nothing started on its own. Oneupdate-bridgecall then connected it on v2 in 20s.🤖 Generated with Claude Code