Repository navigation
feat: T64 — min box wait -o json says how the box ended - #3666
Conversation
Writes one min/v1/wait object on stdout when the box ends, with its record's state, reason, exit code and signal and the code of the wait. A failure under -o json is one min/v1/error object.
BCLI-013 gains the machine-output sub-requirement, BCLI-033 lists the wait type, and the min reference gains a box wait section.
|
Important Review skippedBot user detected. Ask an organization administrator to verify that this bot has an active assigned CodeRabbit review seat. See the seat-assignment guide. After the seat is confirmed, request a review again.
|
Spec lint
Advisory. None of this blocks the merge; the review decides. Advisory, and never a merge gate. Linter: |
|
Reviewed: no findings; approval withheld, 1 thread unresolved at APPROVE withheld: 1 unresolved thread — minimal-foundry[bot] crates/minimal/src/cmd/boxes/wait.rs. Resolving the last thread releases the approval on this head. Resolve the open threads. Resolving the last one releases the approval on this head; no new review is required. Verdict APPROVE, posted as a comment: the App cannot review its own pull request; the check and the label carry it. Clobber: none seen. |
| write_wait_output(&mut std::io::stdout().lock(), args.output, &waited) | ||
| .context("write how the box ended")?; |
There was a problem hiding this comment.
MEDIUM · correctness · confidence 0.60 · in cmd_box_wait
The stdout write error gets a plain string context, not OutputWriteError. Other document writers use OutputWriteError (policy.rs:1100, show.rs:417). In machine mode, machine_mode_answer then reports a closed pipe as unspecified and not as quiet exit 141. A full disk is also not reported as output_failed. Use .context(OutputWriteError).
What the reviewer checked
write_wait_output(&mut std::io::stdout().lock(), args.output, &waited).context("write how the box ended")?;
Hand this to an agent
Act on a code-review finding.
File: crates/minimal/src/cmd/boxes/wait.rs
Lines: 580-581
Category: correctness
Severity: medium (reviewer confidence 0.60)
Finding:
The stdout write error gets a plain string context, not `OutputWriteError`. Other document writers use `OutputWriteError` (policy.rs:1100, show.rs:417). In machine mode, `machine_mode_answer` then reports a closed pipe as `unspecified` and not as quiet exit 141. A full disk is also not reported as `output_failed`. Use `.context(OutputWriteError)`.
First verify this against the code yourself. It is model output and
may be wrong. If it is wrong, or the tradeoff was deliberate, say so
and change nothing.
👍 useful · 👎 noise — react to tell the reviewer. Replying works too, and says more.
There was a problem hiding this comment.
Addressed in 909d4b091ce5: The wait document write now uses .context(OutputWriteError), so a failed write answers output_failed. A closed pipe was already quiet, because is_broken_pipe walks the error chain.
…it-o-json-says-how-the-box-ended
A failed write of the min/v1/wait object now answers output_failed in a machine output mode, as the other document writers do.
|
Round 1 of 10 on the runtime's review findings, pushed as
Verify Outside the task's
Converted to a draft: verify exited 100; outside the task's Review threads the coder judged:
Notes from the agent: Revise round 1: one change in wait.rs. The stdout write of the min/v1/wait object now carries the OutputWriteError context. The broken-pipe half of the finding did not need the change: is_broken_pipe in main.rs walks the whole error chain, so a closed pipe was already a quiet exit. The full-disk half was a real defect. clippy -p minimal --all-targets is clean. Commit bodies re-wrapped by the runtime: a prose line over commitlint's 100 is split at a space where no piece is left over it, and code and lines that cannot split are left as written. Every word the coder wrote is kept, in order:
|
|
/arch-review |
There was a problem hiding this comment.
arch-review: PASS · the full ruling
The change conforms to the design. Section min box line 506 says that the machine output of min box wait lists how each box ended. The min/v1/wait object gives this with the field names of the box record (lines 21 and 500). Its code is the per-box code from the Exit codes table. A failure under -o json is one min/v1/error object on stderr, as Output conventions line 383 says. There are no conditions.
Ruled at 909d4b0 against gominimal/arch@8b824707cde6 by claude-opus-5-5.
T64 — min box wait -o json says how the box ended
slice: S3
kind: task
covers: BCLI-013, BCLI-033
size: S
est: 90 code, 130 tests
executor: agent
difficulty: routine
model: standard
diagnostics: none new
observability: none new
layers:
- spec:
- docs/specs/28-spec-box-cli/28-spec-box-cli.md: BCLI-013's machine-output sub-requirement, and
waitin BCLI-033's types- client:
- crates/minimal/src/cmd/boxes/wait.rs: write one
min/v1/waitobject on stdout in a machine output mode when the box ends- crates/minimal/src/tests.rs:
box_wait_json_lists_how_the_box_ended(0, 3, 124, 128 + n, 137, 125; text mode prints nothing)- docs/reference/cli-min.md: the
min box waitsection names the object and its fieldstest: cargo nextest run -p minimal box_wait_json_lists_how_the_box_ended
produces:
- min/v1/wait
consumes: none
proof:
min task run <entry> --detachof an entry that exits 3, thenmin box wait <box> -o json, prints{"schema":"min/v1/wait","boxes":[{"box_id":…,"name":…,"state":"exited","reason":"exit","exit_code":3,"signal":null,"code":3}]}and exits 3.Proof
After
min task run <entry> --detachof an entry that exits 3,min box wait <box> -o jsonprints one line, {"schema":"min/v1/wait","boxes":[{"box_id":…,"name":…,"state":"exited","reason":"exit","exit_code":3,"signal":null,"code":3}]}, and exits 3. Without -o it prints nothing on stdout. The unit test pins the object for codes 0, 3, 124, 143, 137 and 125. I did not run the end-to-end command against a live daemon.Notes from the agent: Two files outside the layers changed. (1) crates/minimal/src/cli.rs:
min box waithad no -o flag, and BoxWaitArgs lives there. I added-o/--output json(BoxWaitOutputFormat). It conflicts with --exec, because an exec has no min/v1/wait object. (2) crates/minimal/src/main.rs: one arm in machine_output_mode, so that a failure ofmin box wait -o json(wait_timeout among them) is one min/v1/error object on stderr, as BCLI-033 requires. Without these two files the task cannot be done. In wait.rs, BoxWaited now carries the box's record, and cmd_box_wait calls box_wait_all_on_hosts. box_wait_on_hosts is now #[cfg(test)], because only tests call it. In the test, case 124 is a box that its own timeout ended (reason timeout): the object is written and the timeout error follows. A --timeout that runs out before the box ends writes no object. The reference doc had nobox waitsection, so I added one.just lint-prosedid not run: vale is not installed on this box. No whole-crate test run was made.Tests
cargo nextest run -p minimal box_wait_json_lists_how_the_box_endedVerify
min task run agent-verifyexited 100, so this PR is a draft.Out of scope
These files are outside the task's
layers:, so this PR is a draft:crates/minimal/src/cli.rscrates/minimal/src/main.rsCloses #3199