Skip to content

fix(mctx,mfile,minimal): an invalid minimal.toml prints its TOML parse error once - #3243

Merged
norrietaylor merged 8 commits into
mainfrom
agent/3242-an-invalid-minimal-toml-prints-its-toml-parse-er
Nov 10, 2026
Merged

norrietaylor merged 8 commits into
mainfrom
agent/3242-an-invalid-minimal-toml-prints-its-toml-parse-er

Conversation

@minimal-foundry

@minimal-foundry minimal-foundry Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Defect

Fixes #3242

Charged to epic #1501. Size S.

May touch:

  • crates/minimal/src/cmd/boxes/create.rs
  • crates/mfile/src/error.rs
  • crates/minimal/src/cmd/project.rs
  • crates/minimal/src/main.rs
Task marker
### T1 — An invalid minimal.toml prints its TOML parse error once
  slice: S0
  kind: task
  covers: none
  size: S
  est: 15 code, 50 tests
  executor: agent
  defect: defect
  epic: 1501
  layers:
    - minimal:
      - crates/minimal/src/cmd/boxes/create.rs: ProjectFileInvalid Display drops {error} because source() already returns it; add test that the rendered error has one TOML parse error and exit 3
      - crates/mfile/src/error.rs: Error::Format Display prints only 'invalid TOML' because source() returns the toml error
      - crates/minimal/src/cmd/project.rs: update the test near line 1590 that reads 'invalid TOML' from refusal.message, if the message changes
      - crates/minimal/src/main.rs: the printer uses {e:#}, which walks source(); the exit 3 mapping stays. Add the render and exit code test here if needed
      test: cargo test -p minimal invalid_project_file_prints_toml_error_once
  produces: none
  consumes: none
  proof: min session activate on a minimal.toml that does not parse prints the TOML parse error snippet once and exits 3.

Proof

When min session activate meets a minimal.toml that does not parse, it prints one line: 'error: Cannot start the box: the project's minimal.toml does not load: invalid TOML: TOML parse error ...'. The snippet shows one time and the command exits 3. The test invalid_project_file_prints_toml_error_once in crates/minimal/src/main.rs checks this through the real stderr printer, answer_failure.

Notes from the agent: ProjectFileInvalid's Display and mfile's Error::Format Display no longer include the source error, because source() already returns it and the printer uses {e:#}. The min init refusal in cmd/project.rs printed the mfile error with to_string(). It now prints the whole source chain with {:#}, so its message still has the TOML snippet. The existing test still finds 'invalid TOML' in it. Other code that prints an mfile::Error with plain Display, and does not walk source(), now shows 'invalid TOML' with no snippet. Examples are mctx::Error::MFile ('minimal.toml: {0}') when a caller prints it without {:#}. Those callers are outside this task's layers and I did not audit each one. mctx::Error::MFile also returns the mfile error from source(), so its {:#} output still shows 'invalid TOML' two times, but the snippet only one time. I also ran the related tests init_invalid_mfile_exit3_appends_nothing and activation_refuses_unloadable_project_file_before_create, the mfile test suite, and cargo clippy -p minimal -p mfile --all-targets. All passed with no warnings. I did not run min session activate against a real daemon.

Tests

line exit tail
cargo test -p minimal invalid_project_file_prints_toml_error_once 0 running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 889 filtered out; finished in 0.00s running 1 test test tests::invalid_project_file_prints_toml_error_once ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 29 filtered out; finished in 0.00s running

Verify

min task run agent-verify exited 101 under rustc 1.99.0, which the repository does not pin (1.99.1 in rust-toolchain.toml); the PR is not a draft on that alone — CI, which honours the pin, is the gate.

the sandbox ran rustc (1.99.0), the repository pins 1.99.1 in rust-toolchain.toml; a failure here may be the newer toolchain's, not this change's
warning: unknown fields in [defaults] section of minimal.toml: session,task
help: do you need to update to a newer version of minimal?
Applying loadouts: default
Running task runtime-implement-verify in box runtime-implement-verify-1...
    Checking paths v0.0.1 (/workbench/crates/paths)
    Checking ot v0.0.1 (/workbench/crates/ot)
    Checking args v0.0.1 (/workbench/crates/args)
    Checking client-config v0.0.1 (/workbench/crates/client-config)
   Compiling version v0.8.0 (/workbench/crates/version)
   Compiling stdlib v0.0.22 (/workbench/crates/stdlib)
    Checking common v0.0.1 (/workbench/crates/common)
    Checking bep v0.0.1 (/workbench/crates/bep)
    Checking boxes v0.0.1 (/workbench/crates/boxes)
    Checking sandbox v0.0.1 (/workbench/crates/sandbox)
    Checking switch v0.0.1 (/workbench/crates/switch)
    Checking mlog v0.0.1 (/workbench/crates/mlog)
   Compiling minvmd v0.8.0 (/workbench/crates/minvmd)
    Checking diagnostics v0.0.1 (/workbench/crates/diagnostics)
    Checking async-dialog v0.0.1 (/workbench/crates/async-dialog)
    Checking mfile v0.0.1 (/workbench/crates/mfile)
    Checking minimald-rpc v0.0.1 (/workbench/crates/minimald-rpc)
    Checking minimal-client v0.8.0 (/workbench/crates/minimal-client)
    Checking decode v0.0.1 (/workbench/crates/decode)
    Checking checkouts v0.0.1 (/workbench/crates/checkouts)
    Checking graph v0.0.1 (/workbench/crates/graph)
    Checking lcache v0.0.1 (/workbench/crates/lcache)
    Checking rcache v0.0.1 (/workbench/crates/rcache)
    Checking op v0.0.1 (/workbench/crates/op)
    Checking check v0.0.1 (/workbench/crates/check)
    Checking orchestrator v0.0.1 (/workbench/crates/orchestrator)
    Checking mctx v0.0.1 (/workbench/crates/mctx)
    Checking minimal v0.8.0 (/workbench/crates/minimal)
    Checking minimald v0.8.0 (/workbench/crates/minimald)
    Finished `dev` profile [unoptimized] target(s) in 1m 22s
error: no such command: `nextest`

help: a command with a similar name exists: `test`

help: view all installed commands with `cargo --list`
help: find a package to install `nextest` with `cargo search cargo-nextest`

ProjectFileInvalid and mfile's Error::Format both returned the parse
error from source() and also wrote it in Display, so the {e:#} printer
showed the snippet twice. Display now leaves the detail to source().
@coderabbitai

coderabbitai Bot commented Nov 10, 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: 1e2ad6f4-405a-4110-953c-f9886562f793

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

@norrietaylor

Copy link
Copy Markdown
Member

/revise mctx::Error::MFile still prints invalid TOML twice under {:#}, as your notes on this PR say: its Display includes the mfile error and source() returns it too. Make it print once, the same way as ProjectFileInvalid, and add a test that renders it with {:#}.

@minimal-foundry

minimal-foundry Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor Author

Approved: every review thread resolved at 827cc9918812.

@norrietaylor 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: PASS · the full ruling

The change conforms. An invalid minimal.toml still ends with exit 3, as the Exit codes table at line 364 requires. The CLI text printer and the machine-mode message both format with {e:#}, so the snippet prints one time. The design states no rule on the message text. One risk is outside the design. minimald write_error_tagged prints with to_string(), so an in-box min task run now shows invalid TOML with no snippet. Fix that printer, or file an issue for it.

Ruled at 4b21257 against gominimal/arch@15b603e6afb8 by claude-opus-5-5.

Comment thread crates/mfile/src/error.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 — advisory review

Verdict COMMENT — 2 findings, 2 inline.

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

Comment thread crates/mfile/src/error.rs Resolved
Comment thread crates/minimal/src/cmd/boxes/create.rs Resolved
Error::MFile wrote the mfile error in Display and also returned it from
source(), so a chain printer showed 'invalid TOML' twice. Display now
renders the mfile error with its cause chain, and the variant has no
source().

@bryan-minimal bryan-minimal 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.

Read at the current head. The duplication came from two Display impls each inlining an error their source() already returned, and the fix is the right one: both now print their own words only, and the {:#} printer walks the chain once. The new test pins all three counts (one "TOML parse error", one "invalid TOML", one snippet) and the exit code, and find_init_mfile was moved to the chain printer for the same reason.

One note, not blocking: mctx::Error::MFile displays as minimal.toml: {0}, so any site that stringifies an mctx error with {} or to_string() rather than {:#} now shows "minimal.toml: invalid TOML" with no snippet. I did not find one on the CLI's activate path, which goes through the chain printer, but it is worth a grep when a report of a bare "invalid TOML" comes in.

@minimal-foundry

Copy link
Copy Markdown
Contributor Author

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

line exit tail
cargo test -p minimal invalid_project_file_prints_toml_error_once 0 running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 889 filtered out; finished in 0.00s running 1 test test tests::invalid_project_file_prints_toml_error_once ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 29 filtered out; finished in 0.00s running

Verify min task run agent-verify exited 101 under rustc 1.99.0, which the repository does not pin (1.99.1 in rust-toolchain.toml); the PR is not a draft on that alone — CI, which honours the pin, is the gate.

decs v0.4.45
    Checking moka v0.12.16
    Checking sha3 v0.12.0
    Checking ml-kem v0.3.2
    Checking ratatui-core v0.1.2
    Checking heapless v0.9.3
    Checking ssh-key v0.7.0-rc.11
    Checking signal-hook-mio v0.2.5
    Checking generic-array v1.4.4
    Checking derive_more v2.1.1
    Checking russh-cryptovec v0.62.0
    Checking num-bigint v0.5.1
    Checking yasna v0.6.0
    Checking graph v0.0.1 (/workbench/crates/graph)
    Checking pem v4.0.0
    Checking russh-util v0.52.0
    Checking hex-literal v1.1.0
    Checking hashbrown v0.14.5
    Checking bitflags v1.3.2
    Checking constcat v0.6.1
    Checking managed v0.8.0
    Checking dashmap v6.2.1
    Checking minimald-rpc v0.0.1 (/workbench/crates/minimald-rpc)
    Checking russh v0.65.0
    Checking smoltcp v0.14.0
    Checking rcgen v0.14.10
    Checking crossterm v0.29.0
    Checking async-compression v0.4.50
    Checking async-tar v0.6.1
    Checking line-clipping v0.3.8
    Checking serde_bytes v0.11.19
    Checking is_executable v1.0.6
    Checking ratatui-widgets v0.3.2
    Checking russh-sftp v2.4.0
    Checking clap_complete v4.6.11
    Checking lcache v0.0.1 (/workbench/crates/lcache)
    Checking bep v0.0.1 (/workbench/crates/bep)
    Checking switch v0.0.1 (/workbench/crates/switch)
    Checking sysinfo v0.39.6
   Compiling minvmd v0.8.0 (/workbench/crates/minvmd)
    Checking ratatui-macros v0.7.2
    Checking diagnostics v0.0.1 (/workbench/crates/diagnostics)
    Checking ratatui-crossterm v0.1.2
    Checking fuzzy-matcher v0.3.7
    Checking wait-timeout v0.2.1
    Checking quick-error v1.2.3
    Checking rcache v0.0.1 (/workbench/crates/rcache)
    Checking bit-vec v0.10.1
    Checking inquire v0.9.4
    Checking rusty-fork v0.3.1
    Checking bit-set v0.11.1
    Checking ratatui v0.30.2
    Checking minimal-client v0.8.0 (/workbench/crates/minimal-client)
    Checking vsock v0.5.4
    Checking vte v0.15.0
    Checking rand_xorshift v0.5.0
    Checking core_detect v1.0.0
    Checking unarray v0.1.4
    Checking op v0.0.1 (/workbench/crates/op)
    Checking proptest v1.12.0
    Checking vt100 v0.16.2 (https://github.com/gominimal/vt100-rust.git?rev=9b8cce5a6798daf061948259ebcb073bb1ea54a6#9b8cce5a)
    Checking tokio-vsock v0.7.2
    Checking async-dialog v0.0.1 (/workbench/crates/async-dialog)
    Checking similar v2.7.0
    Checking insta v1.49.0
   Compiling serial_test_derive v4.0.1
    Checking check v0.0.1 (/workbench/crates/check)
    Checking orchestrator v0.0.1 (/workbench/crates/orchestrator)
    Checking serial_test v4.0.1
    Checking mctx v0.0.1 (/workbench/crates/mctx)
    Checking minimald v0.8.0 (/workbench/crates/minimald)
    Checking minimal v0.8.0 (/workbench/crates/minimal)
    Finished `dev` profile [unoptimized] target(s) in 1m 37s
error: no such command: `nextest`

help: a command with a similar name exists: `test`

help: view all installed commands with `cargo --list`
help: find a package to install `nextest` with `cargo search cargo-nextest`

Outside the task's layers::

  • crates/mctx/src/error.rs

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

When min session activate runs on a minimal.toml that does not parse, it prints the TOML parse error snippet once and exits 3. An mctx::Error::MFile rendered with {:#} now also shows 'invalid TOML' and the parse error once each.

Notes from the agent: This round touches crates/mctx/src/error.rs. That file is outside the task's layers, but the /revise note asks for this exact change, and the layer files cannot fix it. Error::MFile no longer uses #[from]. It has a manual From impl and no source(). Its Display now renders the mfile error and its full cause chain, so {} and {:#} both show the snippet once. NotFound still prints 'minimal.toml: not found'. Nothing in minimal or minimald downcasts the chain to mfile::Error, so the dropped source() changes no exit code. The new test in mctx walks source() by hand: mctx::Error is not Send (nickel types), so anyhow::Error cannot hold it. A defect remains and this round does not fix it: mfile::Error::IO writes its io::Error in Display and also returns it from source(), so an I/O error can still print its cause twice under {:#}.

@minimal-foundry
minimal-foundry Bot marked this pull request as draft November 10, 2026 18:03

@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 design does not state a rule on the text of a configuration error, so this is a PASS by absence. The compare changes only mctx::Error::MFile, which no longer returns its mfile error from source(). No code in the tree finds the mfile error through a chain. An invalid minimal.toml still exits 3, as the Exit codes table requires. The ruling on 4b21257b stands for the other files.

Ruled at bfa98e2 against gominimal/arch@15b603e6afb8 by claude-opus-5-5.

@norrietaylor
norrietaylor marked this pull request as ready for review November 10, 2026 18:46

@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: 3 unresolved threads — minimal-arch[bot] crates/mfile/src/error.rs:137, minimal-foundry[bot] crates/mfile/src/error.rs:137, minimal-foundry[bot] crates/minimal/src/cmd/boxes/create.rs:104.

minimal-review — advisory review

Verdict COMMENT — No findings.

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

@norrietaylor

Copy link
Copy Markdown
Member

/revise

This round covers the three open review threads. Change only crates/mfile/src/error.rs. Do not edit crates/mctx/src/error.rs or any file outside the task's layers:.

Problem. At bfa98e29, mfile::Error::Format displays only invalid TOML and moves the parse error to source(). Callers that print an mfile error with {} or to_string() now lose the line, column and snippet. Evidence: crates/decode/src/lib.rs:184, Err(e) => return Err(Error::Other(e.to_string())), in Layer::new. The graph load of a layer whose minimal.toml does not parse now reports a bare invalid TOML. This is the minimal-review thread on crates/mfile/src/error.rs:137. The crates/minimal/src/cmd/boxes/create.rs:3939 site that thread names formats a boxes::core::compose::ComposeError, not an mfile error, so it needs no change.

Fix. In crates/mfile/src/error.rs, make the Display text carry the cause and make source() return None for it. This is the pattern Error::LinkConfig already uses in the same file.

  1. Restore Error::Format(e) => write!(f, "invalid TOML: {}", e).
  2. In impl std::error::Error for Error, change Error::Format(e) => Some(e) to Error::Format(_) => None.
  3. Error::IO: keep its Display ("{} I/O error at path {}: {}"), and change Error::IO(_, _, e) => Some(e) to Error::IO(..) => None. Today ProjectFileInvalid at crates/minimal/src/cmd/boxes/create.rs:864 wraps mfile::Error::IO, and {:#} prints the io error twice (the minimal-review thread on create.rs:104). No exit-code mapping reads an io error from an mfile error's chain (failure_exit_code and is_broken_pipe in crates/minimal/src/main.rs), and decode matches mfile::Error::IO(_, _, e) by pattern, so no caller depends on that source().
  4. Replace the comment above Error::Format with one that says why: Display carries the cause and source() returns none, so {} and {:#} each print it once.

ProjectFileInvalid keeps its own words and returns the mfile error from source(), so {:#} still prints Cannot start the box: the project's minimal.toml does not load: invalid TOML: TOML parse error ... once. mctx::Error::MFile with MFileDisplay keeps the snippet under both {} and {:#} (the minimal-arch thread on mfile/src/error.rs:137, for write_error_tagged in crates/minimald/src/env.rs). Leave both as they are.

Tests. Add to the test module in crates/mfile/src/error.rs:

  • An Error::Format from entry::read_entries(b"[boxes.dev\ntype = \"session\"\n") has a to_string() that contains TOML parse error and [boxes.dev once each, and its source() is None.
  • An Error::IO("minimal file", path, io::Error::from(io::ErrorKind::PermissionDenied)) printed as {} plus a walk of its source() chain (the way anyhow's {:#} does) contains the io error text once. mfile has no anyhow dev-dependency: walk the chain by hand, and do not edit crates/mfile/Cargo.toml.

Run cargo test -p mfile, cargo test -p mctx and cargo test -p minimal invalid_project_file_prints_toml_error_once. The existing tests mfile_format_error_prints_toml_error_once in mctx and invalid_project_file_prints_toml_error_once in minimal must pass with no change.

Error::Format printed only 'invalid TOML' and moved the parse error to
source(), so callers that print with {} lost the line and snippet.
Display now carries the cause for Format and IO, and source() returns
none for both, so {} and {:#} each print it once.
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

Round 2 of 10 on a /revise note, pushed as 2f9aa5d1dfb7.

line exit tail
cargo test -p minimal invalid_project_file_prints_toml_error_once 0 running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 890 filtered out; finished in 0.00s running 1 test test tests::invalid_project_file_prints_toml_error_once ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 29 filtered out; finished in 0.00s running

Verify min task run agent-verify exited 101 under rustc 1.99.0, which the repository does not pin (1.99.1 in rust-toolchain.toml); the PR is not a draft on that alone — CI, which honours the pin, is the gate.

ecking getrandom v0.2.17
    Checking sponge-cursor v0.1.0
    Checking tagptr v0.2.0
    Checking compression-core v0.4.33
    Checking moka v0.12.16
    Checking compression-codecs v0.4.45
    Checking sha3 v0.12.0
    Checking ring v0.17.14
    Checking ml-kem v0.3.2
    Checking ratatui-core v0.1.2
    Checking heapless v0.9.3
    Checking ssh-key v0.7.0-rc.11
    Checking signal-hook-mio v0.2.5
    Checking generic-array v1.4.4
    Checking derive_more v2.1.1
    Checking russh-cryptovec v0.62.0
    Checking num-bigint v0.5.1
    Checking yasna v0.6.0
    Checking pem v4.0.0
    Checking russh-util v0.52.0
    Checking object v0.40.0
    Checking managed v0.8.0
    Checking hex-literal v1.1.0
    Checking hashbrown v0.14.5
    Checking bitflags v1.3.2
    Checking constcat v0.6.1
    Checking smoltcp v0.14.0
    Checking minimald-rpc v0.0.1 (/workbench/crates/minimald-rpc)
    Checking dashmap v6.2.1
    Checking check v0.0.1 (/workbench/crates/check)
    Checking russh v0.65.0
    Checking rcgen v0.14.10
    Checking crossterm v0.29.0
    Checking orchestrator v0.0.1 (/workbench/crates/orchestrator)
    Checking async-compression v0.4.50
    Checking async-tar v0.6.1
    Checking line-clipping v0.3.8
    Checking serde_bytes v0.11.19
    Checking is_executable v1.0.6
    Checking russh-sftp v2.4.0
    Checking clap_complete v4.6.11
    Checking ratatui-widgets v0.3.2
    Checking bep v0.0.1 (/workbench/crates/bep)
    Checking switch v0.0.1 (/workbench/crates/switch)
    Checking sysinfo v0.39.6
   Compiling minvmd v0.8.0 (/workbench/crates/minvmd)
    Checking ratatui-macros v0.7.2
    Checking mctx v0.0.1 (/workbench/crates/mctx)
    Checking diagnostics v0.0.1 (/workbench/crates/diagnostics)
    Checking ratatui-crossterm v0.1.2
    Checking fuzzy-matcher v0.3.7
    Checking wait-timeout v0.2.1
    Checking quick-error v1.2.3
    Checking bit-vec v0.10.1
    Checking inquire v0.9.4
    Checking rusty-fork v0.3.1
    Checking bit-set v0.11.1
    Checking ratatui v0.30.2
    Checking minimal-client v0.8.0 (/workbench/crates/minimal-client)
    Checking vsock v0.5.4
    Checking vte v0.15.0
    Checking rand_xorshift v0.5.0
    Checking core_detect v1.0.0
    Checking unarray v0.1.4
    Checking vt100 v0.16.2 (https://github.com/gominimal/vt100-rust.git?rev=9b8cce5a6798daf061948259ebcb073bb1ea54a6#9b8cce5a)
    Checking proptest v1.12.0
    Checking tokio-vsock v0.7.2
    Checking async-dialog v0.0.1 (/workbench/crates/async-dialog)
    Checking similar v2.7.0
    Checking minimald v0.8.0 (/workbench/crates/minimald)
    Checking insta v1.49.0
   Compiling serial_test_derive v4.0.1
    Checking serial_test v4.0.1
    Checking minimal v0.8.0 (/workbench/crates/minimal)
    Finished `dev` profile [unoptimized] target(s) in 2m 39s
error: no such command: `nextest`

help: a command with a similar name exists: `test`

help: view all installed commands with `cargo --list`
help: find a package to install `nextest` with `cargo search cargo-nextest`

Outside the task's layers::

  • crates/mctx/src/error.rs

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

Review threads the coder judged:

  • 👍 valid — crates/mfile/src/error.rs: mfile::Error::Format Display carries the TOML parse error again, so plain {} printers such as write_error_tagged show the line and snippet.
  • 👍 valid — crates/mfile/src/error.rs: Format Display is 'invalid TOML: ' again and source() returns None, so decode's e.to_string() keeps the snippet. The create.rs:3939 site formats a ComposeError, not an mfile error, so it needs no change.
  • 👍 valid — crates/minimal/src/cmd/boxes/create.rs:104: mfile::Error::IO source() now returns None. Its Display already carries the io error, so {:#} on ProjectFileInvalid prints it once. A new test walks the chain to check this.

min session activate on a minimal.toml that does not parse prints 'Cannot start the box: the project's minimal.toml does not load: invalid TOML: TOML parse error ...' with the snippet once, and exits 3. Callers that print an mfile error with {} or to_string(), such as decode's Layer::new, now show the line, column and snippet again.

Notes from the agent: This round changed only crates/mfile/src/error.rs, as the directive asked. Error::Format Display is 'invalid TOML: {e}' again. source() returns None for Format and IO, so {} and {:#} each print the cause once. Two tests are new in the mfile error module. One checks the Format text and source(). The other walks the source() chain by hand for an IO error. The existing tests in mctx and minimal pass with no change.

@minimal-foundry
minimal-foundry Bot marked this pull request as draft November 10, 2026 19:07
@norrietaylor
norrietaylor marked this pull request as ready for review November 10, 2026 19:09

@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: 1 of 3 personas ran (correctness); did not complete: security, supply-chain.

Comment thread crates/mfile/src/error.rs Resolved
The TOML fix only needs Error::Format to drop its source. Restore
Some(e) for Error::IO so chain walkers still see the io kind.

@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. An invalid minimal.toml still ends with exit 3, as the Exit codes table says at line 364. The exit code comes from the ProjectFileInvalid downcast, not from the source() chain that this push changes. The design states no rule on the text of the error. The PR body note about invalid TOML two times describes an earlier head. Update it when you next edit the body.

Ruled at 89d19b3 against gominimal/arch@15b603e6afb8 by claude-opus-5-5.

@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/create.rs Resolved
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

Round 3 of 10 on the runtime's review findings, pushed as 89d19b353d34.

line exit tail
cargo test -p minimal invalid_project_file_prints_toml_error_once 0 running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 890 filtered out; finished in 0.00s running 1 test test tests::invalid_project_file_prints_toml_error_once ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 29 filtered out; finished in 0.00s running

Verify min task run agent-verify exited 101 under rustc 1.99.0, which the repository does not pin (1.99.1 in rust-toolchain.toml); the PR is not a draft on that alone — CI, which honours the pin, is the gate.

    Checking kem v0.3.0
    Checking getrandom v0.2.17
    Checking sponge-cursor v0.1.0
    Checking tagptr v0.2.0
    Checking compression-core v0.4.33
    Checking sha3 v0.12.0
    Checking moka v0.12.16
    Checking compression-codecs v0.4.45
    Checking ring v0.17.14
    Checking ml-kem v0.3.2
    Checking ratatui-core v0.1.2
    Checking heapless v0.9.3
    Checking ssh-key v0.7.0-rc.11
    Checking signal-hook-mio v0.2.5
    Checking generic-array v1.4.4
    Checking derive_more v2.1.1
    Checking russh-cryptovec v0.62.0
    Checking num-bigint v0.5.1
    Checking yasna v0.6.0
    Checking pem v4.0.0
    Checking russh-util v0.52.0
    Checking object v0.40.0
    Checking managed v0.8.0
    Checking hex-literal v1.1.0
    Checking hashbrown v0.14.5
    Checking lcache v0.0.1 (/workbench/crates/lcache)
    Checking bitflags v1.3.2
    Checking constcat v0.6.1
    Checking dashmap v6.2.1
    Checking smoltcp v0.14.0
    Checking minimald-rpc v0.0.1 (/workbench/crates/minimald-rpc)
    Checking russh v0.65.0
    Checking rcgen v0.14.10
    Checking crossterm v0.29.0
    Checking async-compression v0.4.50
    Checking rcache v0.0.1 (/workbench/crates/rcache)
    Checking async-tar v0.6.1
    Checking line-clipping v0.3.8
    Checking serde_bytes v0.11.19
    Checking is_executable v1.0.6
    Checking ratatui-widgets v0.3.2
    Checking russh-sftp v2.4.0
    Checking clap_complete v4.6.11
    Checking bep v0.0.1 (/workbench/crates/bep)
    Checking switch v0.0.1 (/workbench/crates/switch)
    Checking sysinfo v0.39.6
   Compiling minvmd v0.8.0 (/workbench/crates/minvmd)
    Checking ratatui-macros v0.7.2
    Checking diagnostics v0.0.1 (/workbench/crates/diagnostics)
    Checking ratatui-crossterm v0.1.2
    Checking op v0.0.1 (/workbench/crates/op)
    Checking fuzzy-matcher v0.3.7
    Checking wait-timeout v0.2.1
    Checking ratatui v0.30.2
    Checking inquire v0.9.4
    Checking rusty-fork v0.3.1
    Checking minimal-client v0.8.0 (/workbench/crates/minimal-client)
    Checking vsock v0.5.4
    Checking vte v0.15.0
    Checking proptest v1.12.0
    Checking vt100 v0.16.2 (https://github.com/gominimal/vt100-rust.git?rev=9b8cce5a6798daf061948259ebcb073bb1ea54a6#9b8cce5a)
    Checking tokio-vsock v0.7.2
    Checking async-dialog v0.0.1 (/workbench/crates/async-dialog)
    Checking similar v2.7.0
    Checking insta v1.49.0
    Checking check v0.0.1 (/workbench/crates/check)
    Checking orchestrator v0.0.1 (/workbench/crates/orchestrator)
   Compiling serial_test_derive v4.0.1
    Checking serial_test v4.0.1
    Checking mctx v0.0.1 (/workbench/crates/mctx)
    Checking minimald v0.8.0 (/workbench/crates/minimald)
    Checking minimal v0.8.0 (/workbench/crates/minimal)
    Finished `dev` profile [unoptimized] target(s) in 2m 13s
error: no such command: `nextest`

help: a command with a similar name exists: `test`

help: view all installed commands with `cargo --list`
help: find a package to install `nextest` with `cargo search cargo-nextest`

Outside the task's layers::

  • crates/mctx/src/error.rs

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

Review threads the coder judged:

  • 👍 valid — PRRT_kwDOPdfcxM6124Vj: Restored Error::IO's source() to Some(e) and dropped the IO test. Now only Error::Format returns no source, so chain walkers still see the io kind. (not posted on the thread: not an open thread on the pull request)

min session activate on a minimal.toml that does not parse prints the TOML parse error snippet once and exits 3. An mfile I/O error still carries its std::io::Error as its source.

Notes from the agent: This round restores Error::IO's source() to Some(e) and removes the io_error_chain_prints_io_error_once test. The change is scoped to Error::Format, as the task describes. Under {:#}, an mfile I/O error prints its io text twice again, the same as on main. cargo clippy -p mfile --all-targets printed no warnings.

@minimal-foundry
minimal-foundry Bot marked this pull request as draft November 10, 2026 19:28
ProjectFileInvalid now carries its cause in Display and returns no
source. Error::IO keeps the io error in both its Display and its
source, so a chain printer showed that io error twice. Plain Display
printers of ProjectFileInvalid also get the cause back.
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

Round 4 of 10 on a failed check suite, pushed as 0b6da95b78bd.

line exit tail
cargo test -p minimal invalid_project_file_prints_toml_error_once 0 t result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 895 filtered out; finished in 0.00s running 2 tests test tests::invalid_project_file_prints_toml_error_once_for_io ... ok test tests::invalid_project_file_prints_toml_error_once ... ok test result: ok. 2 passed; 0 failed; 0 ignored; 0 measu

Verify min task run agent-verify exited 101 under rustc 1.99.0, which the repository does not pin (1.99.1 in rust-toolchain.toml); the PR is not a draft on that alone — CI, which honours the pin, is the gate.

the sandbox ran rustc (1.99.0), the repository pins 1.99.1 in rust-toolchain.toml; a failure here may be the newer toolchain's, not this change's
warning: unknown fields in [defaults] section of minimal.toml: task,session
help: do you need to update to a newer version of minimal?
Applying loadouts: default
Running task runtime-implement-verify in box runtime-implement-verify-1...
 Downloading crates ...
  Downloaded serial_test_derive v4.0.1
  Downloaded serial_test v4.0.1
    Checking paths v0.0.1 (/workbench/crates/paths)
    Checking args v0.0.1 (/workbench/crates/args)
    Checking ot v0.0.1 (/workbench/crates/ot)
    Checking client-config v0.0.1 (/workbench/crates/client-config)
   Compiling version v0.8.0 (/workbench/crates/version)
    Checking common v0.0.1 (/workbench/crates/common)
   Compiling stdlib v0.0.22 (/workbench/crates/stdlib)
    Checking bep v0.0.1 (/workbench/crates/bep)
    Checking boxes v0.0.1 (/workbench/crates/boxes)
    Checking sandbox v0.0.1 (/workbench/crates/sandbox)
    Checking switch v0.0.1 (/workbench/crates/switch)
   Compiling minvmd v0.8.0 (/workbench/crates/minvmd)
    Checking diagnostics v0.0.1 (/workbench/crates/diagnostics)
    Checking mlog v0.0.1 (/workbench/crates/mlog)
    Checking async-dialog v0.0.1 (/workbench/crates/async-dialog)
    Checking mfile v0.0.1 (/workbench/crates/mfile)
    Checking minimald-rpc v0.0.1 (/workbench/crates/minimald-rpc)
   Compiling serial_test_derive v4.0.1
    Checking minimal-client v0.8.0 (/workbench/crates/minimal-client)
    Checking serial_test v4.0.1
    Checking decode v0.0.1 (/workbench/crates/decode)
    Checking checkouts v0.0.1 (/workbench/crates/checkouts)
    Checking graph v0.0.1 (/workbench/crates/graph)
    Checking lcache v0.0.1 (/workbench/crates/lcache)
    Checking rcache v0.0.1 (/workbench/crates/rcache)
    Checking op v0.0.1 (/workbench/crates/op)
    Checking check v0.0.1 (/workbench/crates/check)
    Checking orchestrator v0.0.1 (/workbench/crates/orchestrator)
    Checking mctx v0.0.1 (/workbench/crates/mctx)
    Checking minimal v0.8.0 (/workbench/crates/minimal)
    Checking minimald v0.8.0 (/workbench/crates/minimald)
    Finished `dev` profile [unoptimized] target(s) in 1m 38s
error: no such command: `nextest`

help: a command with a similar name exists: `test`

help: view all installed commands with `cargo --list`
help: find a package to install `nextest` with `cargo search cargo-nextest`

Outside the task's layers::

  • crates/mctx/src/error.rs

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

Review threads the coder judged:

  • 👍 valid — crates/minimal/src/cmd/boxes/create.rs: ProjectFileInvalid now prints its cause in Display and returns no source(), so an Error::IO cause prints its io error once under {:#} and plain {} keeps the cause. Added invalid_project_file_prints_toml_error_once_for_io in main.rs.

min session activate on a minimal.toml that does not parse prints 'Cannot start the box: the project's minimal.toml does not load: invalid TOML: TOML parse error ...' with the snippet once, and exits 3. An unreadable minimal.toml now also prints its io error once, not twice.

Notes from the agent: Revise round 4. ProjectFileInvalid now puts the mfile error in its Display and returns no source(). Nothing in crates/minimal walks the chain under ProjectFileInvalid for an mfile or io error. The exit 3 mapping downcasts ProjectFileInvalid itself. I also ran activation_refuses_unloadable_project_file_before_create, init_invalid_mfile_exit3_appends_nothing and project_egress_table_reaches_box_policy, and they pass. clippy -p minimal --all-targets is clean. Failed checks: ci-linux-native-success is the lane aggregator and its excerpt shows no failing job. native-daemon-e2e failed on a DNS lookup for e2e-nnat-a.min.internal after activate. That path is not in this diff, which only changes how an invalid minimal.toml error prints, so I made no change for it. A re-run will show whether it is a flake.

@norrietaylor
norrietaylor marked this pull request as ready for review November 10, 2026 19:52

@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

This head conforms. The new commit puts the mfile error into the ProjectFileInvalid message and removes its source(), so each printer shows the cause one time. The exit code stays 3, as Exit codes line 364 requires, because failure_exit_code() finds the error by downcast. The merge of main is clean. The earlier PASS on 89d19b35 stands for the rest.

Ruled at 0b6da95 against gominimal/arch@15b603e6afb8 by claude-opus-5-5.

@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/mctx/src/error.rs Resolved
The MFile variant walked the mfile error's source() chain after its
Display. Error::IO prints its io error in Display and returns it as
source(), so the io error printed twice. Every mfile Display already
carries its cause, so print Display alone.

@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 compare from the last ruled head changes one file, crates/mctx/src/error.rs. It removes the chain walker and prints the mfile error with its own Display. Every mfile error Display already prints its cause, so each cause still shows once. The exit-3 mapping (architecture.md line 364) does not change. The earlier PASS stands, and this head conforms.

Ruled at 827cc99 against gominimal/arch@15b603e6afb8 by claude-opus-5-5.

@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: 2 unresolved threads — minimal-arch[bot] crates/mfile/src/error.rs, minimal-foundry[bot] crates/mctx/src/error.rs.

minimal-review — advisory review

Verdict COMMENT — No findings.

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

@minimal-foundry

Copy link
Copy Markdown
Contributor Author

Round 5 of 10 on the runtime's review findings, pushed as 827cc9918812.

line exit tail
cargo test -p minimal invalid_project_file_prints_toml_error_once 0 t result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 895 filtered out; finished in 0.00s running 2 tests test tests::invalid_project_file_prints_toml_error_once_for_io ... ok test tests::invalid_project_file_prints_toml_error_once ... ok test result: ok. 2 passed; 0 failed; 0 ignored; 0 measu

Verify min task run agent-verify exited 101 under rustc 1.99.0, which the repository does not pin (1.99.1 in rust-toolchain.toml); the PR is not a draft on that alone — CI, which honours the pin, is the gate.

0.0.1 (/workbench/crates/decode)
    Checking checkouts v0.0.1 (/workbench/crates/checkouts)
    Checking ratatui-core v0.1.2
    Checking heapless v0.9.3
    Checking ssh-key v0.7.0-rc.11
    Checking signal-hook-mio v0.2.5
    Checking generic-array v1.4.4
    Checking derive_more v2.1.1
    Checking russh-cryptovec v0.62.0
    Checking num-bigint v0.5.1
    Checking yasna v0.6.0
    Checking pem v4.0.0
    Checking russh-util v0.52.0
    Checking hex-literal v1.1.0
    Checking hashbrown v0.14.5
    Checking bitflags v1.3.2
    Checking constcat v0.6.1
    Checking managed v0.8.0
    Checking dashmap v6.2.1
    Checking minimald-rpc v0.0.1 (/workbench/crates/minimald-rpc)
    Checking smoltcp v0.14.0
    Checking russh v0.65.0
    Checking graph v0.0.1 (/workbench/crates/graph)
    Checking rcgen v0.14.10
    Checking crossterm v0.29.0
    Checking async-compression v0.4.50
    Checking async-tar v0.6.1
    Checking line-clipping v0.3.8
    Checking serde_bytes v0.11.19
    Checking is_executable v1.0.6
    Checking russh-sftp v2.4.0
    Checking ratatui-widgets v0.3.2
    Checking clap_complete v4.6.11
    Checking bep v0.0.1 (/workbench/crates/bep)
    Checking switch v0.0.1 (/workbench/crates/switch)
    Checking sysinfo v0.39.6
   Compiling minvmd v0.8.0 (/workbench/crates/minvmd)
    Checking ratatui-macros v0.7.2
    Checking ratatui-crossterm v0.1.2
    Checking diagnostics v0.0.1 (/workbench/crates/diagnostics)
    Checking fuzzy-matcher v0.3.7
    Checking wait-timeout v0.2.1
    Checking quick-error v1.2.3
    Checking bit-vec v0.10.1
    Checking ratatui v0.30.2
    Checking bit-set v0.11.1
    Checking rusty-fork v0.3.1
    Checking inquire v0.9.4
    Checking minimal-client v0.8.0 (/workbench/crates/minimal-client)
    Checking lcache v0.0.1 (/workbench/crates/lcache)
    Checking vsock v0.5.4
    Checking vte v0.15.0
    Checking rand_xorshift v0.5.0
    Checking core_detect v1.0.0
    Checking unarray v0.1.4
    Checking proptest v1.12.0
    Checking rcache v0.0.1 (/workbench/crates/rcache)
    Checking vt100 v0.16.2 (https://github.com/gominimal/vt100-rust.git?rev=9b8cce5a6798daf061948259ebcb073bb1ea54a6#9b8cce5a)
    Checking tokio-vsock v0.7.2
    Checking async-dialog v0.0.1 (/workbench/crates/async-dialog)
    Checking similar v2.7.0
    Checking insta v1.49.0
    Checking op v0.0.1 (/workbench/crates/op)
   Compiling serial_test_derive v4.0.1
    Checking serial_test v4.0.1
    Checking check v0.0.1 (/workbench/crates/check)
    Checking orchestrator v0.0.1 (/workbench/crates/orchestrator)
    Checking mctx v0.0.1 (/workbench/crates/mctx)
    Checking minimald v0.8.0 (/workbench/crates/minimald)
    Checking minimal v0.8.0 (/workbench/crates/minimal)
    Finished `dev` profile [unoptimized] target(s) in 2m 20s
error: no such command: `nextest`

help: a command with a similar name exists: `test`

help: view all installed commands with `cargo --list`
help: find a package to install `nextest` with `cargo search cargo-nextest`

Outside the task's layers::

  • crates/mctx/src/error.rs

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

Review threads the coder judged:

  • 👍 valid — crates/mctx/src/error.rs: Removed the MFileDisplay chain walk. MFile now prints only the mfile Display, which already carries the io or TOML cause. Added mfile_io_error_prints_io_error_once.

min session activate on a minimal.toml that does not parse prints the TOML parse error snippet once and exits 3. An unreadable minimal.toml that reaches an mctx error now prints its io error once, not twice.

Notes from the agent: crates/mctx/src/error.rs is outside the task's layers. Earlier rounds of this pull request already changed it, and the review thread points at it. This round removes the MFileDisplay chain walk, so the MFile variant prints the mfile Display alone and returns no source(). Every mfile Display already prints its cause, so no cause is lost. cargo clippy -p mctx --all-targets printed no warnings.

@minimal-foundry
minimal-foundry Bot marked this pull request as draft November 10, 2026 20:12
@norrietaylor
norrietaylor marked this pull request as ready for review November 10, 2026 20:42
@norrietaylor norrietaylor changed the title T1 — An invalid minimal.toml prints its TOML parse error once fix(mctx,mfile,minimal): an invalid minimal.toml prints its TOML parse error once Nov 10, 2026

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

Babysitter review at 827cc991, against T1's plan block and its test line.

  • Proof. ProjectFileInvalid carries its mfile error in its text and returns no source(). mfile::Error::Format prints invalid TOML: <parse error> and returns no source(). So {:#} prints Cannot start the box: the project's minimal.toml does not load: invalid TOML: TOML parse error ... once, and the exit-3 mapping (a downcast of ProjectFileInvalid) is unchanged. invalid_project_file_prints_toml_error_once in crates/minimal/src/main.rs checks this through answer_failure, with one count each for TOML parse error, invalid TOML and the snippet, plus the exit code.
  • Plain-{} callers keep the snippet: crates/decode/src/lib.rs:184 (e.to_string()) and write_error_tagged in crates/minimald/src/env.rs (through mctx::Error::MFile, now {prefix}: {0} with no source).
  • IO. mfile::Error::IO keeps its io error as source(), so chain readers still see the io kind. ProjectFileInvalid and mctx::Error::MFile stop the chain, so an unreadable minimal.toml prints the io error once. Tests: invalid_project_file_prints_toml_error_once_for_io and mfile_io_error_prints_io_error_once.
  • Scope. crates/mctx/src/error.rs is outside the layers. It is the in-box printer's half of the same defect, which arch raised on the first head.

All six review threads are addressed at this head. No change requested.

@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; @norrietaylor closed the last one. The review of 827cc9918812 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 10, 2026
@norrietaylor
norrietaylor added this pull request to the merge queue Nov 10, 2026
Merged via the queue into main with commit ac76fea Nov 10, 2026
38 checks passed
@norrietaylor
norrietaylor deleted the agent/3242-an-invalid-minimal-toml-prints-its-toml-parse-er branch November 10, 2026 22:16
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

Development

Successfully merging this pull request may close these issues.

T1 — An invalid minimal.toml prints its TOML parse error once

2 participants