Repository navigation
fix(machines): offer the PC's own Ovis when adding an SSH PC whose herdr already runs - #3515
Conversation
…rdr already runs A setup the user starts offered the PC's own Ovis (herdr-core) only when nothing served the PC's herdr socket. A PC that runs both was connected to its herdr with no choice, so its herdr-core terminals were out of reach over SSH until that herdr was stopped. A PC being added (no saved PC named) is now offered the choice beside a herdr that already runs there, when that herdr is among the sessions found, so the card can still choose it. A saved PC, from its dialog or on its own, connects as before. Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
Merge passMerged head
Merged with these checks red, none of them required: ssh;
|
… ask an install's connect to choose (#3521) Closes items 1 and 4 of #3518 (follow-ups from the review of #3515). Items 2, 3, 5 and 6 stay open there. ## Change - **The default herdr session is saved as no choice** (`server/machines.ts`, `server/remote-host.ts`). On the card #3515 added (a PC with both a running default herdr and its own Ovis), "Use Default session" sends `herdr_socket` = the default socket, and the PC was saved pinned to it. After that PC rebooted, the bridge answered `herdr_session_gone` and the PC stopped in an error, where a PC saved without a socket starts herdr by itself. The POSIX inspect now also names the session's default socket (`defaultSocket`); when the chosen socket is that one and no session is named, the PC is saved without `herdr_socket`. A named session's socket is saved as before. - **An install's own connect is not "adding"** (`server/machines.ts`). `POST /api/machines/install` for a PC not added yet ends with a connect that counted as adding, so it could end in `choose_herdr`, which an install job has no card for. `fromInstall` is carried to the job and such a connect goes to the Ovis just installed. Server only. No HTTP/WS contract change: the job's and the PC's shapes are as before. ## Not covered - Windows: its inspect names no default socket, so nothing is unpinned there. - PCs already saved pinned to the default socket are healed only when a setup runs for them again; there is no migration. - One more short SSH command per connect for a PC with a chosen socket. - Not run against a real remote PC or a real reboot. ## Validation - `server/machine-core-choice.test.ts`: `default herdr chosen` and `default herdr installed` are new and fail on main's `machines.ts`; a third test covers the real POSIX inspect's `defaultSocket`. 39 pass. - `bun run check fast`: pass (unit 14390 pass, 0 fail). - Skipped: `bun run check full`, browser regressions, a live two-PC run. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Fable 5.2 <[email protected]>
…start, and ask in two more cases when adding one (#3576) ## What Follow-ups from the merge review of #3515 (adding a PC over SSH that runs both herdr and its own Ovis on herdr-core). Three cases still went wrong: - **After a reboot** (item 8): a PC added with "Use Default session" was saved with no choice at all. When it restarted with a named herdr session running first, its bridge found sessions and the PC stopped at a new choice. - **A PC from herdr's saved machines** (item 7): the same choice was tied to the default session's socket again at the next refresh of that list or restart of this app, which ends at "the herdr session chosen for this PC is no longer running" after that PC restarts. - **No runtime of this app on that PC yet** (item 2): a default herdr socket that only counts as served (a socket file, nothing there to check it) set the PC up as a herdr PC without offering that PC's Ovis. Part of #3518: items 7, 8, 2, 6 and 9. Items 1 and 4 were fixed by #3521. Items 3 and 5 wait for the owner's choice. ## Change `server/machines.ts`: - A default session chosen by its socket is saved with `start_new_herdr`, so a reconnect starts the default session and asks nothing (item 8). - `allowConnection` / `approve` get what the PC is saved with, not the target as asked, so a catalog PC is not pinned to the default socket again (item 7). - `servedAlready` says what serves the socket. For a file-only socket the add is asked: with a row for herdr's own socket only when nothing could list sessions (the Ovis answered without a list and discovery could not run), and as a PC with no herdr running when a current Ovis lists sessions without it. A row chosen is sent as a chosen socket, which its bridge validates and never starts (item 2). - Behind a live bridge of this app ("default bridge") and beside an Ovis that does not answer, the add connects as before. - Items 6 and 9 are test coverage: `localSessions()` with a served herdr, and the `!session` half of the unpin rule. Known limits (from the review, not changed): - The row for herdr's own socket is built from the socket file alone, and that file survives a reboot or a killed herdr. On a PC with an older Ovis, no runtime of this app and such a leftover socket, choosing the row goes through the install approval before the bridge answers "no longer running"; before this change that PC connected in one step with herdr started. - Item 2 stays open for one shape: an older Ovis on a PC whose current runtime is missing while a bridge of an earlier version of this app still serves the default socket. That PC connects through the bridge without the offer (a socket chosen there could not reuse its bridge). - A PC saved with `start_new_herdr` no longer gets the card in a later setup from its dialog when its herdr has stopped: it goes to the approval that starts herdr. Moving such a PC to its own Ovis means editing its address or session in the dialog, or adding it again. - No migration: PCs already saved by #3521 with no choice, and catalog PCs already pinned, are healed by their next setup. Windows is unchanged (its inspect names no default socket). ## Validation - `bun run check fast` at 94d33ae: green (unit 14420 pass, 0 fail; typecheck, build, generated files). - `server/machine-core-choice.test.ts` (44 pass) and `server/machine-herdr-choice.test.ts` (14 pass): the default choice kept through refresh, restart and reconnect for a typed and a catalog PC; an older Ovis beside a served herdr with and without this app's runtime; a current Ovis whose list lacks herdr's socket; the unchanged "default bridge" case. - Failing first: with `server/machines.ts` reversed, both files fail on the new outcomes (the saved target lacks `start_new_herdr`; the add connects without the card). - Reviewed before opening by two independent agent reviewers: both "ship", low findings only, listed under Known limits. Not taken: a test of the row for a session named in the dialog. - Not run: `scripts/ssh-integration.ts`, `server/remote-entry.test.ts`, `check full`, browser regressions (no client change), and anything against a real second PC or a real reboot: unit fixtures only. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Fable 5.2 <[email protected]>
… of saying the connection failed (#3636) > **Waits for the owner's OK** (UI change). Before/after screenshots are listed below. ## What When you add a PC over SSH and that PC runs both its own Ovis server (herdr-core) and herdr sessions, the app asks which one to connect to. The owner hit this today in the desktop app 0.5.3-beta.35, and it read as a failure: - The dialog headed the question **"Connection failed"**. The server ends every non-cancelled setup as `phase: "failed"` / `step: "Connection failed"`, and a `MachineActionRequired("choose_herdr")` is one of them. - The question box had a red border and a red heading, in the dialog and on the PC's sidebar card. The card's dot was red, and its title and menu line said "Connection error". The line under the header said "QA remote needs web access setup." with a "Set up web access" button. - The answer most people want, **"Use Ovis on this PC"**, came second to last, after every herdr session. Its heading, "Ovis on this PC (herdr-core)", sat above a list of herdr sessions that Ovis does not serve. ## Change Client only. The server still returns the same job and machine state, so no HTTP or WS contract changes. - `FoundHerdrChoices`: when the question is a choice (this PC's Ovis or herdr sessions were found), the box uses the neutral `is-setup` style. It shows this PC's Ovis first, under its own heading, with the only primary button. The herdr sessions follow under "Or a herdr session running on this PC", and "Start a new herdr here" comes last. The case where the chosen Ovis or session is gone or was refused keeps the red failure style, because that is a failure. - `MachineDialog`: while a choice is needed, its heading is the server's question ("Choose this PC's Ovis server or a running herdr session.") instead of "Connection failed". The footer button stays (it is also how an edited address is retried) but is no longer primary, so the choice has a single primary button. - `MachineSidebar`: a PC waiting on this choice gets the neutral setup dot. Its title and menu line read "Choose what to connect to". The line under the header reads "Choose what {name} connects to." with a "Choose" button. - New strings in ko, ja and zh. ## Asking at all (decided: keep the question) The lead asked whether a PC whose own Ovis answers, and belongs to this account, should connect to that Ovis without asking. I kept the question. The PC's Ovis serves herdr-core, which is a different set of terminals from the herdr sessions running beside it. Someone who works in a herdr session would be connected to terminals they did not pick, without a word. #3515 added the question to prevent exactly that. This PR makes the question read as a question and puts the usual answer first. The server's decision is unchanged. Design reference: the question works like VS Code Remote-SSH's prompts when it finds more than one possibility on a host. It is a pick with the likely answer first, not an error. ## Screenshots (light; desktop 1280 and phone 390) Fixture data only. No real PC or session is shown. - Before: `~/.cache/ovis-tmp/fix-issue/before/found-herdr/choice-{1280,390}-light.png` (dialog), `~/.cache/ovis-tmp/fix-issue/before/card/choose-1280.png` (card) - After: `~/.cache/ovis-tmp/fix-issue/after/found-herdr/choice-{1280,390}-light.png` (dialog), `~/.cache/ovis-tmp/fix-issue/after/card/choose-{1280,390}.png` (card) ## Reproduction - Server: `server/machine-core-choice.test.ts` ("default herdr") runs the real `MachineManager` over SSH against a stand-in PC. That PC has this account's own Ovis on herdr-core and a running herdr session. Adding it returns `phase: "failed"`, `action_required: "choose_herdr"` and "Choose this PC's Ovis server or a running herdr session.", which is the state the owner saw. - UI: `scripts/machine-dialog-regression.ts` now feeds the dialog those real values (before, it used a made-up step, "Choose a herdr session", which hid the bug). `scripts/machine-own-ovis-regression.ts` gets the same machine state on the sidebar card. Both failed on `main` ("a needed choice does not read as a failed connection"), and `FoundHerdrChoices.test.tsx` failed on the order. All three pass with this change. ## Validation - `bun run check fast` at 6c6b10b: green (generated types and themes fresh, typecheck, build, unit tests). - `bun test src/components/FoundHerdrChoices.test.tsx src/lib/i18n.test.ts src/lib/machineNotice.test.ts` plus every `conventions.test.ts`: 114 pass. `server/machine-core-choice.test.ts server/machine-herdr-choice.test.ts`: 58 pass. `scripts/changelog-fold.test.ts`: 12 pass. - Browser regressions covering the machine dialog and the sidebar card, run in the CI runner image `herdr-ci-runner:local` from a fresh clone of the branch: machine-dialog, machine-own-ovis, machine-conflict, update-notice, sidebar-machine-layout-demo, sidebar-machine-removal-demo, machine-events-browser, palette-machines-demo and sidebar-spacing-demo all pass. - Skipped: `scripts/machines-browser-qa.ts`. It needs an `SSH_TEST_KEEP=1 bun run test:ssh` fixture, CI leaves it out for that reason (`scripts/ci-browser.test.ts`), and it covers PC switching, uploads and drafts, not this dialog. The full `bun run check` and the integration suite did not run; this is a client-only change. - Not checked on a real second PC: the reproduction is the server test's stand-in PC and the browser fixtures fed its values.
What
Adding a PC over SSH connected to that PC's herdr without a word whenever a herdr already ran there, even when the PC also runs its own Ovis on herdr-core. The owner then saw the herdr sessions, not the herdr-core terminals they use on that PC, and the only way to reach the core over SSH was to stop herdr there first.
The
choose_herdrcard that offers Use Ovis on this PC (herdr-core) (#3422) was skipped byservedAlready()in every setup, the ones the owner starts included.Change
server/machines.ts, in the setup's own-Ovis search:herdr_socket,own_ovis,start_new_herdr) are the existing ones.Not covered: a PC already saved on its herdr still has no way to move to its own Ovis without removing and adding it again.
Validation
bun run check fast: green (unit 14386 pass, 0 fail; typecheck, build, generated files).server/machine-core-choice.test.ts: new outcomedefault herdr(herdr answering at the default socket and listed by the PC's own Ovis, this app's bridge in front): a saved PC connects to herdr with no choice, a PC being added getschoose_herdrwith both, and choosingown_ovisconnects on herdr-core.default bridgenow also adds a PC whose herdr is not among the sessions found: it connects with no choice. Thedefault herdrcase fails without theserver/machines.tschange.check full, browser regressions (no client change), and a live run against two real PCs.🤖 Generated with Claude Code