Skip to content

Say when a PC needs a bridge update, with the button that does it - #22

Merged
devswha merged 1 commit into
mainfrom
feat/bridge-update-prompt
Sep 24, 2026
Merged

devswha merged 1 commit into
mainfrom
feat/bridge-update-prompt

Conversation

@devswha

@devswha devswha commented Sep 24, 2026

Copy link
Copy Markdown
Owner

Summary

After #21 (remote-v2), every PC connected with a v1 bridge is refused until its bridge is updated. Before this PR, that looked like this:

  • The PC showed Reconnecting… and retried every 1–60s forever, although only an explicit update could help.
  • Update bridge… sat inside the PC's manage panel, behind the sliders button.
  • On a phone with the drawer closed, nothing said anything at all.

Now:

  • Server. An incompatible bridge (another bundle version or bridge protocol), and a PC whose runtime needs setup approval, throw MachineActionRequired. The PC stops retrying, waits in error with action_required: "update_bridge" | "setup", and the flag clears once it connects, or when a reconnect starts. action_required isn't persisted.
  • Sidebar. Under the PC, a notice says what's needed and has the button: Update bridge… or Set up….
  • Header. A line like the app update notice: " needs a bridge update to reconnect" with Update bridge…, plus a count when more PCs are waiting. It shows even with the drawer closed.
  • The error text is now neutral ("a bridge from a different version"), because the other bridge could also be newer.

Testing

  • bun run typecheck passes, bun test passes 294/294, and bun run test:ui passes 7/7.
  • End to end, v1 → v2 (scratch script, isolated sshd and HOME, the published remote-v1 and remote-v2 releases):
    • v0.3.0 installed the v1 bridge.
    • The new server put the PC in error with action_required=update_bridge, and it was still in error 4s later, so there's no retry loop.
    • Chrome at desktop and phone widths showed the sidebar notice and the header line. The header button on the phone opened the Update remote bridge dialog.
    • Update bridge installed remote-v2 and reconnected, the flag was cleared, and the remote workspace was kept.

🤖 Generated with Claude Code

…does it

A PC whose bridge came from another bundle version showed "Reconnecting…"
and retried forever, although only an explicit bridge update could help,
and Update bridge… sat inside the PC's manage panel. The same held for a PC
whose runtime needs setup approval.

Those cases now throw MachineActionRequired: the PC stops retrying, waits
in the error state with action_required ("update_bridge" or "setup"), and
the flag clears once it connects. The sidebar shows the next step under
the PC with its button, and a header line (like the app update notice)
says so even with the drawer closed on a phone.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@devswha
devswha merged commit bdfc036 into main Sep 24, 2026
@devswha
devswha deleted the feat/bridge-update-prompt branch September 26, 2026 14:48
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 |
| --- | --- |
|
![failure](https://raw.githubusercontent.com/suho-han/herdr-web-ui/pr-evidence/pc-dialog-update-offer.png)
|
![approval](https://raw.githubusercontent.com/suho-han/herdr-web-ui/pr-evidence/pc-dialog-approval.png)
|

## 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]>
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