Skip to content

feat(add): name the account and wait for Enter before the QR, under the fleet preview - #3955

Merged
devswha merged 5 commits into
mainfrom
feat/add-confirm-under-preview
Nov 16, 2026
Merged

devswha merged 5 commits into
mainfrom
feat/add-confirm-under-preview

Conversation

@devswha

@devswha devswha commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

Change

Changes what ovis add (also ovis link and ovis login) does under the fleet preview, OVIS_PREVIEW=fleet
(server/preview.ts, from #3938, which this pull request builds on). No release sets that variable. The plugin
reads it from its environment or its
settings file (env, .env), the merged settings the server it starts gets. With it unset, ovis add does what
main does.

Under OVIS_PREVIEW=fleet, ovis add without --approve, in the order a person meets it:

  • If its output or its input is not a terminal, with or without --print, it does not start the sign-in. It
    prints one line saying that adding this PC needs a terminal and exits 1. It lists nothing and shows no code.
    With the preview unset, --print behaves as before.
  • The sign-in itself is unchanged.
  • After the sign-in, it names the account that signed in and the provider it used: Signed in as Ovis account <id> (signed in with GitHub). Press Enter to show the QR code for this account's phone, or press Ctrl+C if that is not your account:. Until Enter is pressed, this PC is not listed in that account and no code is made.
  • A line that is empty, or holds only spaces, lists this PC in the account (This PC is listed in that account as <name>.). It then shows the QR code as before, on a screen of its own, or with --print as lines that stay.
  • Any other line, or the end of the input (Ctrl+D), prints The QR code was not shown, and this PC was not listed in that account. with what to run again, and exits 1.
  • Some lines answer nothing, and the question is asked again:
    • a line that comes less than 1.5 s after the question shows;
    • the first line, where the terminal's input could not be emptied as the question showed.
      This is the same rule the existing questions of ovis add use.
  • Under the preview, two variables change what the command names:
    • The app the server pairs with (OVIS_RELAY_APP_URL; its offers carry it) replaces app.ovis.sh in the code
      lines of ovis add and ovis link --code and in the --approve line.
    • OVIS_CLI_NAME, for a wrapper that runs the plugin under another name, replaces ovis in the commands
      ovis add says to run.

ovis add --approve gets neither the terminal check nor the Enter step. Under the preview, only the app it names
changes.

With OVIS_PREVIEW unset (or set to a list without the word fleet), nothing changes, whatever
OVIS_RELAY_APP_URL and OVIS_CLI_NAME say. The one change in scripts/plugin.ts passes OVIS_RELAY_APP_URL on
to link, which reads it only under the preview.

A changelog fragment is included (changelog.d/add-confirm-under-fleet-preview.md).

Five follow-ups rated low in review are in #3957.

Validation

On this head, which holds main 9d17bcd: main was merged in after #3953 changed the same files (two conflicts,
both in import lines: linkSettings now comes with link's deferred import of scripts/plugin-link.ts):

  • bun run typecheck: passed.
  • One run of bun test scripts/plugin-link.test.ts scripts/plugin.test.ts: 213 pass, 0 fail (with main's new tests
    of a checkout whose packages are not installed).
  • bun run check fast: passed (workflow syntax, generated types and themes, typecheck, build; unit tests 17,705
    pass, 0 fail, 54 skip).
  • macOS arm64 (27.0.1), Bun 1.4.2, in a fresh clone of this pull request's head (535de9e): the same two test
    files, 211 pass, 2 skip, 0 fail.
  • main e5c6a8e and this branch two revisions before this head (before the settings-file change and before
    main 9d17bcd was merged in), side by side
    with OVIS_PREVIEW unset, by a reviewer that did not write it, through the real scripts/plugin.ts: add,
    add --print, add --approve, link --code, status, help and an unknown command; piped and at a pty; the two
    variables unset and set; OVIS_PREVIEW unset, empty, fleets and no-fleet: 112 runs a side under strace,
    against a local stand-in for the PC and an account service that refuses connections. Output (the pty's bytes
    too), exit codes, the calls to the PC and the connect and execve calls were the same. These runs reach the
    refusal, the sign-in failing, link --code and usage; the QR, Enter and approve paths are compared in the
    in-process runs below.
  • New tests in scripts/plugin-link.test.ts:
    • under the preview: the refusal without a terminal (output, input, --print, and a list that names fleet
      beside another word); the account named before anything is listed, with Enter, other lines (no, y, x)
      and Ctrl+D; the line that comes too soon and the first line where the input could not be emptied; both
      variables taking effect; the preview set only in the plugin's settings file (the refusal through the real
      command, the Enter step in-process through the plugin's own merge of its settings);
    • a control with the preview unset (also "", fleets, no-fleet), run once with nothing set and once with
      both variables set. It expects main's lines: --print to a pipe writes the code, no Enter step, app.ovis.sh
      and ovis in what is printed;
    • one run of the real scripts/plugin.ts add with its output piped: the refusal under the preview, main's
      sentence without it.
  • These tests fail when the preview condition is removed:
    • The preview-unset controls failed with the condition removed from the terminal check and the Enter step (on
      the first version of this branch).
    • The control also failed with the condition removed from the app name and from the command name (on this
      code).
  • main 9d17bcd and this head, with OVIS_PREVIEW unset, compared side by side by the author (the real
    scripts/plugin.ts also for status, stop and help):
    • link was driven in-process, with the test file's fake PC, fake account service and a fixed clock, through 14
      runs: plain add, --print at a terminal, --print with the output and with both output and input not a
      terminal, output only or input only not a terminal, the account service off (with and without --print),
      already in an account, nobody scanning for 30 minutes, Ctrl+C while the code shows, a device kept out by
      Enter, link --code, and --approve.
    • The real scripts/plugin.ts add and add --print were run with stdout a pipe, with the account service
      unreachable and off.
    • Each was run three ways: nothing set, OVIS_RELAY_APP_URL set, OVIS_CLI_NAME set; the real command also
      with the two names set only in the settings file. The output, exit codes, calls to the PC and calls to the
      account service were the same.

Not run: the Enter step with a person at a real terminal, or through the real command with the preview only in
the settings file; under the preview, the QR and approve paths through the
real command (in-process only); a real account service, relay or phone; Windows.

…he fleet preview

With OVIS_PREVIEW naming `fleet` (server/preview.ts), `ovis add` without
`--approve` refuses an output or input that is not a terminal, `--print`
included, before the sign-in. After the sign-in it names the account that
signed in, and lists this PC and shows the QR code only once Enter is typed
at that name. Any other line, or the end of the input, shows nothing and
lists nothing.

With the preview unset, `ovis add` is unchanged.

The command name in what it says to run comes from OVIS_CLI_NAME (else
`ovis`), and the app it names from the pairing offer's host and
OVIS_RELAY_APP_URL (else app.ovis.sh); unset, both print what they printed
before.
With OVIS_PREVIEW unset, `ovis add`, `link --code` and `--approve` name
app.ovis.sh and `ovis` whatever OVIS_RELAY_APP_URL and OVIS_CLI_NAME say.
Under the preview they name the app the server pairs with, and the command
name that a wrapper running the plugin under another name sets.
…erver it starts does

`ovis add` reads OVIS_PREVIEW, OVIS_CLI_NAME and OVIS_RELAY_APP_URL from the
plugin's merged settings (its environment, then its `env` and `.env` files:
the values the server it starts gets) through `linkSettings`, so a preview
set in the settings file applies to it as it does to that server.
`fleetPreview` takes those settings; its default stays the process
environment, so its other callers are unchanged.
@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • New Features
    • In fleet preview mode, account linking now requires an interactive terminal and confirmation before listing the PC or displaying its QR code. Invalid input or cancellation stops the process without listing the PC.
    • Printed instructions can use a configured app address and CLI name.
  • Documentation
    • Clarified fleet-preview behavior and QR-code restrictions. Outside preview mode, existing linking behavior remains unchanged.

Fleet preview now requires terminal input and output for account linking and waits for confirmation before listing a PC or showing its QR code. Pairing instructions can use configured app and CLI names. Tests cover preview settings, confirmation input, and non-preview behavior.

Changes: Fleet preview account linking

Layer / File(s) Summary
Resolve and pass preview settings
server/preview.ts, scripts/plugin-link.ts, scripts/plugin.ts
fleetPreview accepts an environment map. The plugin passes preview mode and optional app URL and CLI name settings into account linking.
Gate account linking and update instructions
scripts/plugin-link.ts
Fleet preview requires terminal input and output. After sign-in, the command displays account details and waits for Enter before listing the PC or showing a QR code. Pairing instructions use configured app and CLI names.
Test preview behavior and document it
scripts/plugin-link.test.ts, changelog.d/add-confirm-under-fleet-preview.md
Tests cover terminal gating, confirmation input, settings precedence, configured instructions, and non-preview behavior. The changelog describes the preview behavior.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Possibly related issues

Merge Risk: Minimal · up to a13dd

This change only affects ovis add and ovis link when the fleet preview is enabled. It adds a terminal requirement and an Enter confirmation before a PC is listed. Behavior with the preview unset is unchanged, and the tests cover the new gating. No concrete merge-blocking risk was established.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: adding account naming and an Enter step before the QR code under the fleet preview. It matches the changeset, which gates ovis add and ovis link behind `OVIS_PREVI…
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.
Description check Passed The description follows the template with a Change section and a Validation section. The Change section describes the problem and the resulting behavior under OVIS_PREVIEW=fleet in detail. It does not…
Full details: Title check

Explanation

The title names the main change: adding account naming and an Enter step before the QR code under the fleet preview. It matches the changeset, which gates ovis add and ovis link behind OVIS_PREVIEW=fleet. The title is 85 characters, a bit long, but it is specific and accurate.

Full details: Description check

Explanation

The description follows the template with a Change section and a Validation section. The Change section describes the problem and the resulting behavior under OVIS_PREVIEW=fleet in detail. It does not link an issue, though it cites #3938 as the base and mentions a follow-up in #3957. The Validation section lists the typecheck, the test runs, and the check fast run with results. It also lists what was not run: a real terminal Enter step, real services, and Windows. The description covers the required content well.

Finishing Touches

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 e5c6a8e and a13ddae.

Files selected for processing: 5

  • changelog.d/add-confirm-under-fleet-preview.md
  • scripts/plugin-link.test.ts
  • scripts/plugin-link.ts
  • scripts/plugin.ts
  • server/preview.ts

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

Conflicts in scripts/plugin.ts and scripts/plugin-link.test.ts (imports): linkSettings now comes with link's deferred import of scripts/plugin-link.ts, and COMMAND_ALIASES from scripts/plugin-runtime.ts.
@devswha
devswha merged commit 1a38fbd into main Nov 16, 2026
23 of 24 checks passed
@devswha

devswha commented Nov 16, 2026

Copy link
Copy Markdown
Owner Author

Merge pass

Merged head 535de9e8a05c as 1a38fbdec960 on GitHub's checks, with no unresolved review threads.

Reviewer Verdict Note
claude CLEAR
codex CLEAR

@devswha
devswha deleted the feat/add-confirm-under-preview branch November 16, 2026 09:37
devswha added a commit that referenced this pull request Nov 16, 2026
…er the fleet preview (#3965)

## Change

Lets the plugin (`scripts/plugin.ts`) reach a machine profile, the
preview server from #3938, through its owner's unix
socket. It builds on #3955, which made `ovis add` read the fleet preview
from the plugin's settings. No release sets
the preview.

A machine profile answers only liveness on its TCP port, which the
plugin's health check does not take as a running
server. It takes its local owner on the unix socket that it records in
its state folder once it listens
(`serve.lock/http.json`, `{ port, hostname, socket, door: 1 }`).

When the plugin runs for a profile, that is `OVIS_PROFILE=machine` under
`OVIS_PREVIEW=fleet`:

- Both variables are read from the plugin's settings: its environment,
then its `env` and `.env` files, the values the
server it starts gets. The preview is read by `server/preview.ts`, as
for the rest of the plugin.
- The plugin takes the socket only when all of these hold:
- the state folder passes the profile's own check, the one the profile
makes before it serves from a folder
(`stateDirRefusal` in `server/machine-profile.ts`, which the profile's
start now calls too: one rule in one place);
- the record is a regular file of at most 4 KiB, opened without
following a link and without waiting, and names
    `door: 1` and `serve.sock` in the folder's real path;
- `serve.sock` is a socket, not a link, owned by this account, and not
writable by group or other.
- The plugin sends no token on that socket, and addresses it as
`http://localhost`, the Host and the Origin the
  profile takes there. These go to it:
- its health check (which `status`, `start`, `pair --approve` and `add`
make);
- the requests of `add` (also `link` and `login`) and `pair --approve`.
- The server counts as running only when it answers on that socket. With
no socket the plugin takes, it is not
running and the plugin sends it nothing; the TCP port is not asked
instead.
- `start` does not start a machine profile (the managed launcher cannot
bring one up). With none answering on
the socket it spawns nothing, writes nothing, says how a profile is
started (`OVIS_PROFILE=machine`,
`OVIS_PREVIEW=fleet` and a state folder of its own for `ovis-server
serve`) and exits 1. One that answers is
  reported as running.
- `pair` (without `--approve`), `phone` and `phone-setup` show no
address, start no pairing and do not ask or
change Tailscale: a profile's port serves no app, and a code started
there can be entered at no address. Each
says that a phone reaches the profile through the Ovis relay only, and
names `add` and `link --code`.
- A command keeps the door its health check passed on for all its
requests. `start` decides anew at each of its
health checks until one passes, since the record is written once the
server listens.
- A refusal on the socket is the answer.
- A profile whose herdr does not answer counts as running (its health
carries `machine_profile.runtime_down`), and
  `status` adds a line `engine: down` with the profile's reason.
- The output names the TCP address, as before; nothing printed names the
socket's path or the token.

Without the preview, or without `OVIS_PROFILE=machine`, the record is
not read, and every command behaves as before.

`scripts/plugin.ts` now imports `server/machine-profile.ts`. `status`
and `stop` still run with an empty
`node_modules` (checked by run, with the preview unset and with both
variables).

A changelog fragment is included
(`changelog.d/plugin-machine-profile-owner-socket.md`).

## Validation

On this head (`main` 678d87f merged in):

- `bun run typecheck`: passed.
- One run of `bun test scripts/plugin.test.ts
scripts/plugin-link.test.ts server/machine-profile.contract.test.ts`:
  318 pass, 1 skip, 0 fail.
- `bun run check fast`: passed (workflow syntax, generated types and
themes, typecheck, build; unit tests 17,738
  pass, 0 fail, 54 skip).
- macOS arm64 (27.0.1), Bun 1.4.2, in a fresh clone of this pull
request's head (b62a841): the two plugin test
  files, 234 pass, 2 skip, 0 fail.
- `main` 678d87f and this head, side by side with the real
`scripts/plugin.ts`, with the preview unset:
- Setup: stdout a pipe, `OVIS_TOKEN` set, a fake server on TCP, and a
stand-in on the profile's socket that logs
    its calls.
- Commands: `status`, `stop`, `add`, `add --print`, `link --code`,
`pair`, `pair --approve`, `phone` (with a
recording stand-in for `tailscale`), `phone-setup` and `help`. `start`
is left out: it spawns the real launcher.
- Five setups: nothing set, `OVIS_PROFILE=machine`, a record in the
state folder, both, and `OVIS_PROFILE=machine`
    in the settings file with a record.
- Result: the output, the exit codes and every request were the same,
and the socket was not asked.
- Tests in `scripts/plugin.test.ts` (`a machine profile, under the fleet
preview`), with the plugin run as a process:
- A real machine profile from `createServer` in the test process, with
its record as `serve()` writes it and a
stand-in herdr: `status` says it runs, and `add --print` reads the
account's status on the socket and then
refuses without a terminal. With its herdr stopped, `status` says
`running` and `engine: down` with the reason.
    With no door in its record, `status` says `down`.
  - A stand-in profile that logs every call on each door:
- `status`, `add` and `pair --approve` on the socket as `localhost`,
with no token;
- on a running profile `pair` and `phone-setup` send nothing and print
no address, code or Tailscale command;
`phone` never calls `tailscale`; `start` with no profile answering
spawns nothing and exits 1;
- the two variables in the settings file, the file after the
environment;
    - a 401 on the socket is not retried on TCP;
- the door a command's health check passed on is kept when the record
goes away afterwards;
- with both variables, nothing is sent anywhere when the record is
missing, not JSON, names no door, another
door or no socket, is larger than 4 KiB, or is a FIFO (`status` answers
at once);
- with both variables, nothing is sent anywhere when the folder does not
pass the profile's check, or
`serve.sock` is a link, in four folder set-ups; in a folder that passes,
its own socket is taken;
- with both variables, an app answering full health on the TCP port is
not taken: `status` says `down`, `add`
      stops, and `start` does not report it as running;
- with the preview off or `OVIS_PROFILE` not `machine`, the TCP port is
used and the socket is never asked.
- Each run checks that the output names neither the socket's path nor
the token.
- Each of these tests failed before the code it covers, except the
controls: the preview-off cases, the own-socket
case, and one that names the state folder through a link and `..`, which
passes before and after (the runtime
  resolves both spellings to the same folder).

Not run: Windows (these tests are skipped there; a profile does not
start on Windows), `add` or `link --code`
against a real relay on a profile, `stop` on a profile (it acts on the
plugin's own records, so for a profile
started by hand it says nothing runs and stops nothing), the socket
owned by
another account (one account cannot make one; the type and mode parts
are run), a real terminal, a real account,
relay or phone.

Left for a follow-up, #3968: three sentences the plugin prints for a
profile (`start` names `ovis-server serve`, which
is not on `PATH` for an installed copy; `phone-setup` at a terminal
still mentions a fresh pairing code; `stop` says
nothing runs for a profile started by hand), and `pair --approve`
waiting without a limit when a server answers
health and then stops answering (`main` does the same over TCP).
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