Repository navigation
feat(install): an ovis command, and --add to add the PC to your account at the end of the install - #3542
Conversation
… window and checks the account it joined `bun scripts/plugin.ts add` and `login` run `link` (COMMAND_ALIASES). The re-exec into the active release still passes the literal "link", the one name an older release knows. While link waits for the device that adds this PC: - it asks for the approve-here window again every 30 seconds (the window route alone, with x-ovis-local-only, no directory write), so a server restart no longer leaves it closed until the nine-minute renewal; - it stops after 30 minutes with exit 1. It reports success only when /api/account/status names the account that signed in and `enrolling` is no longer true; while enrolling it says so once and keeps waiting. A PC that ended in another account is reported with both ids and the Revoke all step, exit 1. A PC already in an account is named by the start of that account's id rather than as "your account". Who approves the adding device is unchanged: the pairings loop and its y/N prompt. Co-Authored-By: Claude Fable 5.2 <[email protected]>
… the 30 minutes, and cleans up after a mismatch - A local call that gets no answer (connection refused, a hang) is no longer the end of the command: the wait loop keeps the sign-in, polls on, and asks for the approve-here window again with the first call the server answers. - The window is asked for only until ten minutes before the run's end, so the server's ten-minute window never outlives a run that reaches its 30 minutes. The directory renewal in those minutes reuses the entry it already has instead of asking for the window. - Run on a PC that is in an account whose other devices are still being brought in, it waits for them (no sign-in needed) instead of exiting 0, and the 30-minute stop says so in that state. - On an account mismatch the PC is taken off the list of the account that signed in, and the PC is told the account it is in for its relay pass. Co-Authored-By: Claude Fable 5.2 <[email protected]>
…nt at the end of the install install.sh writes a small `ovis` launcher into ~/.local/bin. It bakes in no path: each run it finds Ovis on herdr-core (its checkout, with the dirs its service gives it) or the herdr plugin, and runs that scripts/plugin.ts, so `ovis add`, `ovis pair` and `ovis status` work and keep working after an update or a reinstall. A file of that name the installer did not write is left alone, with a notice. `curl -fsSL https://ovis.sh/install.sh | sh -s -- --add` (or OVIS_ADD=1) ends the install with the add step, read from /dev/tty. It runs only at a terminal that can be answered at and never under OVIS_NO_OPEN; anywhere else the installer prints the command to run. An unknown option fails with the usage before anything is installed. The last lines name `ovis add` and say to set OVIS_TOKEN first on a PC other people log in to. On Windows, scripts/plugin.ps1 passes a command's flags on (link --code) on both of its paths, and refuses anything that is not a plain --flag. Co-Authored-By: Claude Fable 5.2 <[email protected]>
…e ovis command run the plugin over an old herdr-core checkout - --add at a terminal prints the OVIS_TOKEN line before the add step starts, once, instead of after the PC is already in the account. - The launcher looks for the herdr plugin first and the herdr-core checkout second, as the installer does: a checkout left beside a plugin is an earlier install, and `ovis` no longer addresses it. - A launcher that cannot be written (ovis.new is a folder) no longer ends the install under set -e. - A test ties the release-detection greps to the real scripts/plugin.ts. Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
…mand # Conflicts: # changelog.d/cli-add-login.md # docs/guide.md # docs/relay.md # scripts/plugin-link.test.ts # scripts/plugin-link.ts
Deploying ovis with
|
| Latest commit: |
bf909ce
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://c61298cb.ovis.pages.dev |
| Branch Preview URL: | https://feat-install-ovis-command.ovis.pages.dev |
…r a running app Review findings on the ovis command and the installer's --add step: - The launcher ran herdr's checkout, which stays at the version first installed: on one from before `link`, `ovis add` ended in a usage line while the installer named it. For add, login and link the launcher now finds the running release as running_code does and runs that; where no installed release can add a PC, it and the installer's closing lines say to update instead of naming a command that fails. - --add ran the add step while the app was down (a fresh PC whose herdr the installer cannot start). It now runs only when status says running; otherwise the closing lines say what to run once the app is up. - The launcher is written through mktemp, so a file or link called ovis.new in ~/.local/bin is never written through, replaced or deleted. - --add checks it holds the terminal's foreground before the add step reads there: a background install prints the hint instead of being stopped. - Without a launcher of the installer's, the closing line names the running release's script under the name that release knows (link or add). - Another ovis elsewhere on the PATH is never hidden: where ~/.local/bin comes before it no launcher is written, and either way the installer says which one the name runs. - The guide's Uninstall removes ~/.local/bin/ovis. Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
Fixes for the merge pass's review of 46f5188 (both reports), pushed as aa52f2a. Each has a test in MEDIUM
LOW Not changed: Validation: |
… and port, read with the plugin's settings The launcher and the installer took whichever updates/*/current.json the listing gave last that named the checkout's commit. A second folder (another port, another checkout at the same commit) made ovis add run a stale release or ask for an update that was already there. Both now find the release as scripts/plugin.ts does (release_js): the settings from the shell, then the plugin's env and .env files; the state dir; PORT, the saved plugin-port, or 7317; and only updates/<sha256(root:port)[:16]>/current.json. - the installer's --add and its closing line use the checkout's own script where it knows link, and the running release only for a checkout from before it - printed paths are quoted where a shell would split them (a home directory with a space) - the guide's Uninstall line removes only the installer's launcher - the installer and the docs say that another ovis keeps the name only until ~/.local/bin comes before it on the PATH Co-Authored-By: Claude Fable 5.2 <[email protected]>
…under its old name Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
Fixes for the merge pass's two reviews of aa52f2a, pushed as bf909ce (one fix commit, one line for the conventions list, and a merge of main). Round one's fixes are untouched. 1. HIGH: 2. MEDIUM: the plugin's 3. LOW: the guide's Uninstall line removed an 4. LOW: printed commands broke with a space in HOME — fixed. 5. LOW: "never hidden" did not survive Also: Checks
|
Merge passMerged head
Three review rounds (Claude Opus 5.5 and Codex Terra each); both CLEAR at this head. The release an |
…d without the owner meaning it (#3609) ## What Eleven follow-up findings, in two groups: five across the onboarding surfaces (items 1 to 5), and six about how a terminal reads a person's answer to a request (items 6 to 11, following #3581). ### Items 1 to 5 Five follow-up findings from the reviews of pull requests that are now in main. Each is a way a device could be approved, or a PC or device added under an account, without the owner meaning it. 1. **Follows #3542 (`install.sh --add`).** Lines typed while the installer worked, or pasted after the install command, were still in the terminal's input when the add step began to read from it. A `y` and Enter typed ahead could approve the next device that asked. 2. **Follows #3570 (the PC's approval prompt).** Shift+Tab from another dialog's first stop landed on the prompt's last button, so two Shift+Tabs and an Enter typed for the dialog pressed Approve. The guards (keys for 1 s, clicks for 500 ms after the prompt arrives, moves or is handed the focus) were measured against the time the handler ran, so on a busy page a key or click made before the guard ran out, and heard late, could approve. 3. **Follows #3555 (the hosted app's shell).** The confirm records the sign-in it was drawn for, but only in the page's memory. When the hosted app reloaded itself for a newer build between the confirm and the enrollment, the reloaded page enrolled the PC as whoever was signed in by then: another tab signing in as someone else in between added the PC under that account. 4. **Follows #3584 (Add this PC).** A relisting that was given up for getting no answer still had its request for the window on its way; when it reached the PC after Stop waiting, nothing closed the window again. And Stop waiting's close (`POST /api/relay/link/close`), arriving late, could shut the window of a new wait begun meanwhile. 5. **Follows #3544 (Add this PC, resumed).** A resumed wait opened a ten-minute approve-here window before it compared which PC had answered, and believed "added" of whichever PC answered. A page that now answers for a different PC got a window opened on it, and a PC already in the account was said to be the one that was added. ### Items 6 to 11: the answer typed in a terminal (follows #3581) `ovis add` / `login` / `link` and `pair --approve` ask in the PC's terminal about a device that wants in, and an approval lets it into the PC. #3581 (in main, 64344a5) made an approval need the request's digits and dropped lines typed ahead. Its last two reviews left these six: 6. **Three digits that two requests share.** The last three digits approve, and two requests end in the same three once in a thousand pairs: a line typed for one approved the other. 7. **A line typed while an answer was lost.** When the POST that carries an answer got no reply, the request was asked about again, and a line typed meanwhile answered it. 8. **A typo declined for good.** Any line that was not the digits declined, so a `y` out of habit or a mistyped digit ended the request. 9. **Full-width digits.** Digits typed with an input method in its wide mode (222) did not match. 10. **A line begun before a run's first prompt.** The terminal hands a line over only at Enter, so what was typed and not sent before the first question came as part of the line sent at it. 11. **`pair --approve` took buffered answers.** It read one line per request with no dwell and no drop, so a second line sent behind an answer answered the next request, and piped input approved. ## How 1. `install.sh`: `discard_typed` empties the terminal's input right before the add step, after the terminal and foreground checks and under the INT trap: with perl's `tcflush`, as the star question does, else with `stty -icanon min 0 time 0` and `dd`. Where neither can, the add step does not run and the closing lines name the command. **What the add step does itself:** what is typed after the add step has started is that step's own to tell from an answer: #3581 (in main, 64344a5) takes a line as an answer only when it was typed after its request was shown, and items 6 to 11 below go further in `scripts/plugin-link.ts` (the add step now also empties the terminal's input itself as each question first shows). The installer's discard stays: it runs before the sign-in, where the add step reads nothing yet. **Only on a release with that reader:** the installer is served from main but installs the latest release, and up to v0.5.2 that release's `link` asks `[y/N]` and takes the next line. So `add_pc` runs the add step only when the release that runs has `export function answerOf` in `scripts/plugin-link.ts`; otherwise it says to update and prints the command. 2. `useFocusTrap.ts`: `overlayEntry` makes a prompt's button reachable by Tab only from inside that prompt; from outside, in either direction, the prompt itself is entered first. `RelayPairingPrompt.tsx`: the key guard starts again whenever the focus comes into a prompt from outside it, and both guards count to the event's own `timeStamp` (and to the keydown or pointerdown a click comes of, when earlier), capped at five seconds. 3. `shellState.ts`, `shell.tsx`, `accountController.ts`: the sign-in's id and the PC's id (no token) cross the shell-update reload in the tab's session storage. The next load reads them and leaves them there until the app opens, another confirm is acted on, or the PC is forgotten, so a second reload on the way finds them too (the same now holds for main's "a key of its own" marker). The reloaded page goes on under that sign-in only when it is still the one stored; with another, or none, the PC opens with the key this page holds and the enrollment does not run. 4. `addThisPc.ts`, `AccountSection.tsx`: every close from the page goes through `closeAddWindow`, and a window is asked for only once every close sent before was answered (a minute at most). The late close is tied to the listing itself as well as to the attempt's end, once per attempt. A listing whose wait was stopped ends at once (`AddPcWaitOver("ended")`): before the window is asked for, and right after it opened. 5. `addThisPc.ts` (`pcAnswers`), `AccountSection.tsx`: the wait reads `web_ui.server_id` from `GET /api/health`, which opens nothing, before every reopen, before a relisting asks for the window (`listThisPc` for a wait) and before it believes the PC has joined. Where the health does not tell the id, the hosted app's page names the PC; with neither, no window is opened and nothing is said. The check of the link's own id stays, for an address that changes between the two requests; the window that reopen opened on the other PC is then closed again. Items 6 to 11 are in `scripts/plugin-link.ts` (one implementation, `asking`, used by `ovis add` and by `pair --approve` through `approveWaiting`), `scripts/plugin.ts`, their tests, `docs/relay.md` and `docs/guide.md`: 6. A request asks for all six digits, and says why, when its last three are also those of a request asked about earlier in the run or waiting now; only all six approve it then. A request already asked about with three is asked about again with all six as soon as such a request waits beside it (`beside`, at every look), and `ovis add` reads the waiting requests once more before it sends an approval typed as three digits. `pair --approve` does the same before a three-digit approval (`ApproveOptions.list`). 7. `lost()` arms the one-shot drop when an answer's POST fails with no reply: the next line handed over answers nothing, whichever request is asked about by then. 8. `answerOf` returns no answer for a line that is neither the digits nor empty. One line says what approves and what declines, and the question is asked again. Enter by itself still declines. Three or six digits that are not the request's get a line of their own: they are not this request's digits, the request may be another device's, and Enter by itself declines it. 9. The line is NFKC-normalised before it is matched. 10. `discardTyped` empties the terminal's input queue with the system's `tcflush` (through `bun:ffi`: libc on Linux, libSystem on macOS) as a request's question first shows. Where that cannot be done (Windows, no C library found) the first line after each question answers nothing and the question is asked again. 11. `pair --approve` asks through the same loop: the 1.5 s dwell, one line per request, the drops above, and input that is not a terminal answers nothing: the command says so and exits 1 without sending a decline, so the requests keep waiting (`ovis add --approve` still declines what shows in the window its own run opened). An answer the server does not take is asked for again instead of ending the command. ### Trade-offs, where the guard wins - **Item 10's limit.** The terminal is read a line at a time, so when a line was begun is never seen. Keys pressed in the moment after a question showed, before it was read, are part of the line sent at it; such a line approves only if it is that request's own digits (after the dwell) and declines only if it is empty. - **Item 10 costs an answer typed too early.** Digits typed before a question showed stay on the screen in front of it but were discarded, so Enter pressed at it is an empty line and declines; the device has to ask again. Not changed (a decline is the safe side, and making the first Enter answer nothing would take two Enters for every decline); `docs/relay.md` and the changelog fragment say so. - **Item 6:** between two looks (two seconds at most) a request that shares the three digits can come to wait unseen; the extra read before a three-digit approval is sent closes that, at the price of one more local request per such approval. A request that starts waiting after that read and before the POST is not seen. - **Item 10 on Windows** takes two lines for every answer, a decline included. - **Item 5 needs herdr to answer.** `GET /api/health` without a scope answers only after herdr's ping. While Ovis is up and herdr is stopped, a wait's window is not reopened or relisted, and **"This PC is in your account" is withheld too**: the screen keeps saying "Waiting" until herdr answers, or the wait expires. The press itself needs no health. A follow-up outside this surface could name `web_ui.server_id` in the `?scope=bridge` answer. - **Item 2's age cap cuts both ways, and the refusal is silent.** In a browser whose `event.timeStamp` runs behind `performance.now()` (clock drift after the PC slept), every key or click counts as five seconds old, so Approve does nothing for about 5.5 s (pointer) or 6 s (key) after a prompt arrives, with no sign why. And a key made inside the guard but heard more than five seconds later on a frozen page counts as five seconds old and can approve. - **Item 1:** a perl whose `tcflush` fails does not fall back to `stty` and `dd`; the add step is skipped and the command printed. ## Review ### Items 1 to 5 An independent reviewer read the branch (verdict: fix, then ship). Its findings and what became of each: - **Medium, item 4: a close that main guaranteed was gone.** The branch closed late only when the listing promise settled, and `listThisPc` did not ask `wait.running()` after the window opened, so with the account directory's read hanging the window reopened after Stop waiting was never closed; a relisting still reading health at Stop went on to open a window. **Fixed** (62ee8aa): `listThisPc` throws `AddPcWaitOver("ended")` for a stopped wait right after `pcAnswers` and right after the window opens, and the attempt-end close is back beside the listing's own, once per attempt. Tests: `addThisPc.test.ts` "a listing for a wait that was stopped opens no window, and reads nothing once a window on its way has opened" and `AccountSection.addThisPc.test.tsx` "Stop waiting while a listing asks for the window closes the window it opens late, also when the account's directory never answers"; both failed before the fix. The component test passes with either of the two changes alone, so it does not hold the attempt-end close by itself; the lib test holds the other. - **Low, item 5: "added" is withheld while herdr is down.** Real; not changed, the guard wins. Said above. - **Low, item 2: the age cap.** Real; not changed. Said above. - **Low: focus-trap browser regressions and where they ran.** See Validation. - **Info, not fixed here by agreement** (outside the five): a late close from Add this PC can shut a window opened by Settings' pairing link (`RelayPanel.tsx` calls `requestRelayLink` outside the new ordering), and a close from another tab is not ordered; `starts` is per copy, so one copy's late close can shut the window of a listing another copy began (as on main); item 3 binds only signed-in confirms, so a pairing made with no consent still acts as whoever is signed in after the reload; Codex's second #3555 finding (enrollment can end the terminal's session after the app opened) is untouched; a failed `stty` restore would leave the terminal in non-canonical mode. ### Items 6 to 11 An independent reviewer read the six terminal commits at f78ccbe (verdict: fix, then ship). Its findings and what became of each: - **Medium, item 6: half closed in `ovis add`.** Whether a request needs all six was decided once, when it was first asked about; a request with the same last three that came to wait afterwards left the "Type 456" prompt standing, and `456` read off the other device approved the request on the screen. **Fixed** (710920b): `beside` compares the waiting requests at every look and once more before a three-digit approval is sent, and asks again for all six with a line saying why. Tests in `scripts/plugin-link.test.ts`, "a request whose last three digits another request shares": "asks again for all six once another request with the same last three starts waiting beside it" and "looks once more before it sends an approval typed as three digits"; both failed before the fix. A third holds that all six, or a decline, already typed still stand. - **Low, item 10: digits typed ahead, then Enter, decline.** Real; not changed, the guard wins. Now said in `docs/relay.md`, the fragment and above. - **Low, item 10: `discardTyped` had no test, and its macOS branch had never run.** **Fixed** (7473352, df602ec): `scripts/plugin.test.ts` "discards what was typed at a real terminal before the question showed" runs `pair --approve` on a real pty (`script`), types the request's digits before the question and Enter after the dwell, and expects a decline. With the wrong queue selector in `discardTyped` it fails with "Approved." on Linux and on macOS (both tried). It is skipped on Windows and where `script` is not installed. ### After the reviews at df602ec Both reviewers were clear at df602ec (Opus with four lows, Codex with two mediums). `origin/main` with #3586 (`ovis add` ends in one QR code) was merged in, keeping its QR path and this PR's answer rules for `--approve`; the QR path's keep question now discards the terminal's input as it first shows and reads the word NFKC-normalised. Then, each with a test that fails without it: the wording for digits of another value (Opus low 1), the second read in `pair --approve` (low 2), no decline from a non-terminal `pair --approve` (low 4), the installer's add step only on a release with the new reader (low 3 and CodeRabbit's thread at install.sh:558, answered and resolved), and Codex's two mediums, both reproduced: the consent kept over a second reload, and the window opened on another PC closed. Details in the PR comment of the same name. ## Validation On this head (65ca063), which has `origin/main` at 35b00a8 merged in, unless a line names an earlier head. - `bun run check fast` through the queue: every line ok (workflow syntax, generated types, generated themes, typecheck, build, unit tests: 15533 pass, 0 fail, 51 skip in 894 files). - The tests added after the reviews at df602ec were watched failing without their fixes (the shell and Add this PC ones by running them on the unfixed code; the others assert behaviour or words the unfixed code does not have). The macOS hand run of the pty test below was at df602ec and not repeated. - Items 6 to 11: each has tests with an injected clock and a fake keyboard. The tests added for the review's findings were watched failing before their fixes at this head; those of the six original commits were written before their fixes by the session that made them and were not watched failing again here. One real terminal was used, a pty made by `script` for the test above: on this Linux PC inside `bun run check fast`, and on macOS 27.0.1 (the test MacBook Air, a fresh clone of main in `/tmp` with this PR's diff applied, deleted afterwards), where it passed three times and failed with the wrong queue selector. GitHub's macOS job does not run `scripts/plugin.test.ts`, so macOS has that one hand run and nothing automated. Whether the CI runner image has `script` was not checked: without it the pty test is skipped there. - Items 6 to 11, not run: no real `ovis add` against a real server, account service or second device; no person at a keyboard; Windows (the path where the input cannot be discarded) only through the fake keyboard; musl only by the library name in the code. - Items 1 to 5: each new or changed test was watched failing without its fix. The independent reviewer also overlaid the tests of the first five commits on a throwaway copy of `origin/main` and saw them fail there. - Browser scripts (items 1 to 5), run at the earlier head ff6bddf and not again since: three merges of `main` came in after that run, and 65ca063 changes `AccountSection.tsx` (one branch of the reopen) and `shell.tsx`. Each with `bun run check run` on the isolated test session, **on this PC's host, not in the CI runner image**: `scripts/relay-pairing-prompt-regression.ts` (item 2, with `--build`), `scripts/ui-regression.ts` (items 4 and 5, with `--build`), and for the shared focus trap `scripts/settings-pages-demo-regression.ts` and `scripts/drawer-modal-regression.ts`. All passed. The other scripts that go through `useFocusTrap` (Files, the file viewer, ConfirmDialog rounds and the rest of the browser set) were not run by hand; they run in the runner image in this PR's "Integration and browser" job. - `scripts/relay-pairing-prompt-regression.ts` presses at the 1000 ms and 500 ms boundaries with 250 ms of slack, so only the unit tests (injected clocks) hold the exact boundaries. Items 1 to 5, not run: no real terminal and no real install (`install.sh` ran only in its tests, under a throwaway HOME, with stand-ins for perl, stty and dd); no real account service, relay or second device; no real browser clock drift for item 2's cap. `install.sh` on macOS and Windows is left to GitHub's macOS and Windows jobs. Needs a real review: approval and consent paths (pairing prompt, enrollment, add-this-PC, the installer's add step, the terminal's answer loop of `ovis add` and `pair --approve`) The merge pass agreed on these eleven (the five, then the six from #3581's last reviews), and only these, as the one follow-up PR before the release; everything else from those reviews waits. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Fable 5.2 <[email protected]>
…prove a FIFO unread by who gets its text (#3630) ## Why Two tests fail on a busy machine with their code untouched. - `server/pty/host.test.ts`, "PtySession on the node PTY host > ends a plain exit without waiting out the hold for a closed terminal": 151.99 and 213.5 ms against 150 in two local merge gates (#3585, #3354), 233.6 and 166.7 ms in two Integration jobs on GitHub (run 42827626297 attempt 1 of #3542, run 42831916527 attempt 1). - `server/opencode.contract.test.ts`, "answers the catalog and a cold @ send within budget while opencode.json is a FIFO": 2047 ms against 2000 in the local gate of #3585. Each measured mostly something else than what it guards. - The PTY test's 150 ms ran from before the host's spawn. The Node host's start is 37 of the 55 ms an idle run takes; the behaviour, an exited command not being held for the host's 200 ms wait, is the last 17. - The FIFO test's 2 s is the 1.5 s attach budget plus delivery. The server never opens the FIFO, so none of it is the FIFO. On one CPU the test fails every time (2009, 2023 ms). ## What - PTY: the command leaves a file as it exits (`: > "$1"; exit 7`), and the 150 ms run from that file's own time (its mtime, the system's word for when the command wrote it) to the reported exit. What the test process does late only makes the span longer, so a host that holds the exit cannot pass on a busy machine. (The first head of this PR started the clock when the test saw the file; the review showed that could hide a hold.) Same number, same exit code. From there the exit is 18 to 23 ms away on the Node host (the Rust host's whole test takes 4 to 5 ms); a waited hold adds 200 ms. The marker is a file and not output because the Node host ends a pty whose last byte comes with the hangup another way (see "Not in this PR"). - FIFO: a writer waits at the FIFO from the start, and the test goes on only once the writer has said it is about to open the FIFO and sleeps in that open, so no read can come before it waits. Its open returns only when something opens the FIFO to read, and that reader gets its text. At the end the test opens the FIFO itself, without waiting, and must get the text. No time is counted, and a server that reads the FIFO is not held by it, so a regression fails in about 4 s instead of 7. The test is renamed "answers the catalog and a cold @ send without opening an opencode.json that is a FIFO". - No product code changes. Two things change in what the FIFO test catches: - It now also fails when the server opens the FIFO without waiting on it (`O_NONBLOCK`, refused by its descriptor). The old test passed there. `openRegular` checks the path before any open, and the test now holds it to that. - It no longer bounds the catalog at 4 s or the first key at 2 s. A cold send slowed past 2 s by something other than the FIFO failed before and passes now. The attach budget has its own test, checked at its boundary (#1741). ## Proof In the CI runner image, one container at a time, commit ce11b34 plus patch files. | Product | Old tests | New tests | |---|---|---| | as is, 8 CPUs, whole files ×3 | pass | pass (41 pass / 26 pass, 0 fail) | | as is, with a Rust host built from main, `host.test.ts` ×3 | pass | pass on both hosts (64 pass, 0 fail) | | Node host waits out the hold for an exited command | fail ×3 (322 to 371 ms) | fail ×3 (206 to 207 ms) | | Rust host waits out the hold for an exited command | fail ×3 (404 ms) | fail ×3 (200.4 ms) | | the scan reads `opencode.json` with a plain open | fail ×3 (catalog 5.0 to 5.2 s) | fail ×3 (the text is gone) | | the cold send reads `opencode.json` with a plain open | fail ×3 (first key 6.2 to 6.4 s) | fail ×3 (the text is gone) | | forced: the host starts 120 ms later, delivery is 600 ms slower | fail ×3 both (198 to 208 ms; 2115 to 2217 ms) | pass ×3 both | | forced: one CPU, whole files ×2 | PTY pass, FIFO fail ×2 (2009, 2023 ms) | pass ×2 both | | the server opens the FIFO without waiting and refuses it | pass ×2 | fail ×2 (by design) | ## Validation Ran: - In the CI runner image (`herdr-ci-runner:local`), three times each, on 8 CPUs: `bun run check run -- env HERDR_TEST_MODE=integration bun test --timeout 15000 ./server/pty/host.test.ts` (41 pass, 29 skip, 0 fail) and `bun run check run -- env HERDR_TEST_MODE=integration bun test --timeout 15000 ./server/opencode.contract.test.ts` (26 pass, 0 fail). The same two commands twice on one CPU: pass. - The first command three more times with `crates/pty-sidecar` built from main (Rust 1.85, musl) in place: 64 pass, 4 skip, 0 fail. - The mutation and forcing runs of the table above, each test alone (`-t`). - On the host: `bun run typecheck`; `bun test --timeout 15000 ./scripts/conventions.test.ts ./server/conventions.test.ts ./server/catalog.conventions.test.ts ./src/conventions.test.ts` (63 pass). - `bun run check fast`: pass on this head (15742 unit tests pass, 0 fail). - On this head, in the CI runner image: both files three times (67 pass, 0 fail each), and the two changed tests with the Node host made to wait out the hold and the scan made to read `opencode.json`: both fail, twice (211.7 and 212.2 ms against 150; the text handed is `""`). - Checked again on the final diff by the session that opens this PR, in the CI runner image: both files twice (67 pass, 0 fail each), and the two changed tests with the Node host made to wait out the hold and the scan made to read `opencode.json` (both fail, twice: 208.4 and 206.9 ms; the text handed is `""`). The independent review agent meant for this change ended on the account's rate limit before it reported, so this check and a reading of the diff stand in for it. Skipped: - `bun run check full`, the rest of the integration suite, the browser lanes (no UI change). - Native Windows and macOS: neither file is in those jobs. - GitHub's "Rust PTY host" job, which runs `host.test.ts` on its own build: it runs on the PR. No changelog fragment: tests only, nothing a user notices, as in #3617, #3604 and #3605. ## Not in this PR - The Node PTY host holds a command 200 ms, or kills it, when its last output is read together with the hangup: `printf X; exit 7` is reported after 242 ms where `exit 7` takes 51 and the Rust host 2, and `printf X; exec 0<&- 1>&- 2>&-; sleep 0.05; exit 3` is reported as 137 where the Rust host says 3. The host takes the socket's end of stream for node-pty's destroy after an exit. It needs its own fix and parity tests. - The other tests that assert elapsed time under a fixed number. The tightest are `server/prompt.test.ts:6651` (`< 1_790` over a 1.5 s wait), the first-key gaps in `server/opencode.contract.test.ts:1102` (`< 1_000`, seen up to 774 ms) and `server/prompt.contract.test.ts:564` (`< 600`). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Fable 5.2 <[email protected]>
What
Adding a PC to an account from its terminal meant finding the plugin's folder and typing
bun <that folder>/scripts/plugin.ts link. Now:oviscommand into~/.local/bin:ovis add,ovis pair,ovis status. It holds no path of the install; each run it looks up the herdr plugin (devswha.ovis, or the id before the rename) and, when herdr lists none, Ovis on herdr-core in~/.local/share/ovis/appwith the settings and state dirs its service gives it. Anovisthe installer did not write (no mark on its second line, a link, a folder) is left alone, and the installer says so. Anotheroviselsewhere on the PATH does not lose its name to the install: where~/.local/bincomes before it no launcher is written; where it comes first the launcher is written, and the installer says which one the name runs and that the launcher takes the name once~/.local/bincomes first. On a plugin checkout from beforelink(first installed before v0.5.0),ovis addruns the release that Settings → Updates installed for that checkout and port; where no installed release can add a PC it says to update.curl -fsSL https://ovis.sh/install.sh | sh -s -- --add(orOVIS_ADD=1) ends the install with the add step, reading its answers from/dev/tty. It runs only at a terminal that can be answered at, in its foreground, while the app runs, and never underOVIS_NO_OPEN; anywhere else (a script, a background job, a fresh PC whose herdr is not started yet) the installer prints the command to run. A failed or interrupted add does not fail the install.ovis add(by its path when~/.local/binis not on the PATH) and say that on a PC other people log in to,OVIS_TOKENis set first. With--addat a terminal that line is printed before the add starts.scripts/plugin.ps1passes a command's flags on (plugin.ps1 link --code) instead of dropping them. No launcher on Windows yet.How
install.shgainsrelease_js,quoted,launcher_text,find_other_ovis,write_launcher,ovis_command,find_add_name,add_command,in_foreground,add_pc,token_lineandclosing_lines. The launcher is written to amktempfile beside its target and moved over it. A release from beforeadd/loginis told by grepping the running release'sscripts/plugin.tsforCOMMAND_ALIASES, and is run aslink; with neither, the installer and the launcher say to update in Settings → Updates instead of naming a command. The release that runs is found byrelease_js, JavaScript that the installer (running_code) and the launcher both run under Bun, the wayscripts/plugin.tsfinds it: the settings from the shell, then the plugin'senvand.envfiles (read, never run;.envwins); the state dir (OVIS_STATE_DIR, else underXDG_CONFIG_HOMEor~/.config); the port (PORT, else<state>/plugin-port, else 7317); and onlyupdates/<sha256(root:port)[:16]>/current.json. The launcher uses it only for a checkout from beforelink; a newer checkout's own script hands on by itself, and--addruns that script. Paths in printed commands are single-quoted where a shell would split them. Docs (docs/guide.md,docs/relay.md) useovis add; the guide's Uninstall line removes only a launcher with the installer's mark.Difference from the plan: the plan had the launcher look at the herdr-core checkout first. It looks at the herdr plugin first (see Review, finding 4), which is the order the installer itself enforces: with a plugin listed it never installs herdr-core's Ovis.
Review
An independent review of the first commit said fix-then-ship, with four low findings; all four are fixed in the second commit.
OVIS_TOKENline came after--addhad already added the PC: real.add_pcprints it beforeplugin.ts addstarts andclosing_linesleaves it out for that run; the test asserts the order and that it is printed once.write_launcher's barerm -fcould end the install underset -e(ovis.newa folder): real. Nowrm -f … 2>/dev/null || true; a test covers the folder, a read-only~/.local/binand a.localthat is a file.scripts/plugin.tsforCOMMAND_ALIASES,"link"and"phone", and checksinstall.shgreps those words.oviscommand runs the plugin; a test covers both present, and the plugin removed again.The merge pass's two reviews of 46f5188 (two medium, five low) are fixed in aa52f2a; each item and its test is in the comment of that push.
Its reviews of aa52f2a (one high: the launcher and the installer ran whichever update folder was listed last; one medium: the plugin's
env/.envsettings were ignored; three low: the Uninstall line, unquoted paths, the "never hidden" wording) are fixed in bf909ce; each item and its test is in the comment of that push.Validation
bun run check fast: every line ok at bf909ce (workflow syntax, generated types and themes fresh, typecheck, build, unit tests 14835 pass / 0 fail / 51 skip in 888 files).bun test scripts/install-ovis-command.test.ts: 39 pass. The tests of the last round were written first: against aa52f2a'sinstall.shthe file gives 32 pass / 7 fail.sh -nanddash -noninstall.shand on the launcher it writes.scriptand are skipped there), native Windows (scripts/plugin.ps1andscripts/windows-plugin.test.tswait for the Windows job), and a realovis addagainst an account.shellcheckis not installed on this host, soinstall.shwas not linted locally.install.shandscripts/plugin.ps1, so GitHub's macOS and Windows jobs check it and it waits for GitHub's checks rather than a local merge gate.Needs a real review:
--addstarts the account sign-in and the PC's admission from the installer, and the launcher decides which install's state and tokenovis addandovis pairact on.🤖 Generated with Claude Code