Repository navigation
fix(updates): fetch the Rust PTY host that an update from 0.4.13 left out - #1913
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
| Layer / File(s) | Summary |
|---|---|
Detect and install the missing host server/supervisor.ts, server/legacy-env.test.ts, changelog.d/rust-host-after-old-update.md |
The supervisor runs the installer for eligible releases that lack the host, records attempts, and skips attempts made within the prior six hours. Tests cover installation and retry timing. The changelog describes the legacy update behavior. |
Stop and await installation server/supervisor.ts, server/legacy-env.test.ts |
Shutdown aborts the installation and waits for it and the bridge before releasing the lock. Tests cover termination and child-process cleanup. |
Priority:
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix
Possibly related PRs
- devswha/ovis#1909: Adds Rust PTY host support to the release and updater; this PR handles the legacy-release case where the host is absent.
- devswha/ovis#1859: Adds the installer invoked here and the host assets it installs.
- devswha/ovis#1908: Uses the installed Rust PTY host by default on Linux and macOS; this PR installs the host for legacy releases that lack it.
Merge Risk: 
Minimal · up to ea9ab
-
No actionable merge-blocking risk is established for legacy Rust PTY host installation or supervisor shutdown.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
Full details: Description check
-
Explanation
The description clearly explains the problem, implementation, behavior, and validation results. It uses ## Problem and ## Test instead of the template's ## Validation heading, but the required information is present and detailed.
-
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 2 files. (1 skipped: 1 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches: 💡 1
-
📝 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.
Comment @coderabbitai help to get the list of available commands.
|
Merge pass gate review of 582ed09 (another model; programming + remove-ai-slops applied directly): two restart-safety blockers. The happy path works. 1. A failed install repeats on every supervisor start (
2. A restart can orphan an installer and start another (
What holds
The merge pass rechecks the fix (changed range only) with the same gate and then queues it first. |
… with the supervisor
|
Both blockers are fixed in 54e0ca9. 1. A failed install repeated on every start. Before each try, the supervisor now writes 2. An installer outlived the supervisor. The install now gets an New tests in
Results: |
|
Merge pass gate re-check of 54e0ca9 (the changed range only): the retry storm is fixed. One blocker remains: shutdown. Fixed: with the host record absent, three supervisor starts now give one install try. The 6 h marker is kept per release, and a corrupt marker is tolerated because only its mtime counts. Both new tests fail against in-memory mutants of their fixes. 65 tests pass and the typecheck passes. Still blocking: the supervisor exits before the installer group is dead (
Non-blocking notes: the marker write isn't exclusive, and its timing depends on the clock. Neither is a problem once the installer can't outlive the supervisor. |
… the supervisor exits
|
Merge pass gate re-check of ea9ab87 (changed range only): nearly there. One bound is missing. What holds: an installer and its child that both ignore SIGTERM are now both gone before the supervisor exits. Shutdown took 2.0 s. An immediate restart, a restart after the marker expired, and a start racing a shutdown never overlapped installers; the ownership lock refused the concurrent one. Retry backoff, #1859's checks and the fallback are unchanged. 66 tests pass, and so does the typecheck. The remaining gap: shutdown can wait forever (
Policy: this is the merge pass's own correction. Our earlier brief asked for both "nothing outlives the supervisor" and "shutdown is bounded", and no code can guarantee both for a process the kernel won't kill. The bound wins:
Test (non-blocking but worth it): the new test's child has no readiness handshake, and it was already gone in the reverted run, so it doesn't reliably pin a resistant descendant. Having the child signal "ready, ignoring TERM" before shutdown starts, and asserting event order, would pin it. The merge pass rechecks the next commit, changed range only, and queues it. |
…he install test's child report itself ready
|
The shutdown blocker is fixed in ea9ab87, and fd2df96 adds the gaps a review found. Fix (ea9ab87): Test (
Review (Codex gpt-6.1-sol, xhigh) of ea9ab87, all fixed in fd2df96:
|
|
Merge pass: fd2df96 is fine; the stop guard and the readiness handshake both help. The point in my 21:34Z comment is still open. |
|
Shutdown is bounded now, in e2732f6, which answers your 21:34Z and 21:37Z comments. What it does (
Two differences from what you asked:
Test: "exits even when a process of its Rust PTY host install escaped the group and holds its output open".
Review: Codex gpt-6.1-sol (xhigh) reviewed this commit and found no P1 or P2 problems. Its one P3, that the warning named the new release after a handover, is fixed in this commit. |
|
Merge pass review-work report. Overall: PASSED. This change touches the install path at supervisor start, so it went through the gate four times. CodeRabbit was rate-limited, and the gate reviews stand in for it.
Round 4 evidence
One policy change, made by the merge pass: round 4 still rejected the deadline warning, because it names the release directory rather than a pid, as the merge pass's own policy comment had asked. The merge pass accepts the directory instead. It identifies the try, Kept throughout: #1859's checks (the manifest for the package.json version, the crate tree, SHA-256, and a binary that runs, published atomically), the fallback to Node or a mirror on failure, and the ownership lock that refuses a second installer. CodeRabbit did not review this PR (rate-limited or skipped). The reviews above stand in for it. |
Problem
Updating from 0.4.13 in the app (Settings > Updates) leaves 0.4.14 without its Rust PTY host. The
update is built by the updater that is running, 0.4.13's, and that one has no
scripts/pty-sidecar.ts installstep (0.4.14's updater added it). The new release's own supervisortakes over after the install, but nothing fetches the host for the release it runs.
Found by the 0.4.13 -> 0.4.14 upgrade check, on Linux (a clean ubuntu:24.04 container) and on macOS
(the test MacBook Air, in a fresh
/tmpHOME with its own herdr). Both runs installed 0.4.13 with itsone-line installer, then clicked Update and restart in Settings:
~/.config/herdr-web-ui/updates/<hash>/release-*) has nobin/;Rust PTY host unavailable (.../release-*/crates/pty-sidecar/target/release/ovis-pty-sidecar: ENOENT)and
PTY host: Node;~/.local/bin/node .../release-*/server/pty/pty-host.mjs. That worksonly because 0.4.13's installer put a private Node in
~/.local/share/herdr-web-ui/node;PTY host: none (no Rust host and no Node for the sidecar), so panes are mirrored, and/api/healthanswersterminal_attach: false.Everything else in that update passed: the new release's supervisor takes over under the 0.4.13
launcher,
HERDR_WEB_TOKENandHERDR_WEB_TELEMETRYkeep working, and rerunning the one-lineinstaller moves the plugin to
devswha.ovisand installs a checked host.Change
server/supervisor.ts: once the supervisor runs a saved release that hasscripts/pty-sidecar.tsbut no host record (bin/ovis-pty-sidecar.json), it runs that release'sscripts/pty-sidecar.ts installin the background, with the updater's own boundedrunCommandandthe same 120 s limit as the update step. The install keeps every check it already makes: it takes
the manifest of the release named by package.json, compares the SHA-256, and checks that the
binary runs. A bridge on the Node sidecar picks the host up at its next attach, since
rustSidecar()looks again for each session. A bridge that started with no PTY host at all picksit up at its next start. Windows is skipped, because it has no Rust host.
The supervisor writes
bin/ovis-pty-sidecar.attemptbefore each try. The next start tries againonly 6 hours after that mark, the same wait as the unshallow fetch (#1252). So a PC that cannot get
the host (offline, a release without one, a check that keeps failing) does not download again at
every restart. A supervisor that starts while an earlier try is still running leaves
bin/to thattry. The install also gets an AbortSignal that the supervisor's shutdown aborts, so
runCommandsends SIGTERM to the installer's process group and the installer does not outlive the supervisor.
This helps anyone who updates in the app from 0.4.13 or older straight to the release with this
fix. An install already on 0.4.14 gets the host when it installs the next release, since 0.4.14's
updater fetches it. For anyone on 0.4.14 now, rerunning the one-line installer fixes it at once.
Test
server/legacy-env.test.tsgets three cases. Each runs the realrunSupervisor(and the realrunCommand) the way the 0.4.13 launcher starts it, on the 0.4.13-shaped fixture the neighbouringtests use. The release's
scripts/pty-sidecar.tsis a stand-in that records each run.the release, with
install.try. Once the mark is 7 hours old, the next start tries again.
SIGTERM to the supervisor reaches it.
All 11 tests in the file pass. Mutations: with the retry-wait check removed, the retry case fails.
With the abort on shutdown removed, the stop case fails with
the install's stop never happened.With the install call removed, the first case fails.
Real surface (Linux container, the release that 0.4.13's updater installed). This ran on the first
revision, before the retry mark and the abort were added; the tests above cover those two. With that
supervisor.tsdropped into the release and the plugin restarted, server.log showsOvis: installed the Rust PTY host of release v0.4.14 (sha256 ea09de03...). That hash matches therelease's
SHA256SUMSentry forovis-pty-sidecar-linux-x64. The next terminal attach in thebrowser ran
release-*/bin/ovis-pty-sidecaron the same bridge, with no restart. With Node thenmoved aside and the plugin restarted, the bridge reported
PTY host: Rustandterminal_attach: true. In the browser, typing, a resize (stty 37x145 -> 26x86),seq 1 200000and a chatround-trip all worked.