8000 fix(minimal): T33 — Exit codes follow the architecture's table by minimal-foundry[bot] · Pull Request #3719 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

fix(minimal): T33 — Exit codes follow the architecture's table - #3719

Merged
mitodrummer merged 3 commits into
mainfrom
agent/2923-exit-codes-follow-the-architecture-s-table
Nov 23, 2026
Merged

mitodrummer merged 3 commits into
mainfrom
agent/2923-exit-codes-follow-the-architecture-s-table

Conversation

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

T33 — Exit codes follow the architecture's table

slice: S8
kind: task
covers: BCLI-034
size: S
est: 100 code, 60 tests
executor: agent
difficulty: routine
model: light
diagnostics: each refusal keeps the message the task that added it prints; this task changes only the exit code, pinned by exit_code_table
observability: the command's existing tracing span records the verb, the box id it resolved and the outcome
layers:
- client:
- crates/minimal/src/main.rs: maps each outcome to the exit code the architecture's table names
- crates/minimal/src/tests.rs: the in-process minimald test harness gains this layer's tests
test: cargo nextest run -p minimal exit_code_table
produces: none
consumes: none
proof: Every command ends with the exit code the architecture's table gives its outcome.
depends on:
- blocked by #2922

Proof

Every min command ends with the exit code the exit-code table gives its outcome, except when the selected host's daemon does not answer (#3734, under Residuals). An invalid --vm name, which ended with 1 before, now ends with 2 as a usage error, with the same text. The exit_code_table tests pin each error kind (ambiguous 2, not_found 4, host_unreachable 7, github_sign_in_required 3, gatehouse_unenrolled_node 5, timeout and wait_timeout 124, output_failed and unspecified 1) in both output modes, and pin each refusal type's o 8000 wn code.

Notes from the agent: T46 (#3436) already moved most refusals that exited 1 onto the table's codes, so this task found one gap in main.rs: a refused --vm value exited 1 before the command ran. It now exits 2 through answer_vm_name, and its message is unchanged. The [proposed] rows (exit 8 insufficient_resources, and 5's provider-quota case) are not pinned, as BCLI-034 excludes them. The architecture document is not in this repository. I took the rows from docs/reference/cli-min.md and from the codes main.rs already gives. Outside the layers, I saw one refusal that still exits 1: crates/minimal/src/cmd/boxes/address.rs box_host_client bails with 'Host is not running.' as an untyped error. It is probably a host_unreachable (7) outcome. It needs a typed error in address.rs, which this task's layers do not name, so I left it unchanged. The command span in cmd/mod.rs already records the verb and the outcome, so observability needed no change. I did not run just ci, just clippy-strict or the whole crate suite.

Tests

line exit tail
cargo nextest run -p minimal exit_code_table 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.

8) minimal::bin/min tests::invalid_project_file_for_box_spec_says_spec_cannot_show
        PASS [   0.010s] (1213/1238) minimal::bin/min tests::invalid_project_file_prints_toml_error_once
        PASS [   0.008s] (1214/1238) minimal::bin/min tests::invalid_project_file_prints_toml_error_once_for_io
        PASS [   0.009s] (1215/1238) minimal::bin/min tests::loadout_not_found_exits_4
        PASS [   0.009s] (1216/1238) minimal::bin/min tests::local_host_not_found_exits_4
        PASS [   0.010s] (1217/1238) minimal::bin/min tests::machine_mode_answers_write_failures
        PASS [   0.009s] (1218/1238) minimal::bin/min tests::machine_mode_error_line_keeps_an_empty_hint
        PASS [   0.009s] (1219/1238) minimal::bin/min tests::machine_mode_error_object_on_stderr
        PASS [   0.010s] (1220/1238) minimal::bin/min tests::machine_mode_error_object_is_one_stamped_line
        PASS [   0.010s] (1221/1238) minimal::bin/min tests::machine_output_mode_keys_on_the_output_flag
        PASS [   0.010s] (1222/1238) minimal::bin/min tests::machine_mode_names_the_grant_refusal_code
        PASS [   0.008s] (1223/1238) minimal::bin/min tests::misplaced_run_flag_exits_2
        PASS [   0.009s] (1224/1238) minimal::bin/min tests::network_flag_refusal_exits_2
        PASS [   0.007s] (1225/1238) minimal::bin/min tests::prune_off_tty_needs_yes_exits_2
        PASS [   0.010s] (1226/1238) minimal::bin/min tests::project_file_not_found_exits_4
        PASS [   0.008s] (1227/1238) minimal::bin/min tests::resume_and_session_attach_refusals_map_to_exit_codes
        PASS [   0.009s] (1228/1238) minimal::bin/min tests::rm_running_box_refuses_naming_force_with_exit_2
        PASS [   0.008s] (1229/1238) minimal::bin/min tests::row_not_back_exit_codes
        PASS [   0.010s] (1230/1238) minimal::bin/min tests::run_verbs_and_wait_timeout_return_124_with_code_timeout
        PASS [   0.008s] (1231/1238) minimal::bin/min tests::start_entry_refusals_exit_with_their_codes
        PASS [   0.008s] (1232/1238) minimal::bin/min tests::task_file_invalid_exits_3
        PASS [   0.009s] (1233/1238) minimal::bin/min tests::task_network_key_a_task_does_not_apply_exits_3
        PASS [   0.010s] (1234/1238) minimal::bin/min tests::task_not_found_exits_4
        PASS [   0.009s] (1235/1238) minimal::bin/min tests::task_run_is_a_stdout_contract
        PASS [   0.008s] (1236/1238) minimal::bin/min tests::type_refusals_exit_3_and_4
        PASS [   2.069s] (1237/1238) 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.55s

  stderr ───

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

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

Residuals

Closes #2923

An invalid --vm name is a usage error, so it now ends with exit 2,
as a command line min cannot parse does. Its text is unchanged.

The exit_code_table tests pin each error kind's exit code and its
machine-mode code, and each refusal's own code, against the table.
@coderabbitai
coderabbitai Bot commented Nov 21, 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: a6e77ab0-719b-4d7a-ad20-042b9ac79872

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

@agent-137
Copy link
Copy Markdown
Member

/arch-review

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

Reviewed: no findings; approval withheld, 2 threads unresolved at 0bbe6167929c.

APPROVE withheld: 2 unresolved threads — minimal-arch[bot] crates/minimal/src/main.rs:2063, minimal-arch[bot] crates/minimal/src/cmd/boxes/address.rs:714. 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-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 · 1 condition · the full ruling

The --vm change is correct. A refused name is a usage error, and it now ends with 2 as row 2 of the exit-code table says. The change claims that every command ends with its table code, but two host refusals in address.rs still end with 1. box_host_client bails Host <name> is not running., and probe_other_host returns Could not reach host <name>., both untyped. Row 7 of the table (line 370) gives a host that does not answer exit 7. Type both as HostUnreachable as C1 says, or file an issue for the gap and name it in the PR body.

Outside the diff

  • crates/minimal/src/cmd/boxes/address.rs:714: C1 · This refusal is untyped, so it ends with 1. Row 7 of the exit-code table (architecture.md line 370) gives a host that does not answer exit 7. Return HostUnreachable::error(...) with the same text.
  • crates/minimal/src/cmd/boxes/address.rs:758: C1 · This error is untyped, so it ends with 1. Wrap it as HostUnreachable::over(e, ...) with the same text, so it ends with 7 (architecture.md line 370).

Ruled at 4f2df13 against gominimal/arch@4f2eb87d5d12 by claude-opus-5-5.

/// The [proposed] rows (8, `insufficient_resources`, and 5's provider
/// quota) are outside the requirement, so they are not pinned here.
#[test]
fn exit_code_table() {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

C1 · Add a row for each address.rs host refusal that C1 types, with exit 7 and kind host_unreachable.

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 0bbe6167929c: Added two exit_code_table rows, for the stopped host and the unreachable host, each with exit 7 and kind host_unreachable. A tests.rs test also drives box_host_client on both.

@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-arch[bot] crates/minimal/src/main.rs:2063. No findings.

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

@agent-137
Copy link
Copy Markdown
Member

/revise Arch's ruling at 4f2df13 (CONDITIONS): C1. The plan's layers now list crates/minimal/src/cmd/boxes/address.rs.

C1: two host failures exit 1 where the architecture's table gives row 7 (provider or host unreachable). Type them at the source, and keep both texts:

  1. crates/minimal/src/cmd/boxes/address.rs box_host_client() (line 714): replace bail!("Host {} is not running.", host.host) with return Err(minimal_client::box_registration::HostUnreachable::error(format!("Host {} is not running.", host.host))).
  2. probe_other_host() (line 758): wrap the ProbeRefusal::Unreachable(e) arm as HostUnreachable::over(e, format!("Could not reach host {}.", host.host)).
  3. failure_exit_code() in main.rs already maps HostUnreachable to 7. Add a row for each to exit_code_table, or a test in crates/minimal/src/tests.rs that drives box_host_client on a stopped host and asserts exit 7.

Change nothing else. Build and test only -p minimal: cargo nextest run -p minimal exit_code_table. The verify failure in exec_run_attach_and_task_run_share_the_commands_trace is the known flake #3483.

box_host_client and probe_other_host now type their two host failures
as HostUnreachable, so min ends with exit 7 (provider or host
unreachable), as the exit-code table gives it. Both texts are unchanged.
exit_code_table pins both rows, and a new test drives box_host_client
on a stopped host and on an unreachable one.
@minimal-foundry
Copy link
Copy Markdown
Contributor Author

Round 1 of 10 on a /revise note, pushed as 0bbe6167929c.

line exit tail
cargo nextest run -p minimal exit_code_table 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.

9) minimal::bin/min tests::invalid_project_file_for_box_spec_says_spec_cannot_show
        PASS [   0.006s] (1214/1239) minimal::bin/min tests::invalid_project_file_prints_toml_error_once
        PASS [   0.006s] (1215/1239) minimal::bin/min tests::invalid_project_file_prints_toml_error_once_for_io
        PASS [   0.005s] (1216/1239) minimal::bin/min tests::local_host_not_found_exits_4
        PASS [   0.006s] (1217/1239) minimal::bin/min tests::loadout_not_found_exits_4
        PASS [   0.005s] (1218/1239) minimal::bin/min tests::machine_mode_answers_write_failures
        PASS [   0.009s] (1219/1239) minimal::bin/min tests::machine_mode_error_line_keeps_an_empty_hint
        PASS [   0.006s] (1220/1239) minimal::bin/min tests::machine_mode_error_object_is_one_stamped_line
        PASS [   0.006s] (1221/1239) minimal::bin/min tests::machine_mode_error_object_on_stderr
        PASS [   0.005s] (1222/1239) minimal::bin/min tests::machine_mode_names_the_grant_refusal_code
        PASS [   0.005s] (1223/1239) minimal::bin/min tests::machine_output_mode_keys_on_the_output_flag
        PASS [   0.005s] (1224/1239) minimal::bin/min tests::misplaced_run_flag_exits_2
        PASS [   0.006s] (1225/1239) minimal::bin/min tests::network_flag_refusal_exits_2
        PASS [   0.005s] (1226/1239) minimal::bin/min tests::project_file_not_found_exits_4
        PASS [   0.006s] (1227/1239) minimal::bin/min tests::prune_off_tty_needs_yes_exits_2
        PASS [   0.005s] (1228/1239) minimal::bin/min tests::resume_and_session_attach_refusals_map_to_exit_codes
        PASS [   0.005s] (1229/1239) minimal::bin/min tests::rm_running_box_refuses_naming_force_with_exit_2
        PASS [   0.006s] (1230/1239) minimal::bin/min tests::row_not_back_exit_codes
        PASS [   0.005s] (1231/1239) minimal::bin/min tests::run_verbs_and_wait_timeout_return_124_with_code_timeout
        PASS [   0.005s] (1232/1239) minimal::bin/min tests::start_entry_refusals_exit_with_their_codes
        PASS [   0.005s] (1233/1239) minimal::bin/min tests::task_file_invalid_exits_3
        PASS [   0.005s] (1234/1239) minimal::bin/min tests::task_network_key_a_task_does_not_apply_exits_3
        PASS [   0.006s] (1235/1239) minimal::bin/min tests::task_not_found_exits_4
        PASS [   0.008s] (1236/1239) minimal::bin/min tests::task_run_is_a_stdout_contract
        PASS [   0.005s] (1237/1239) minimal::bin/min tests::type_refusals_exit_3_and_4
        PASS [   2.055s] (1238/1239) 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.11s

  stderr ───

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

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

Converted to a draft: verify exited 100.

Review threads the coder judged:

  • 👍 valid — crates/minimal/src/main.rs:2063: Added two exit_code_table rows, for the stopped host and the unreachable host, each with exit 7 and kind host_unreachable. A tests.rs test also drives box_host_client on both.

Every min command ends with the exit code the architecture's table gives its outcome. A box command that names a stopped host or a host that does not answer now exits 7, not 1, and prints the same text as before.

Notes from the agent: C1 is done. box_host_client returns HostUnreachable::error for a stopped host, and probe_other_host wraps the Unreachable arm with HostUnreachable::over. Both texts are unchanged. exit_code_table in main.rs has a row for each. The new test exit_code_table_box_host_client_host_unreachable in tests.rs drives box_host_client on a stopped host and on an unreachable host (a socket path longer than the kernel accepts). It asserts the HostUnreachable type, and failure_exit_code in main.rs maps that type to 7. tests.rs is in the library crate, so it cannot call failure_exit_code in the binary directly. The commitlint failure is on an earlier commit on this branch (subject 'T33 — exit codes ...' is sentence-case). I cannot rewrite pushed commits, so that check stays red until someone squashes the pull request with a valid title. The new commit subject is in lower case. cargo clippy -p minimal --all-targets reports no warnings.

@minimal-foundry
minimal-foundry Bot marked this pull request as draft November 23, 2026 16:15
@agent-137
agent-137 marked this pull request as ready for review November 23, 2026 16:16
@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 · 1 condition · the full ruling

C1 from the last ruling is met. box_host_client and probe_other_host now type both host failures as HostUnreachable, so min ends with 7, as the Exit codes table gives at line 370. A test drives the real function. One gap remains outside this task's layers. When the selected host's daemon does not answer, Client::connect returns an untyped error, and the command ends with 1. File an issue for that gap and name it in the PR body as a residual (C2).

Ruled at 0bbe616 against gominimal/arch@4f2eb87d5d12 by claude-opus-5-5.

match probe_other_host(host).await? {
Some(client) => Ok(client),
None => bail!("Host {} is not running.", host.host),
// BCLI-034: a stopped host exits 7, provider or host unreachable.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

C2 · This arm now ends with 7, so C1 is met. The selected-host branch above calls connect_box_host() (line 744). That function wraps the Client::connect failure only with with_context, so it still ends with 1. list.rs, boxes/list.rs, net.rs and attach.rs do the same. File an issue to type these failures as HostUnreachable (architecture.md line 370). Name that issue in the PR body.

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.

Filed as #3734 and listed under Residuals in the PR body, as the ruling at 0bbe6167 allows.

@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/minimal/src/main.rs:2063, minimal-arch[bot] crates/minimal/src/cmd/boxes/address.rs:714. No findings.

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

@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 23, 2026
Merged via the queue into main with commit 0d5779b Nov 23, 2026
39 of 40 checks passed
@mitodrummer
mitodrummer deleted the agent/2923-exit-codes-follow-the-architecture-s-table branch November 23, 2026 17:58
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.

T33 — Exit codes follow the architecture's table

2 participants

0