Skip to content

test(output): make breakPath() fail the spawn on both PTY hosts - #2364

Merged
devswha merged 1 commit into
mainfrom
test/breakpath-rust-pty-host
Oct 29, 2026
Merged

devswha merged 1 commit into
mainfrom
test/breakpath-rust-pty-host

Conversation

@devswha

@devswha devswha commented Oct 29, 2026

Copy link
Copy Markdown
Owner

Closes #2344

What

breakPath() in server/output.contract.test.ts is the fixture that makes a terminal attach fail to spawn for two tests:

  • a terminal attach that cannot spawn (#154) > reports the failure and leaves the pane attachable, never a record without a pty
  • an attach herdr refuses over a read in progress > ends the terminal, not the server, when a retried attach cannot spawn

It only broke the Node sidecar, by putting PATH=/nonexistent. The server picks the Rust PTY host by absolute path (OVIS_PTY_SIDECAR_BIN, else the installed bin/, else crates/pty-sidecar/target/release), so with a local build the spawn still started and both tests timed out. It also missed the Node that install.sh puts under ~/.local/share/ovis/node, which realNode() finds through HOME rather than PATH.

While the fixture is active it now also:

  • points OVIS_PTY_SIDECAR_BIN at a path that does not exist, so the Rust host fails its check and the server falls back to Node;
  • points HOME at an empty directory under the test's temp root, so the installer's Node is hidden too;
  • reads nodeSidecarAvailable() before breaking anything, so a run on the Rust host does not cache Node as missing for the tests after it.

Every variable is restored exactly: an unset one is deleted again. This is a test-only change; no production code changes.

Verification

All runs use bun run check run bun test --timeout 15000 ./server/output.contract.test.ts on this PC (Linux x64, herdr 0.9.5). The Rust host is a copy of the 0.4.18 release binary placed at crates/pty-sidecar/target/release/ovis-pty-sidecar; there is no cargo here.

Setup Before After
Rust host built locally 12 pass / 2 fail (the two tests above, 10 s timeouts) 14 pass
OVIS_PTY_SIDECAR=rust with the host present - 14 pass
No Rust host (Node sidecar) 14 pass 14 pass
Installer Node under HOME (~/.local/share/ovis/node/bin/node, simulated with a temp HOME) 12 pass / 2 fail 14 pass
Rust host present and installer Node under HOME - 14 pass

bun run check fast passes.

Review

  • omo-native-code-reviewer: APPROVE. LOW findings: the fixture's comment overclaimed, and the installer Node under HOME still escaped. Both are fixed here (the comment is reworded and HOME is now hidden).
  • Codex (gpt-6.1-sol, fast, xhigh): CHANGES REQUESTED on the first head with one MEDIUM, the same installer-Node escape. It is fixed and reproduced fail-first (row 4 above). It also noted that a run on the Rust host could cache Node availability as false during the fixture; breakPath() now reads it first.
  • Re-review of this head (777f4cd): Codex APPROVE with no findings; omo APPROVE with two LOW notes, both below. Both checked that the HOME swap leaves nothing behind: Bun's os.homedir() does not follow process.env.HOME, lazy lookups read HOME again on each call, and herdr stays on the check session's own socket.

Notes

  • LOW (omo): the HOME swap is process-wide, like the existing PATH swap. While the fixture is active (until the failed spawn is reported, about 250 ms in these runs), anything that reads HOME on each call sees an empty directory. Under bun run check run, herdr is reached through HERDR_SOCKET, so RPCs are unaffected. The empty directory is removed with the test's temp root.
  • LOW (omo, older code): PATH is restored by assignment even when it was unset, while the other variables are deleted. PATH is always set in practice, so this is left as it is.

breakPath() only broke the Node sidecar, by putting no node on PATH. The
server picks the Rust PTY host by absolute path, so with a local build in
crates/pty-sidecar/target/release the spawn still started and the two
spawn-failure tests timed out. Node that install.sh puts under
~/.local/share/ovis is found through HOME, so it escaped as well.

While the fixture is active, point OVIS_PTY_SIDECAR_BIN at a path that does
not exist and HOME at an empty directory, and read nodeSidecarAvailable()
first so a run on the Rust host does not cache Node as missing.

Closes #2344
@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 10855e0 and 777f4cd.

Files selected for processing: 2
  • changelog.d/output-test-spawn-failure-rust-host.md
  • server/output.contract.test.ts

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

📝 Summary

Summary by CodeRabbit

  • Tests
    • Expanded terminal output contract coverage to verify spawn-failure handling with both supported terminal hosts.
    • Improved test isolation by restoring environment settings after each test.

The output contract test now blocks spawn through both the Rust PTY host and Node sidecar paths. It preserves and restores the environment values used by the fixture. A changelog entry records the update.

Changes: PTY spawn-failure tests

Layer / File(s) Summary
Block both PTY host paths
server/output.contract.test.ts, changelog.d/output-test-spawn-failure-rust-host.md
The fixture checks Node sidecar availability, resolves the existing herdr executable, and configures environment values that prevent the Rust host and Node fallback from spawning. Cleanup restores or removes the changed values. The changelog records the test update.

Priority: Normal

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

Change: Bug fix · Severity of issue fixed: Medium

Possibly related PRs

  • devswha/ovis#1859: Adds installed Rust PTY host selection, which the fixture now overrides.
  • devswha/ovis#1785: Introduces Rust PTY host selection and Node fallback, both covered by the fixture.
  • devswha/ovis#1908: Defines Rust and Node host selection and availability checks used by the fixture.

Suggested reviewers: yoonwoo-ha

Merge Risk: Minimal · up to 777f4

No merge-blocking risk is identified in this test-only change.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main test change: making breakPath() fail spawning on both PTY hosts.
Description check Passed The description is detailed and covers the problem, resulting behavior, issue reference, test-only scope, validation commands, environments, results, and review context. It uses “What” and “Verificati…
Linked Issues check Passed Issue #2344 requires the test fixture to fail the PTY spawn when the Rust host exists locally. The diff sets OVIS_PTY_SIDECAR_BIN to a nonexistent path, hides installer-provided Node with an empty `…
Out of Scope Changes check Passed The changes stay within issue #2344. The server/output.contract.test.ts changes update only the spawn-failure fixture and its cleanup. The changelog entry documents that test fix. No unrelated produ…
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Full details: Description check

Explanation

The description is detailed and covers the problem, resulting behavior, issue reference, test-only scope, validation commands, environments, results, and review context. It uses “What” and “Verification” instead of the template’s “Change” and “Validation” headings, but the required information is present.

Full details: Linked Issues check

Explanation

Issue #2344 requires the test fixture to fail the PTY spawn when the Rust host exists locally. The diff sets OVIS_PTY_SIDECAR_BIN to a nonexistent path, hides installer-provided Node with an empty HOME, and keeps herdr resolved before restricting PATH. This covers the Rust and Node fallback paths without production-code changes. The added changelog records the maintenance fix.

Full details: Out of Scope Changes check

Explanation

The changes stay within issue #2344. The server/output.contract.test.ts changes update only the spawn-failure fixture and its cleanup. The changelog entry documents that test fix. No unrelated production behavior or unrelated test behavior is changed.

Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. 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 1 functions across 1 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

Comment @coderabbitai help to get the list of available commands.

@devswha

devswha commented Oct 29, 2026

Copy link
Copy Markdown
Owner Author

Merging 777f4cd (closes #2344, thank you @kilhyeonjun for the report and the diagnosis). Test-only: the output contract tests for an attach that cannot spawn now break the spawn on both PTY hosts (the Rust host via a nonexistent OVIS_PTY_SIDECAR_BIN, the installer's Node via an empty HOME, besides PATH), restoring every variable afterwards and reading Node's availability first so a Rust-host run does not cache it as missing. Lane evidence: 12 pass / 2 fail before with a local Rust host and an installer Node, 14/14 after in 5 host setups; check fast green. The merge pass read the diff (one test helper + a changelog fragment). No behaviour change, so no CodeRabbit review was needed.

@devswha
devswha merged commit 0675bad into main Oct 29, 2026
19 checks passed
@devswha
devswha deleted the test/breakpath-rust-pty-host branch October 29, 2026 17:36
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.

test(output): breakPath() cannot fail the spawn when the Rust PTY host is built locally

1 participant