Skip to content

fix(machines): offer the PC's own Ovis when adding an SSH PC whose herdr already runs - #3515

Merged
devswha merged 1 commit into
mainfrom
fix/ssh-add-pc-offers-own-ovis
Nov 10, 2026
Merged

devswha merged 1 commit into
mainfrom
fix/ssh-add-pc-offers-own-ovis

Conversation

@devswha

@devswha devswha commented Nov 10, 2026

Copy link
Copy Markdown
Owner

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_herdr card that offers Use Ovis on this PC (herdr-core) (#3422) was skipped by servedAlready() in every setup, the ones the owner starts included.

Change

server/machines.ts, in the setup's own-Ovis search:

  • A PC being added (a setup the owner starts that names no saved PC) is offered the choice beside a herdr that already runs there.
  • Only when that herdr is one of the choices. If the sessions found do not hold the PC's expected herdr socket (an older core peer with no bundle there to list them, or a live bridge whose herdr no longer answers), the card could not choose what the PC would otherwise connect to, so the PC connects to it as before.
  • A saved PC is unchanged: its own reconnect, an update that asks nobody, and a setup started from its dialog all connect to its herdr as before. No HTTP/WS contract changes: the card and its answers (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 outcome default 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 gets choose_herdr with both, and choosing own_ovis connects on herdr-core. default bridge now also adds a PC whose herdr is not among the sessions found: it connects with no choice. The default herdr case fails without the server/machines.ts change.
  • Skipped: check full, browser regressions (no client change), and a live run against two real PCs.

🤖 Generated with Claude Code

…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]>
@coderabbitai

coderabbitai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • New Features
    • When setting up a new PC that has both herdr and its own Ovis session available, you’re asked which one to connect to.
    • Choosing the PC’s own Ovis opens its herdr-core session.
  • Behavior
    • New PCs without both options continue to connect as before. PCs already saved continue to reconnect as before.

When a new PC has both its own Ovis and a running herdr session, setup now offers a choice if the herdr session appears in discovery. Saved PCs retain their prior reconnect behavior. Tests cover bridge and herdr defaults.

Changes: Own-Ovis setup choice

Layer / File(s) Summary
Discover and offer the own-Ovis choice
server/machines.ts
For eligible new-PC setups, the code checks whether the expected herdr socket is served. If it is, setup refreshes unlisted sessions and offers a choice only when the socket appears in the session list.
Verify setup outcomes
server/machine-core-choice.test.ts, changelog.d/ssh-add-pc-offers-own-ovis.md
Tests cover bridge and herdr defaults, saved-PC reconnection, and choosing the PC’s own Ovis during setup. The changelog describes the behavior.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Possibly related PRs

  • devswha/ovis#3422: Adds own-Ovis discovery and selection for SSH PCs, which this change extends to setup of a new PC.
  • devswha/ovis#3409: Adds discovery and selection of herdr sessions during SSH setup, which this change uses to determine when to offer the own-Ovis choice.
Merge Risk: Minimal · up to 5c1fe

No PR-caused issue requiring a fix before merge is established. The reported SSH integration failure remains worth checking, but the available evidence does not connect it to this change.

Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed The title clearly describes the main change: offering the PC’s own Ovis when adding an SSH PC whose herdr is already running.
Description check Passed The description explains the problem and resulting behavior, distinguishes new and saved PCs, and reports validation results and skipped checks. It also notes that no HTTP/WS contract changes were mad…
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the problem and resulting behavior, distinguishes new and saved PCs, and reports validation results and skipped checks. It also notes that no HTTP/WS contract changes were made.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 2 files. (1 skipped: 1 unsupported.)

Finishing Touches

Generate docstrings

  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 8363b40 and 5c1fe05.

Files selected for processing: 3

  • changelog.d/ssh-add-pc-offers-own-ovis.md
  • server/machine-core-choice.test.ts
  • server/machines.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.

@devswha
devswha merged commit a3d930f into main Nov 10, 2026
20 of 21 checks passed
@devswha
devswha deleted the fix/ssh-add-pc-offers-own-ovis branch November 10, 2026 03:16
@devswha

devswha commented Nov 10, 2026

Copy link
Copy Markdown
Owner Author

Merge pass

Merged head 5c1fe050b301 as a3d930fd4d2b on GitHub's checks, with no unresolved review threads.

Reviewer Verdict Note
claude CLEAR
claude-standin CLEAR
codex CLEAR

Merged with these checks red, none of them required: ssh;

  • Reviewers: a fresh Claude agent, a Claude stand-in and Codex Terra 6.1 (team proxy), all CLEAR at 5c1fe05. Each confirmed the new test fails with main's server/machines.ts.
  • Two MEDIUMs and four LOWs are in Add a PC over SSH: follow-ups from the merge review of #3515 #3518 (the default-session pick pins the socket, so the PC no longer restarts herdr after a reboot; no offer when an older core Ovis lists no sessions and the bundle is missing; the install job's connect; the "Start a new herdr here" label; an unresponsive core Ovis; test gaps). They do not block the owner's PR and are fixed in a follow-up.
  • CodeRabbit did not review this head.
  • ssh (Remote PC bundles, not required) is red on this head as on other branches.

devswha added a commit that referenced this pull request Nov 10, 2026
… 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]>
devswha added a commit that referenced this pull request Nov 10, 2026
…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]>
devswha added a commit that referenced this pull request Nov 11, 2026
… 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.
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