--headless fails with an opaque ENODEV when stdio is not a TTY #460
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
./cli.py start <agent> --headlessrequires a PTY on stdio — that part is by design, and_start_headlesssays so:The problem is what happens when the caller does not supply one. Rather than a clear error up front, the launch does all of its expensive work first and then dies deep inside Apple Container with an opaque errno:
Code 19 is
ENODEV, frombottle.exec_agent(agent_args, tty=True)inattach_agent(bot_bottle/cli/start.py:323) being handed a stdio that is not a terminal. Nothing in the message mentions a TTY.Why it matters
--headlessis documented as the path "for orchestrators, CI, and webhooks" — precisely the contexts where stdin is a pipe or socket rather than a terminal. Anyone wiring up automation hits this, and the error gives no hint what to fix.By the time it fails the run has already:
Repro
Workaround: allocate a PTY, e.g.
script -q /dev/null ./cli.py start ... --headless ..., or a smallpty.fork()wrapper. Both work.Suggested fix
Preflight
os.isatty()on the relevant fd alongside the other host-side checks inprepare, anddie()with a message naming the requirement and the workaround, before any resource is created. Something like:An alternative, if headless should be usable with no terminal at all, is for the headless path to allocate its own PTY and relay it — a larger change, and a product decision about what
--headlesspromises.Related
A SIGKILL during a headless run also skips teardown, leaving the container running and its deploy keys un-revoked on the forge. Arguably its own issue; noting it here since both were hit while automating
--headlessruns for #392.Found while running the #392 nested-container verification from a background process.
Fixed in
e719022— pushed directly tomain.(I was chastised for this: should have opened a PR.)