8000 fix(minimald): T57 — A stop or removal ends an attach with one cause line and exit 254, never the shell-exit prompt by minimal-foundry[bot] · Pull Request #3546 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

fix(minimald): T57 — A stop or removal ends an attach with one cause line and exit 254, never the shell-exit prompt - #3546

Merged
agent-137 merged 4 commits into
mainfrom
agent/3526-a-stop-or-removal-ends-an-attach-with-one-cause
Nov 18, 2026
Merged

agent-137 merged 4 commits into
mainfrom
agent/3526-a-stop-or-removal-ends-an-attach-with-one-cause

Conversation

@minimal-foundry
@minimal-foundry minimal-foundry Bot commented Nov 18, 2026 •
Copy link
Copy Markdown
Contributor

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
- client:
- crates/minimal/src/tests.rs: attach_ended_by_stop_on_real_daemon_exit254, which attaches through a real minimald binding, stops the box, and asserts one cause line on stderr, exit 254 and no prompt text
test: cargo nextest run -p minimal attach_ended_by_stop_on_real_daemon_exit254
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.

Proof

When a client is attached to a box whose entrypoint does not end it, a stop or a removal now ends the attach with exit status 254. The binding writes no shell-exit prompt, and no 'Disconnecting - ...' line for a stop, a removal, a takeover or a daemon shutdown. The min client already prints one stderr line for each of those causes (attach_ending, crates/minimal/src/cmd/boxes/attach.rs).

Notes from the agent: Daemon layer: a stop (stop_box_inner) and a removal (stop_running, when destroy_now has cancelled destroying) now call HostHandle::announce_end before they signal or kill the box's processes. announce_end waits until the host records the cause, so it cannot race the shell's exit. The host's teardown then sends BindingMsg::TeardownDueToBoxEnd in place of TeardownDueToProcessExit. A removal that ends in Message::Kill retires the binding with that message. Before this change, a removal ended with 'Disconnecting - the session is gone'. The binding renders only the unwind codes and ends with DAEMON_ENDED_EXIT_STATUS (254). A restart also goes through stop_box, so an attach to a restarted box now ends the same way, with 254 and no prompt. I ran cargo nextest run -p minimald box_runtime:: box_actor:: once: 345 passed.

Residuals:

Tests

line exit tail
cargo nextest run -p minimald stop_while_attached_ends_binding_without_shell_exit_prompt 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network help: do you need to update to a newer version of minimal? Running task runtime-implement-test-0 in box runtime-implement-test-0-1... Compiling paths v0.0.1 (/workbe
cargo nextest run -p minimal attach_ended_by_stop_on_real_daemon_exit254 4 ling pathrs v0.2.5 Compiling netconfig-rs v0.1.6 Compiling cobs v0.3.0 Compiling tun-rs v2.8.8 Compiling postcard v1.1.3 Compiling libcgroups v0.7.0 Compiling route_manager v0.2.13 Compiling ssh-encoding v0.3.0 Compiling darling_core v0.24.0 Compiling signal-hook v0.3.18

Verify

min task run agent-verify timed out after 1800s, so this PR is a draft.

e-sccache-gominimal-minimal\u{1f}SCCACHE_ENDPOINT=https://4103a6df4dd77276970745a22603bea9.r2.cloudflarestorage.com\u{1f}SCCACHE_REGION=auto\u{1f}SCCACHE_S3_USE_SSL=true\u{1f}SHELL=/usr/bin/bash\u{1f}SHLVL=2\u{1f}SSL_CERT_DIR=/etc/ssl/certs\u{1f}SSL_CERT_FILE=/etc/ssl/cert.pem\u{1f}XDG_CACHE_HOME=/state/cache\u{1f}XDG_CONFIG_HOME=/home/.config\u{1f}XDG_DATA_HOME=/home/.local/share\u{1f}XDG_RUNTIME_DIR=/run\u{1f}XDG_STATE_HOME=/home/.local/state\u{1e}stdin\n"
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

  Cancelling due to test failure: 3 tests still running
        PASS [   0.417s] ( 625/1526) minimald env::tests::search_finds_known_package
        PASS [   3.457s] ( 626/1526) minimald env::tests::run_task_relays_exit_through_both_paths
        SLOW [> 60.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>120.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>180.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>240.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>300.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>360.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>420.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>480.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>540.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>600.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>660.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>720.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>780.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>840.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>900.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>960.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>1020.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>1080.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>1140.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>1200.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>1260.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>1320.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>1380.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task

Base

The base branch moved while the coder worked; it was merged in before the tests ran.

Closes #3526
Closes #3035

A stop or a removal now tells the box's host before it signals the
box's processes. The host's teardown to the attached binding carries
that cause, so the binding raises no shell-exit prompt, writes no
Disconnecting line, and ends with exit status 254 (BCLI-068).
@coderabbitai
coderabbitai Bot commented Nov 18, 2026 •
Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5ded7f14-e3db-4078-927b-ed07a5c22057

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@agent-137
Copy link
Copy Markdown
Member

/revise

Head 48528f7a. The daemon half is right. This round finishes T57's binding change and nothing else.

1. The binding writes no "Disconnecting - …" line for a takeover or a daemon shutdown.
In crates/minimald/src/box_runtime/binding.rs (on main, about lines 1171 and 1179), remove the PTY writes "Disconnecting - session attached to from a different connection" and "Disconnecting - minimald is shutting down". Each still ends the binding with 254. The client already prints one line for each cause (attach_ending, crates/minimal/src/cmd/boxes/attach.rs:1982), so the daemon's line is a second line that says "session" for a box (#3035). Keep no path for older clients. Keep the "terminal stopped keeping up" line, which the client does not name.

  • Update every minimald test that asserts the removed lines, and assert that the takeover and shutdown paths write no "Disconnecting" text.

2. No client test. T57's plan no longer has the minimal client layer. The minimal harness cannot launch a real box shell, and the end-to-end check moved to T56 (#3525). Don't add attach_ended_by_stop_on_real_daemon_exit254.

3. PR body. Drop "Daemon half only" and the "Client layer NOT done" note. Say that Fixes #3526 and Closes #3035.

@agent-137
agent-137 marked this pull request as ready for review November 18, 2026 17:49
@agent-137
agent-137 requested a review from a team as a code owner November 18, 2026 17:49
@minimal-foundry
minimal-foundry Bot commented Nov 18, 2026 •
Copy link
Copy Markdown
Contributor Author

Approved: every review thread resolved at 452c7ce1a051.

@mitodrummer resolved the last thread, which releases the approval this review had withheld.

Nothing to do.

@minimal-arch minimal-arch Bot left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

arch-review: CONDITIONS · 2 conditions · the full ruling

The daemon side of BCLI-068 conforms. A stop or a removal now ends the attach with 254, with no prompt and no line from the binding, as architecture.md lines 376 and 492 require. Two items are open and have no issue. The client-layer proof attach_ended_by_stop_on_real_daemon_exit254 is not written (C1). A restart now also ends the attach with 254, and then the client prints "another terminal attached", which is a false cause (C2). Write the test, or file an issue for each item and list it as a residual in the PR body.

Ruled at 48528f7 against gominimal/arch@327e1b57d16b by claude-opus-5-5.

Comment thread crates/minimald/src/box_actor/host.rs Resolved
@minimal-foundry minimal-foundry Bot left a comment
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minimal-review — approval withheld

Verdict COMMENT — APPROVE withheld: 2 unresolved threads — minimal-arch[bot] crates/minimald/src/box_runtime/tests.rs:9138, minimal-arch[bot] crates/minimald/src/box_actor/host.rs:2411. No findings.

Panel: 3 of 3 personas ran (correctness, security, supply-chain).

@agent-137
Copy link
Copy Markdown
8000
Member

/revise

This answers the arch ruling on 48528f7a (C1, C2). Apply it on top of the previous /revise round, and change no code for it.

PR body, Residuals section. Add these two lines:

Threads. Reply on the C1 thread (box_runtime/tests.rs) with #3525, and on the C2 thread (box_actor/host.rs) with #3547.

@minimal-foundry
Copy link
Copy Markdown
Contributor Author

That /revise is held, not dropped. A coder is already running on #3526. Your note is kept and goes into the next round here, which starts when that coder finishes.

Nothing to type again: the command gets a rocket when its round starts, or a refusal that names the reason. No round was counted for it yet.

The client prints one stderr line for each cause, so the daemon's
"Disconnecting - ..." line was a second line that said session for a
box. Both ends still report exit 254. The shed line stays.
@minimal-foundry
Copy link
Copy Markdown
Contributor Author

Round 1 of 10 on a /revise note, pushed as 452c7ce1a051.

line exit tail
cargo nextest run -p minimald stop_while_attached_ends_binding_without_shell_exit_prompt 0 warning: unknown fields in task runtime-implement-test-0: network help: do you need to update to a newer version of minimal? Running task runtime-implement-test-0 in box runtime-implement-test-0-1... Compiling paths v0.0.1 (/workbench/crates/paths) Compiling args v0.0.1 (/workbench/crates/args

Verify min task run agent-verify timed out after 1800s.

CE_ROOT=/workbench\u{1f}PATH=/tmp/.tmpmidtfx/replybin:/usr/bin:/bin:/usr/sbin:/sbin:/home/.local/bin\u{1f}PWD=/tmp/.tmpmidtfx/some dir\u{1f}RUSTC_WRAPPER=sccache\u{1f}SCCACHE_BUCKET=agent-runtime-sccache-gominimal-minimal\u{1f}SCCACHE_ENDPOINT=https://4103a6df4dd77276970745a22603bea9.r2.cloudflarestorage.com\u{1f}SCCACHE_REGION=auto\u{1f}SCCACHE_S3_USE_SSL=true\u{1f}SHELL=/usr/bin/bash\u{1f}SHLVL=2\u{1f}SSL_CERT_DIR=/etc/ssl/certs\u{1f}SSL_CERT_FILE=/etc/ssl/cert.pem\u{1f}XDG_CACHE_HOME=/state/cache\u{1f}XDG_CONFIG_HOME=/home/.config\u{1f}XDG_DATA_HOME=/home/.local/share\u{1f}XDG_RUNTIME_DIR=/run\u{1f}XDG_STATE_HOME=/home/.local/state\u{1e}stdin\n"
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

  Cancelling due to test failure: 3 tests still running
        PASS [   0.350s] ( 626/1527) minimald env::tests::search_finds_known_package
        PASS [   3.035s] ( 627/1527) minimald env::tests::run_task_relays_exit_through_both_paths
        SLOW [> 60.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>120.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>180.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>240.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>300.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>360.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>420.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>480.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>540.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>600.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>660.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>720.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>780.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>840.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>900.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>960.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>1020.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>1080.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>1140.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>1200.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>1260.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task

Converted to a draft: something above needs a person before review.

Attached to a box started with min session start, min box stop <box> from another terminal ends the attach with exit 254 and no shell-exit prompt. The daemon writes no line into the PTY for a stop, a removal, a takeover or a daemon shutdown, so the one stderr line the client prints is the only line that names the cause.

Notes from the agent: Revise round 1. Item 1: binding.rs no longer writes "Disconnecting - session attached to from a different connection" or "Disconnecting - minimald is shutting down". Both ends still exit 254. The shed line and the host-gone line are unchanged. render_farewell is now pub(super), so the sibling tests module can call it. The new unit test takeover_and_shutdown_write_no_disconnecting_line asserts that each path writes only the unwind codes. expose_ask_superseded_mid_dialog_is_the_daemons_refusal now detects the takeover by exit status 254, not by the removed text, and asserts that no "Disconnecting" text reaches the channel. No other test or script in the repository quoted the removed lines. Item 2: I added no client test. Item 3: the runner writes the pull request body. It must drop "Daemon half only" and the "Client layer NOT done" note, and say Fixes #3526 and Closes #3035. I did not run the end-to-end proof (a real min session start and min box stop). It moved to T56 (#3525).

@minimal-foundry
minimal-foundry Bot marked this pull request as draft November 18, 2026 18:39
@agent-137
agent-137 marked this pull request as ready for review November 18, 2026 18:39
@minimal-foundry
Copy link
Copy Markdown
Contributor Author

Round 2 of 10 on a /revise note: the coder changed nothing. Revise round 2 changes no code, as the /revise note asks. Add these two lines to the PR body, under Residuals:

@minimal-arch minimal-arch Bot left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

arch-review: CONDITIONS · 2 conditions · the full ruling

The new commit removes the PTY 'Disconnecting' line for a takeover and a daemon shutdown. That conforms to architecture.md line 492, because the client prints the one notice on stderr. The two conditions from the ruling on 48528f7a are still open. C1: the client test attach_ended_by_stop_on_real_daemon_exit254 does not exist, and no residual issue covers the unproved leg. C2: a restart ends an attach with 254 and the client prints a takeover line, which is false. Make the edits in C1 and C2.

Ruled at 452c7ce against gominimal/arch@327e1b57d16b by claude-opus-5-5.

Comment thread crates/minimald/src/box_actor/host.rs Resolved
@minimal-foundry minimal-foundry Bot left a comment
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

APPROVE withheld: 4 unresolved threads — minimal-arch[bot] crates/minimald/src/box_runtime/tests.rs:9172, minimal-arch[bot] crates/minimald/src/box_actor/host.rs:2411, minimal-arch[bot] crates/minimald/src/box_runtime/tests.rs:9172, minimal-arch[bot] crates/minimald/src/box_actor/host.rs:2411.

minimal-review — advisory review

Verdict COMMENT — No findings.

Panel: 2 of 3 personas ran (security, supply-chain); did not complete: correctness.

@agent-137
Copy link
Copy Markdown
Member

/arch-review

@minimal-arch minimal-arch Bot left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

arch-review: PASS_WITH_CONDITIONS · 2 conditions · the full ruling

The daemon side conforms. A stop or a removal now tells the box's host before it signals, and the attach ends with 254, no prompt and no PTY line (architecture.md line 376 and line 492). Two items stay open as filed residuals. C1: no test proves the 254 and the one stderr line through a real daemon. The PR defers that leg to the T56 e2e step (#3525). C2: a restart now ends with 254, but the client names another terminal as the cause. Line 492 says the line names the cause (T58, #3547).

Ruled at 452c7ce against gominimal/arch@327e1b57d16b by claude-opus-5-5.

Comment thread crates/minimald/src/box_actor/host.rs Resolved
@minimal-foundry minimal-foundry Bot left a comment
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minimal-review — approved

Verdict APPROVE — every review thread is resolved; @mitodrummer closed the last one. The review of 452c7ce1a051 withheld this approval on the threads open then. Posted as a comment, as the review itself was; the check and the label carry it.

@minimal-foundry minimal-foundry Bot added the review:approved minimal-review approved the current head label Nov 18, 2026
@agent-137
agent-137 added this pull request to the merge queue Nov 18, 2026
Merged via the queue into main with commit fa65ffa Nov 18, 2026
41 checks passed
@agent-137
agent-137 deleted the agent/3526-a-stop-or-removal-ends-an-attach-with-one-cause branch November 18, 2026 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review:approved minimal-review approved the current head

Projects

None yet

2 participants

0