fix(install): probe /dev/tty by opening it, not bare existence (#16746) - #17024
Merged
Conversation
In Docker builds the `/dev/tty` device node is present in the mount
namespace, so `[ -e /dev/tty ]` returns true — but opening it fails
with `ENXIO: No such device or address`. Under the old gate the
"no terminal available" skip never triggered, the setup wizard ran,
and the build aborted a few lines later when bash tried `< /dev/tty`:
/tmp/install.sh: line 1347: /dev/tty: No such device or address
Replace the existence check with `(: </dev/tty) 2>/dev/null`, which
actually attempts to open /dev/tty in a subshell. The probe succeeds
when piped from `curl | bash` on a real terminal (the wizard's intended
use case) and fails cleanly in Docker build / CI contexts so the skip
kicks in before the redirect can crash.
Add a regression test that statically asserts run_setup_wizard does not
gate on the bare existence check and that the open-based probe is in
place.
Fixes #16746.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Address the three Copilot inline findings on the regression test: - Switch _extract_run_setup_wizard() from str.index() with hard-coded markers (which raises ValueError if `maybe_start_gateway()` is renamed or the marker leaks into a comment) to an anchored regex on the function-definition + closing-brace boundaries. - Match `[ -e /dev/tty ]` with surrounding whitespace, optional quoting, and the `test -e /dev/tty` form so the regression guard catches every spelling of the existence-only check, not just the exact substring. - Replace the literal `(: </dev/tty)` substring assertion with a higher-level invariant — the gate must be an `if`/`if !` whose test redirects stdin from /dev/tty — so equivalent open-based probes (`exec 3</dev/tty` + close, brace-grouped variants, etc.) keep the test green while the bare existence check stays caught. Verified guard: both tests still pass on the fix and both fail on `origin/main` with the documented messages. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The contributor's PR (#16750) scoped the fix to run_setup_wizard() and explicitly punted the two sibling sites. Both have the identical [ -e /dev/tty ] pattern followed by a < /dev/tty redirect and crash in Docker the same way: - scripts/install.sh:732 install_system_packages() -- apt sudo prompt fallback. sudo ... < /dev/tty dies with the same ENXIO. - scripts/install.sh:1395 maybe_start_gateway() -- gateway-install gate, same function path as the wizard reproducer. Fix both with the same (: </dev/tty) 2>/dev/null probe, and parametrize the regression test over all three gated functions so any future regression is caught regardless of which site breaks.
teknium1
force-pushed
the
hermes/hermes-3a4a8dda
branch
from
April 28, 2026 13:45
63acb0a to
0e36873
Compare
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Salvages #16750 by @briandevans and widens the fix to the two sibling gates the original PR punted.
Summary
Replace every
[ -e /dev/tty ]gate inscripts/install.shthat guards a subsequent< /dev/ttyredirect with an open-based probe(: </dev/tty) 2>/dev/null. In Docker builds the device node exists in the mount namespace but opening it fails with ENXIO, so the bare existence test returned true and the redirect crashed the build a few lines later.Changes
scripts/install.sh— three sites, same fix:run_setup_wizard()line 1333 (briandevans' original — the reproducer in [Bug]: Installer setup wizard fails in Docker builds: [ -e /dev/tty ] check unreliable #16746)install_system_packages()line 732 (apt sudo prompt fallback,sudo ... < /dev/ttywould die with the same ENXIO)maybe_start_gateway()line 1395 (gateway-install gate, same function path as the wizard reproducer)tests/test_install_sh_setup_wizard_tty_probe.py— parametrized over all three functions so any future regression is caught regardless of which site breaks.Validation
stdin=/dev/null[ -e /dev/tty ]passes → crash on< /dev/tty(: </dev/tty)fails → skip runsRelated
Credit
@briandevans wrote the wizard fix and the original regex-based regression test. This PR rebase-merges those commits and adds a widening commit for the two sibling sites plus test parametrization.