8000 feat: T64 — min box wait -o json says how the box ended by minimal-foundry[bot] · Pull Request #3666 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

feat: T64 — min box wait -o json says how the box ended - #3666

Merged
mitodrummer merged 4 commits into
mainfrom
agent/3199-min-box-wait-o-json-says-how-the-box-ended
Nov 20, 2026
Merged

mitodrummer merged 4 commits into
mainfrom
agent/3199-min-box-wait-o-json-says-how-the-box-ended

Conversation

@minimal-foundry
Copy link
Copy Markdown
Contributor

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 wait in BCLI-033's types
- client:
- crates/minimal/src/cmd/boxes/wait.rs: write one min/v1/wait object 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 wait section names the object and its fields
test: cargo nextest run -p minimal box_wait_json_lists_how_the_box_ended
produces:
- min/v1/wait
consumes: none
proof: min task run <entry> --detach of an entry that exits 3, then min 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> --detach of an entry that exits 3, min box wait <box> -o json prints 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 wait had 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 of min 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 no box wait section, so I added one. just lint-prose did not run: vale is not installed on this box. No whole-crate test run was made.

Tests

line exit tail
cargo nextest run -p minimal box_wait_json_lists_how_the_box_ended 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 exited 100, so this PR is a draft.

0.010s] (1189/1215) minimal::bin/min tests::invalid_project_file_prints_toml_error_once
        PASS [   0.008s] (1190/1215) minimal::bin/min tests::invalid_project_file_prints_toml_error_once_for_io
        PASS [   0.008s] (1191/1215) minimal::bin/min tests::loadout_not_found_exits_4
        PASS [   0.009s] (1192/1215) minimal::bin/min tests::local_host_not_found_exits_4
        PASS [   0.010s] (1193/1215) minimal::bin/min tests::machine_mode_answers_write_failures
        PASS [   0.009s] (1194/1215) minimal::bin/min tests::machine_mode_error_line_keeps_an_empty_hint
        PASS [   0.010s] (1195/1215) minimal::bin/min tests::machine_mode_error_object_is_one_stamped_line
        PASS [   0.009s] (1196/1215) minimal::bin/min tests::machine_mode_error_object_on_stderr
        PASS [   2.076s] (1197/1215) minimal::named_vm egress_opt_out_reaches_autospawned_minvmd
        PASS [   0.008s] (1198/1215) minimal::bin/min tests::machine_mode_names_the_grant_refusal_code
        PASS [   0.009s] (1199/1215) minimal::bin/min tests::machine_output_mode_keys_on_the_output_flag
        PASS [   0.009s] (1200/1215) minimal::bin/min tests::misplaced_run_flag_exits_2
        PASS [   0.010s] (1201/1215) minimal::bin/min tests::network_flag_refusal_exits_2
        PASS [   0.009s] (1202/1215) minimal::bin/min tests::project_file_not_found_exits_4
        PASS [   0.008s] (1203/1215) minimal::bin/min tests::resume_and_session_attach_refusals_map_to_exit_codes
        PASS [   0.009s] (1204/1215) minimal::bin/min tests::prune_off_tty_needs_yes_exits_2
        PASS [   0.010s] (1205/1215) minimal::bin/min tests::rm_running_box_refuses_naming_force_with_exit_2
        PASS [   0.010s] (1206/1215) minimal::bin/min tests::run_verbs_and_wait_timeout_return_124_with_code_timeout
        PASS [   0.009s] (1207/1215) minimal::bin/min tests::session_policy_json_is_a_stdout_contract
        PASS [   0.009s] (1208/1215) minimal::bin/min tests::session_run_is_a_stdout_contract
        PASS [   0.007s] (1209/1215) minimal::bin/min tests::task_file_invalid_exits_3
        PASS [   0.008s] (1210/1215) minimal::bin/min tests::start_entry_refusals_exit_with_their_codes
        PASS [   0.010s] (1211/1215) minimal::bin/min tests::task_not_found_exits_4
        PASS [   0.011s] (1212/1215) minimal::bin/min tests::task_ru
7438
n_is_a_stdout_contract
        PASS [   0.011s] (1213/1215) minimal::bin/min tests::type_refusals_exit_3_and_4
        PASS [   2.072s] (1214/1215) minimal::named_vm named_vm_reaches_autospawn
  stdout ───

    running 1 test
    test exec_run_attach_and_task_run_share_the_commands_trace ... FAILED

    failures:

    failures:
        exec_run_attach_and_task_run_share_the_commands_trace

    test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 5 filtered out; finished in 13.07s

  stderr ───

    ]
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

  Cancelling due to test failure: 
────────────
error: test run failed

Out of scope

These files are outside the task's layers:, so this PR is a draft:

  • crates/minimal/src/cli.rs
  • crates/minimal/src/main.rs

Closes #3199

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.
@coderabbitai
coderabbitai Bot commented Nov 19, 2026 •
Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot 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.

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: b4d6af2c-d100-40cf-85d4-0cd74c07cfed

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

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

@github-actions
Copy link
Copy Markdown
Contributor

Spec lint

docs/specs/28-spec-box-cli/28-spec-box-cli.md — 11 finding(s)

docs/specs/28-spec-box-cli/28-spec-box-cli.md:214: P004 BCLI-077 names test 'box_spec_renders_merged_vars_once_with_layer', which was not found in the repository
docs/specs/28-spec-box-cli/28-spec-box-cli.md:230: P004 BCLI-078 names test 'expansion_refusals_exit3_on_spec_and_create_verbs', which was not found in the repository
docs/specs/28-spec-box-cli/28-spec-box-cli.md:303: P004 BCLI-075 names test 'create_verbs_no_loadouts_empties_loadouts_layer', which was not found in the repository
docs/specs/28-spec-box-cli/28-spec-box-cli.md:316: P004 BCLI-076 names test 'create_verbs_no_hooks_stores_no_hooks', which was not found in the repository
docs/specs/28-spec-box-cli/28-spec-box-cli.md:332: P004 BCLI-026 names test 'box_verbs_exist_with_arch_flags', which was not found in the repository
docs/specs/28-spec-box-cli/28-spec-box-cli.md:340: P004 BCLI-028 names test 'help_and_completions_from_one_model', which was not found in the repository
docs/specs/28-spec-box-cli/28-spec-box-cli.md:427: P004 BCLI-034 names test 'exit_code_table', which was not found in the repository
docs/specs/28-spec-box-cli/28-spec-box-cli.md:543: P004 BCLI-042 names test 'removed_session_verbs_fail_as_unknown_commands', which was not found in the repository
docs/specs/28-spec-box-cli/28-spec-box-cli.md:547: P004 BCLI-043 names test 'setup_zed_unchanged', which was not found in the repository
docs/specs/28-spec-box-cli/28-spec-box-cli.md:552: P004 BCLI-044 names test 'cli_reference_documents_box_grammar', which was not found in the repository
docs/specs/28-spec-box-cli/28-spec-box-cli.md:576: P004 BCLI-049 names test 'host_stop_stops_boxes_then_daemon_and_vm', which was not found in the repository

Advisory. None of this blocks the merge; the review decides.

Advisory, and never a merge gate. Linter: gominimal/foundry@8acb0663, spec format: How Minimal Writes Specs.

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

Reviewed: no findings; approval withheld, 1 thread unresolved at 909d4b091ce5.

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.

@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 — advisory review

Verdict COMMENT — 1 finding, 1 inline.

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

Comment thread crates/minimal/src/cmd/boxes/wait.rs Outdated
Comment on lines +580 to +581
write_wait_output(&mut std::io::stdout().lock(), args.output, &waited)
.context("write how the box ended")?;
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.

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.

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.

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.

A failed write of the min/v1/wait object now answers output_failed in a machine output mode, as the
other document writers do.
@minimal-foundry
8000 Copy link
Copy Markdown
Contributor Author

Round 1 of 10 on the runtime's review findings, pushed as 909d4b091ce5.

line exit tail
cargo nextest run -p minimal box_wait_json_lists_how_the_box_ended 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 ot v0.0.1 (/workbench/crates/ot)

Verify min task run agent-verify exited 100.

for_io
        PASS [   0.005s] (1215/1241) minimal::bin/min tests::loadout_not_found_exits_4
        PASS [   0.006s] (1216/1241) minimal::bin/min tests::local_host_not_found_exits_4
        PASS [   0.006s] (1217/1241) minimal::bin/min tests::machine_mode_answers_write_failures
        PASS [   0.006s] (1218/1241) minimal::bin/min tests::machine_mode_error_line_keeps_an_empty_hint
        PASS [   0.005s] (1219/1241) minimal::bin/min tests::machine_mode_error_object_is_one_stamped_line
        PASS [   0.006s] (1220/1241) minimal::bin/min tests::machine_mode_error_object_on_stderr
        PASS [   0.006s] (1221/1241) minimal::bin/min tests::machine_mode_names_the_grant_refusal_code
        PASS [   0.005s] (1222/1241) minimal::bin/min tests::machine_output_mode_keys_on_the_output_flag
        PASS [   0.005s] (1223/1241) minimal::bin/min tests::misplaced_run_flag_exits_2
        PASS [   0.006s] (1224/1241) minimal::bin/min tests::network_flag_refusal_exits_2
        PASS [   0.006s] (1225/1241) minimal::bin/min tests::project_file_not_found_exits_4
        PASS [   0.006s] (1226/1241) minimal::bin/min tests::prune_off_tty_needs_yes_exits_2
        PASS [   0.008s] (1227/1241) minimal::bin/min tests::resume_and_session_attach_refusals_map_to_exit_codes
        PASS [   0.007s] (1228/1241) minimal::bin/min tests::rm_running_box_refuses_naming_force_with_exit_2
        PASS [   0.006s] (1229/1241) minimal::bin/min tests::row_not_back_exit_codes
        PASS [   0.006s] (1230/1241) minimal::bin/min tests::run_verbs_and_wait_timeout_return_124_with_code_timeout
        PASS [   0.007s] (1231/1241) minimal::bin/min tests::session_policy_json_is_a_stdout_contract
        PASS [   0.007s] (1232/1241) minimal::bin/min tests::session_run_is_a_stdout_contract
        PASS [   0.006s] (1233/1241) minimal::bin/min tests::start_entry_refusals_exit_with_their_codes
        PASS [   0.006s] (1234/1241) minimal::bin/min tests::task_file_invalid_exits_3
        PASS [   0.006s] (1235/1241) minimal::bin/min tests::task_network_key_a_task_does_not_apply_exits_3
        PASS [   0.006s] (1236/1241) minimal::bin/min tests::task_not_found_exits_4
        PASS [   0.007s] (1237/1241) minimal::bin/min tests::task_run_is_a_stdout_contract
        PASS [   0.005s] (1238/1241) minimal::bin/min tests::type_refusals_exit_3_and_4
        PASS [   2.057s] (1239/1241) minimal::named_vm egress_opt_out_reaches_autospawned_minvmd
        PASS [   2.058s] (1240/1241) minimal::named_vm named_vm_reaches_autospawn
  stdout ───

    running 1 test
    test exec_run_attach_and_task_run_share_the_commands_trace ... FAILED

    failures:

    failures:
        exec_run_attach_and_task_run_share_the_commands_trace

    test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 5 filtered out; finished in 13.03s

  stderr ───

    ]
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

  Cancelling due to test failure: 
────────────
error: test run failed

Outside the task's layers::

  • crates/minimal/src/cli.rs
  • crates/minimal/src/main.rs

Converted to a draft: verify exited 100; outside the task's layers:: crates/minimal/src/cli.rs, crates/minimal/src/main.rs.

Review threads the coder judged:

  • 👍 valid — crates/minimal/src/cmd/boxes/wait.rs: 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.

min box wait <box> -o json of a task box whose entry exits 3 prints {"schema":"min/v1/wait","boxes":[{"box_id":…,"name":…,"state":"exited","reason":"exit","exit_code":3,"signal":null,"code":3}]} and exits 3. When stdout cannot take that object, the machine-mode error is output_failed and not unspecified.

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:

  • fix(minimal): tag the box wait document write as OutputWriteError

@minimal-foundry
minimal-foundry Bot marked this pull request as draft November 20, 2026 03:08
@agent-137
agent-137 marked this pull request as ready for review November 20, 2026 03:13
@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: 1 unresolved thread — minimal-foundry[bot] crates/minimal/src/cmd/boxes/wait.rs. No findings.

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

@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 · 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.

@mitodrummer mitodrummer left a comment
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approved.

@mitodrummer
mitodrummer added this pull request to the merge queue Nov 20, 2026
Merged via the queue into main with commit 3e02d1f Nov 20, 2026
40 checks passed
@mitodrummer
mitodrummer deleted the agent/3199-min-box-wait-o-json-says-how-the-box-ended branch November 20, 2026 06:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

T64 — min box wait -o json says how the box ended

2 participants

0