8000 T57 — A stop or removal ends an attach with one cause line and exit 254, never the shell-exit prompt · Issue #3526 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

T57 — A stop or removal ends an attach with one cause line and exit 254, never the shell-exit prompt #3526

Closed

Description

@agent-137

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> or min 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 stop runs stop_box_inner and then stop_box_processes (crates/minimald/src/box_actor/host.rs:2198). They signal the box's processes directly and never tell the box's host, so Host::kill_requested stays 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 shell exit produce the same message.
  • The binding then takes the MainloopExitReason::ProcessExited arm.
  • For a box whose entrypoint does not end the box (ends_with_entrypoint false, which covers a session box), crates/minimald/src/box_runtime/binding.rs:971 shows shell_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 attach and min 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_exit254 pins that mapping. The minimal crate'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), in scripts/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.

Activity

  1. minimal-foundry commented on Nov 18, 2026

    @minimal-foundry
    Contributor

    Done. #3546 merged.

    branch agent/3526-a-stop-or-removal-ends-an-attach-with-one-cause · epic #2879 · PR #3546

    round outcome job
    1 pushed 41e71b95
    2 changed nothing: Revise round 2 changes no code, as the /revise note asks. Add these two lines to the PR body, under Residuals: - C1: the end-to-end proof that a stop while attached ends with 254 and no prompt is a st ee75e462

    Updated 2026-11-18T20:17:26.458Z.

  2. added
    needs-humanAn agent handed off; a human must act, then clear this label. Set by defer and handoffs.
    on Nov 18, 2026
  3. removed
    needs-humanAn agent handed off; a human must act, then clear this label. Set by defer and handoffs.
    on Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority:must-haveMust be done. Applied by the inbox-route classifier or a human.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0