Repository navigation
Closed
Labels
priority:must-haveMust be done. Applied by the inbox-route classifier or a human.Must be done. Applied by the inbox-route classifier or a human.
Description
Task
| slice | size | difficulty | model | who | estimated lines |
|---|---|---|---|---|---|
| Start, attach and resume | M | involved | strongest | an agent | 280 (150 code, 130 tests) |
When
min box stop <box>ormin box rm --force <box>runs from another terminal, the attached terminal prints one stderr line that names the cause and exits 254. It never shows the shell-exit prompt.
Found by pc's re-test on unstable 0.8.0-dev.607.g81832ac6 (2026-11-18). Attach to a box with min session start, then run min box stop dev from another terminal. The attached terminal shows the legacy menu "Session shell process exited. What would you like to do with this session?" (Exit / Save / Delete), not a cause line and exit 254.
Cause, on main:
min box stoprunsstop_box_innerand thenstop_box_processes(crates/minimald/src/box_actor/host.rs:2198). They signal the box's processes directly and never tell the box's host, soHost::kill_requestedstays false (crates/minimald/src/box_runtime.rs:115).- The pty reports EIO, and the host sends the binding a plain
BindingMsg::TeardownDueToProcessExit(notify_remote_teardown,box_runtime.rs:1786). A stop and a shellexitproduce the same message. - The binding then takes the
MainloopExitReason::ProcessExitedarm. - For a box whose entrypoint does not end the box (
ends_with_entrypointfalse, which covers a session box),crates/minimald/src/box_runtime/binding.rs:971showsshell_exit_prompt. attach_ended_from_other_side_notice_exit254(crates/minimal/src/tests.rs:11086) passes because it runs against a test host that reports 254. No test drives a real minimald binding through a stop.
What to do:
- The stop and removal paths tell the box's host that a stop or removal is under way before they signal the processes (a host message in
crates/minimald/src/box_runtime/handle.rs). The host then sends the binding a teardown whose cause is the stop or the removal, not a process exit. - When a stop or a removal of the box ends the shell, the binding ends the attach as ended from the other side, with the stop or the removal as the cause. It shows no prompt and runs no shell-exit disposition. The client then prints its one cause line and exits 254 (BCLI-068).
- This covers an attach from
min session start,min box start,min box attachandmin session attach. - Fold in BCLI: one cause line when the daemon ends a min box attach (the daemon's PTY line duplicates the client's) #3035: the binding writes no "Disconnecting - …" line into the PTY for a stop, a removal, a takeover or a daemon shutdown, because the client prints the cause. Keep no path for older clients (owner direction: no fallbacks). Close BCLI: one cause line when the daemon ends a min box attach (the daemon's PTY line duplicates the client's) #3035 with this task's PR.
- The client side needs no change.
attach_ending(crates/minimal/src/cmd/boxes/attach.rs:1982) already prints one line for a stop, a removal, a takeover and a host shutdown when the daemon reports 254.attach_ended_from_other_side_notice_exit254pins that mapping. Theminimalcrate's test harness cannot launch a real box shell, so the end-to-end check is in T56 (T56 — Move scripts/session-e2e.sh off the old session verbs #3525), inscripts/session-e2e.sh(owner plan change, 2026-11-18). - Out of scope: what a shell that exits on its own shows in a session box.
Covers:
- BCLI-068 (its sub-requirement: IF the daemon ends an attach from the other side THEN exit 254 after one stderr line that names the cause)
Layers:
- daemon:
- crates/minimald/src/box_actor/host.rs: the stop and removal paths tell the box's host that a stop or removal is under way before they signal its processes
- crates/minimald/src/box_runtime/handle.rs: the host message that carries a stop or removal
- crates/minimald/src/box_runtime.rs: the host records the stop or removal, and its teardown to the binding carries that cause, not a process exit
- crates/minimald/src/box_runtime/binding.rs: a stop or a removal ends the binding as ended from the other side, with no shell-exit prompt; the binding writes no "Disconnecting - …" line into the PTY
- crates/minimald/src/box_runtime/tests.rs:
stop_while_attached_ends_binding_without_shell_exit_prompt, for a box whose entrypoint does not end it cargo nextest run -p minimald stop_while_attached_ends_binding_without_shell_exit_prompt
Plan block
### T57 — A stop or removal ends an attach with one cause line and exit 254, never the shell-exit prompt
slice: S3
kind: task
covers: BCLI-068
size: M
est: 150 code, 130 tests
executor: agent
difficulty: involved
model: strongest
diagnostics: none new
observability: none new
layers:
- daemon:
- crates/minimald/src/box_actor/host.rs: the stop and removal paths tell the box's host that a stop or removal is under way before they signal its processes
- crates/minimald/src/box_runtime/handle.rs: the host message that carries a stop or removal
- crates/minimald/src/box_runtime.rs: the host records the stop or removal, and its teardown to the binding carries that cause, not a process exit
- crates/minimald/src/box_runtime/binding.rs: a stop or a removal ends the binding as ended from the other side, with no shell-exit prompt; the binding writes no "Disconnecting - …" line into the PTY
- crates/minimald/src/box_runtime/tests.rs: `stop_while_attached_ends_binding_without_shell_exit_prompt`, for a box whose entrypoint does not end it
test: cargo nextest run -p minimald stop_while_attached_ends_binding_without_shell_exit_prompt
produces: none
consumes: none
proof: Attached to a box started with `min session start`, `min box stop <box>` from another terminal ends the attach with one stderr line naming the stop and exit 254, and no prompt appears.
Reacted by minimal-foundry
Metadata
Metadata
Assignees
Labels
priority:must-haveMust be done. Applied by the inbox-route classifier or a human.Must be done. Applied by the inbox-route classifier or a human.
Activity
minimal-foundry commentedon Nov 18, 2026
Done. #3546 merged.
branch
agent/3526-a-stop-or-removal-ends-an-attach-with-one-cause· epic #2879 · PR #354641e71b95ee75e462Updated 2026-11-18T20:17:26.458Z.
test: T56 — Move scripts/session-e2e.sh off the old session verbs (go…