Skip to content

fix(pty): give Node's first start 10 s before the PTY sidecar counts it missing (red main) - #4756

Merged
devswha merged 4 commits into
mainfrom
fix/hc-live-hosted-127
Nov 25, 2026
Merged

devswha merged 4 commits into
mainfrom
fix/hc-live-hosted-127

Conversation

@devswha

@devswha devswha commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Why

herdr-core live contract went red on main (run https://github.com/devswha/ovis/actions/runs/45655628244, 267319e) and on #4747 after #4745 moved it to GitHub-hosted ubuntu-24.04: tui/testing/with-core.contract.test.ts "a dump WASM failure stops the started core and removes its folder" exited 127 instead of 125, without reaching the dump.

127 is with-core's "cannot run the command on a pseudo-terminal". The hosted job has no Rust PTY host (Rust PTY host unavailable (...ovis-pty-sidecar: ENOENT) in the log), so PtySession falls back to the Node sidecar, which first asks node -p whether it is a real Node with a 3 s bound (server/pty/sidecar.ts). This test is the job's first Node start; on a fresh runner Node's first start from a cold disk sits right at 3 s (the passing hosted runs took 2.6 s for the whole test, the failing one 3.09 s), and past it the probe says "no Node", so there is no PTY host.

The same holds for a real server on a PC without the Rust host: a slow first Node start leaves it with no PTY host until it restarts (the answer is kept), so live terminals fall back to a mirror.

Change

The Node lookup (realNode) gets one 10 s budget, the bound the app's own hc already gets for its first answer (BUNDLED_PROBE_TIMEOUT_MS), shared among its candidates (the app's own Nodes, then the one on PATH): each candidate asked gets an equal share of what is left. A single Node, as on the hosted runner, gets the whole 10 s; hung app Nodes can no longer use up the time of a working one on PATH, and the whole lookup stays within 10 s (it was up to 3 x 3 s), well inside the plugin's 20 s start deadline. No test skip, job or retry changes.

A new unit test in server/machines.test.ts puts two hung app Nodes before a working one on PATH: it times out on main's code and passes in about 0.6 s here.

Validation

Hosted-like repro: ubuntu:24.04 container, --cpus 2, a clean tmpfs HOME, no Rust host, Node's page cache evicted before each run and the disk throttled (--device-read-bps 9mb, cold node -p about 3-4.5 s), running only that test:

  • before (main's sidecar.ts mounted over): 30/30 fail, each "code": 127 at about 3.18 s, the hosted signature

  • after (final code): 0/50 fail, twice

  • (at 12 MB/s, cold Node right at 3.0 s, main passed 30/30, which matches the flake being a near-tie)

  • bun test server/machines.test.ts (new budget test included) and bun test server/machines.test.ts server/pty tui/testing/with-core.contract.test.ts scripts/changelog-fold.test.ts: 194 pass, 0 fail

  • bun run check fast: all green except server/ssh-account-add.test.ts, which fails only because the long lane TMPDIR makes its ssh forward socket path too long; it passes (3/3) with a short TMPDIR. Unrelated to this change.

Review

Gate reviewer: HIGH (10 s per candidate could pass the plugin's 20 s start deadline with two hung app Nodes) fixed by the shared budget above; LOW (server/index.ts comment said 3 s) fixed. MEDIUM, not changed: if the Rust host dies after start, the first Node lookup runs synchronously while clients are connected; it was already synchronous (up to 9 s before), now bounded at 10 s.

@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Explain Change →

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Bug Fixes
    • Live terminals now allow up to 10 seconds for the PC’s Node runtime to respond during startup, up from 3 seconds. When the Rust terminal host is unavailable, a slow response no longer causes the terminal to fall back to a mirrored view.

The Node runtime probe timeout increases from 3,000 ms to 10,000 ms. The changelog records the live-terminal fallback behavior when Node does not answer its first probe and the Rust PTY host is unavailable.

Changes: PTY Node Probe

Layer / File(s) Summary
Node probe timeout
server/pty/sidecar.ts, changelog.d/pty-node-probe-cold-start.md
The probe timeout increases to 10,000 ms. Its comment describes the first health-check response bound and states that no response counts as no Node. The changelog records the live-terminal fallback fix.

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

Change: Bug fix · Severity of issue fixed: Low

Merge Risk: Minimal · previous review 60c1d

This change gives a slow first Node start on cold hosts more time to answer, so live terminals no longer fall back to a mirrored view. In the rare case of a hung Node, the probe can wait up to 10 seconds once per process. No merge-blocking risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the change (raising the Node PTY sidecar probe wait from 3 s to 10 s for first start) and the scope (pty). It also cites the red main branch. It matches the changeset and the stated ob…
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 repository template. The Change section names the problem (the hosted-runner live contract failure with exit 127 instead of 125, caused by the 3 s Node probe in `server/p…
Full details: Title check

Explanation

The title names the change (raising the Node PTY sidecar probe wait from 3 s to 10 s for first start) and the scope (pty). It also cites the red main branch. It matches the changeset and the stated objective, so it passes.

Full details: Description check

Explanation

The description follows the repository template. The Change section names the problem (the hosted-runner live contract failure with exit 127 instead of 125, caused by the 3 s Node probe in server/pty/sidecar.ts), the resulting behavior, and the fix (one shared 10 s budget for realNode). It also links the failing run and the regression test. The Validation section lists the commands run (bun test on the touched files and bun run check fast), their results, and the one unrelated failure (server/ssh-account-add.test.ts, attributed to a long TMPDIR). The template asks for a full check or contract-test coverage for HTTP/WS changes, and neither is stated. This is a minor gap and does not block the check. The Change section also does not link a maintainer-agreed issue. The template asks for one only for features, and this is a bug fix, so it is not required here.

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 815bd29 and 60c1d95.

Files selected for processing: 2

  • changelog.d/pty-node-probe-cold-start.md
  • server/pty/sidecar.ts

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

@devswha
devswha merged commit 5bcdc25 into main Nov 25, 2026
29 checks passed
@devswha

devswha commented Nov 25, 2026

Copy link
Copy Markdown
Owner Author

Merged through pr-merge at head 5dd0c45a5. Seen before the merge was asked for: required checks green, no unresolved thread, no conflict, no hold, main not red, no release in progress. CodeRabbit said it did not review (a limit or a skip) since this head.

main had moved since the checks of 3837220d4: pr-merge --update merged it in (38823ada9), and every required check was green at this head.

Fixes red main: herdr-core live contract failed on main run https://github.com/devswha/ovis/actions/runs/45655628244 (267319e), exit 127 from a Node PTY probe timing out on a cold hosted runner. Reviews: one omo gate reviewer (gpt-6.2-astra) at 60c1d95 found a HIGH (per-candidate 10 s could pass the plugin's 20 s start) and a LOW; both fixed in 50e5438 with a regression test, one fix round, no re-review per the lane rule. CodeRabbit did not review this head. Merge on the Dori lane brief hc-live-hosted-fix (red main fix).

@devswha
devswha deleted the fix/hc-live-hosted-127 branch November 25, 2026 18:08
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