8000 fix(minimal): name a restart when it ends an attach · gominimal/minimal@b7b93c1 · GitHub
[go: up one dir, main page]

Skip to content

fix(minimal): name a restart when it ends an attach

Minimal Arch / arch-review failed Nov 18, 2026 in 0s

CONDITIONS

Inputs. First ruling on this PR. No since.diff, since-conditions.json or findings.json is staged. The arch checkout (327e1b57) has no arch-map.md, so I found the sections by search, as earlier rulings did. I read BCLI-068 and BCLI-074 in docs/specs/28-spec-box-cli at the head.

Governs. architecture.md Exit codes line 376 and min box attach line 492: 254 when the daemon ends the attach from the other side (a stop, a removal or a PTY takeover), after a one-line notice on stderr. File exports lines 508-513: an attach under which the box ended copies its exports, and line 513 says a box that runs again before any command copies has no separate copy for that end.

Ruling. The change is in the right owner: client-side attach logic in crates/minimal/src/cmd/boxes/attach.rs, with no daemon or boundary change. I checked the mechanism in code. restart_from in crates/minimald/src/box_actor.rs stops a running box with stop_box. That stop records an exited event, and box_ends in cmd/boxes/wait.rs counts it. So a restart raises the count, and a takeover does not. A restart is a stop followed by a start, so it is a 254 cause under line 492, and the new line names it exactly. When a count is unread, the old takeover line stays. That is no worse than the base, where every restart printed the takeover line. The attach still copies nothing at a restart. I read line 513 as governing that case, as #3502 did, and this change does not alter it. BCLI-068 conforms. But the task's proof leg (a live min box restart against an attach) did not run, and the new test checks only the pure functions. The restarted expression at attach.rs lines 1555-1557 and the second box_end_count read are not exercised against a real restart. Rule 4: an unrun leg is open, so C1 adds the proof through the in-process host, as #3546 did for stop and removal. The PR body declares a known gap (the record reads stopped during the restart) with no issue. C1 either proves the window closed or names the issue.

Not checked. The verify run failed otel_cli::exec_run_attach_and_task_run_share_the_commands_trace. This change adds one events read (box_end_count) to every attach on a running box, before and after it. I could not establish without a build whether that extra RPC caused the failure or whether the test is flaky (#3398). The coder must run it at the next head. The finding is not a design deviation, so it is not a condition.

Precedent. No departure. I follow #3546 for the 254 cause lines and the kind of proof, and #3502 for line 513.

Conditions

  • C1: crates/minimal/src/tests.rs: add #[tokio::test] async fn attach_ended_by_restart_names_restart_exit254_through_the_host. Model it on attach_ended_from_other_side_notice_exit254_before_the_record. Start an AttachHost, and create web with create_with and a restart_spec(mfile::spec::Lifetime::UntilStopped) that sets pty_enabled. Drive box_attach_on_hosts with a closure that returns 254 after the channel closes. Join it with cmd::restart_box_on_hosts(vec![alpha.host.clone()], &mut out, "web"). Assert AttachEnding { code: 254, notice: Some("Detached: web was restarted. Run min box attach web to attach again.") }. This proves the restarted expression in box_attach_on_hosts (attach.rs lines 1555-1557) and the second box_end_count read against a real restart, which the pure-function test does not reach. If the record can read stopped during the restart (the PR body's known gap), make the test pin that case too, and name the issue that owns the gap in the PR body.

Ruled at b7b93c1 against gominimal/arch@327e1b57d16b by claude-opus-5-5; arch_rulings 1381, job 06055a83-d2ca-4dc1-a132-2b7601f5a6f1.

0