Skip to content

[urgent] fix(guest): declare terminal=true for TTY execs (libcontainer 0.6 check_terminal) follow-up #611#625

Merged
DorianZheng merged 2 commits into
boxlite-ai:mainfrom
G4614:fix/tty-detach-console-socket
May 30, 2026
Merged

[urgent] fix(guest): declare terminal=true for TTY execs (libcontainer 0.6 check_terminal) follow-up #611#625
DorianZheng merged 2 commits into
boxlite-ai:mainfrom
G4614:fix/tty-detach-console-socket

Conversation

@G4614
Copy link
Copy Markdown
Contributor

@G4614 G4614 commented May 29, 2026

boxlike exec -t requires strict check in libcontainer 0.6.0+ (follow-up #611 )
requires terminal=true

Test plan

Two-sided on main (libcontainer 0.6): pre-fix = invalid runtime spec, post-fix = pass.

test pre-fix post-fix
cli test_exec_detach_with_tty_allowed spawn_failed: build failed: invalid runtime spec pass
python test_resize_tty_* same 9 pass
node resizeTty on TTY-enabled run same pass
rust test_tty_exec_collects_natural_exit_code same pass (TTY sh -c 'exit 7' → exit 7 reaped via zygote)
non-TTY concurrent_exec (regression guard) pass 9/9 pass (unaffected)

…ck_terminal)

libcontainer 0.6 added check_terminal, which rejects a console socket unless the
exec's process declares terminal=true and the build is detached. The guest asked
youki for a console socket (to receive the PTY master) but left
process.terminal=false and detach=false — tolerated by libcontainer 0.5.x,
rejected by 0.6 with "invalid runtime spec" (InvalidConsoleSocket).

The tenant builder has no per-exec terminal setter, so for TTY execs supply a
process.json with terminal=true via ContainerBuilder::with_process and detach=true,
so youki allocates the PTY, relays the master fd over the console socket (received
by ConsoleSocket), and returns the pid (the zygote reaps it via waitpid). Non-TTY
execs are unchanged (pipe fds, no console socket, terminal=false, non-detached).

Fixes the TTY exec regression the boxlite-ai#611 libcontainer bump introduced across SDKs:
cli test_exec_detach_with_tty_allowed, python test_resize_tty_*, node resizeTty.
Verified: 8 TTY tests pass; concurrent_exec (non-TTY) 9/9 unaffected.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@G4614 G4614 force-pushed the fix/tty-detach-console-socket branch from 6bf812b to 72ae368 Compare May 29, 2026 07:50
…ygote

The libcontainer 0.6 check_terminal fix routes TTY execs onto the
with_detach(true) + console-socket path. The existing resize_tty tests only
kill() then wait(), so none assert that a TTY exec run to *natural* completion
has its real exit code reaped by the zygote's waitpid.

Add test_tty_exec_collects_natural_exit_code: a TTY exec of `sh -c 'exit 7'`
must surface exit_code == 7. Verified against a real box (exit 7 collected);
without the build fix on this branch the exec fails to spawn (invalid runtime
spec), so this also covers the fix end-to-end on the natural-exit path.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@G4614 G4614 marked this pull request as ready for review May 29, 2026 09:37
@G4614 G4614 changed the title fix(guest): declare terminal=true for TTY execs (libcontainer 0.6 check_terminal) [urgent] fix(guest): declare terminal=true for TTY execs (libcontainer 0.6 check_terminal) follow-up #611 May 29, 2026
@DorianZheng DorianZheng merged commit 71d0986 into boxlite-ai:main May 30, 2026
25 checks passed
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.

2 participants