8000 fix(minimal,minimald,minimald-rpc): a broker refusal that only minimald makes reaches min with its by minimal-foundry[bot] · Pull Request #3670 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

fix(minimal,minimald,minimald-rpc): a broker refusal that only minimald makes reaches min with its - #3670

Merged
mitodrummer merged 6 commits into
mainfrom
agent/3665-a-broker-refusal-that-only-minimald-makes-reache
Nov 20, 2026
Merged

mitodrummer merged 6 commits into
mainfrom
agent/3665-a-broker-refusal-that-only-minimald-makes-reache

Conversation

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

Follow-up

Fixes #3665

Task marker
### D3276 — A broker refusal that only minimald makes reaches min with its code, and min exits 5 with gatehouse_unenrolled_node
  kind: task
  size: M
  est: 110 code, 120 tests
  executor: agent
  origin: bug
  epic: 2236
  layers:
    - wire:
      - crates/minimald-rpc/src/lib.rs: gives the CreateSession reply a refusal variant (or optional fields) that carries the refusal text, its code and its exit code, and keeps old replies readable
      - crates/minimald-rpc/src/tests.rs: pins the serde form of a coded refusal, and pins that a plain error reply with no code still decodes
      test: cargo test -p minimald-rpc create_session_refusal_carries_its_code
    - daemon:
      - crates/minimald/src/rpc.rs: fills the code and exit_code from ActivationRefused in the BOX-081 arm, and removes the #3276 note that says min exits 1
      test: cargo test -p minimald unenrolled_refusal_reply_carries_exit_code
    - client:
      - crates/minimal/src/cmd/boxes/create.rs: create_refusal reads the refusal code and exit code and returns a typed error that keeps them
      - crates/minimal/src/task.rs: passes the coded CreateSession refusal to create_refusal
      - crates/minimal/src/dash/rpc.rs: follows the new CreateSession reply type in CreateFuture and create_registering
      - crates/minimal/src/main.rs: failure_exit_code and the machine-mode answer use the daemon refusal code, so the exit is 5 with gatehouse_unenrolled_node
      - crates/minimal/src/tests.rs: adds a test where only the daemon refuses a non-GitHub broker grant, and min exits 5 with gatehouse_unenrolled_node
      test: cargo test -p minimal daemon_only_broker_refusal_exits_5
  proof: On an unenrolled node that a proxy serves, min with a non-GitHub broker grant that only minimald refuses exits 5 and reports gatehouse_unenrolled_node, and it does not exit 1.

Proof

On an unenrolled host that a proxy serves, a create with a non-GitHub broker grant (aws:s3) passes the min-side check and minimald refuses it. The CreateSession reply now carries code gatehouse_unenrolled_node, exit_code 5 and the next step. min turns it into a DaemonCreateRefusal, so the command exits 5, and -o json answers with code gatehouse_unenrolled_node, not exit 1 and unspecified.

Notes from the agent: Design: CreateSession now replies with a new minimald_rpc::CreateSessionReply enum. It has the same untagged wire form as Errorable, plus optional code, exit_code and hint fields on Err. A plain {"error":...} reply still decodes, and an older client reads a coded reply as a plain Errorable error (both pinned in the wire test). I did not add fields to Errorable itself, because hundreds of Errorable::Err { error } patterns across the workspace match it. I added hint beside code and exit_code because the -o json answer needs a hint, and the daemon has the next step. Out-of-scope files: the Response type change breaks every test that pattern-matches a CreateSession reply as Errorable. Those files need a mechanical update to compile: crates/minimald/src/rpc/tests.rs, crates/minimald/src/box_manager/tests.rs, crates/minimald/src/connection.rs (test module), crates/minimal/tests/cli.rs, crates/minvmd/tests/minimald_session_integration.rs. Each one only swaps Errorable for CreateSessionReply (Err { error, .. }). The daemon test is an inline #[cfg(test)] module at the end of crates/minimald/src/rpc.rs, over the socket, with a root certificate so the host counts as proxy-served. The minimal test line also matches a second test in main.rs, because failure_exit_code and machine_mode_answer live in the bin target and the lib tests cannot reach them. The machine-mode answer maps the daemon code to the codes this build defines (gatehouse_unenrolled_node, github_sign_in_required), because MachineModeFailure::new takes a &'static str (cli.rs is out of scope)…[truncated]

Tests

line exit tail
cargo test -p minimald-rpc create_session_refusal_carries_its_code 0 running 1 test test tests::create_session_refusal_carries_its_code ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 91 filtered out; finished in 0.00s warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: netw
cargo test -p minimald unenrolled_refusal_reply_carries_exit_code 0 running 1 test test rpc::unenrolled_refusal_tests::unenrolled_refusal_reply_carries_exit_code ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1531 filtered out; finished in 0.05s running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 13 filtered out; fini
cargo test -p minimal daemon_only_broker_refusal_exits_5 0 ed; 0 ignored; 0 measured; 1049 filtered out; finished in 0.05s running 1 test test tests::daemon_only_broker_refusal_exits_5_with_its_code ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 42 filtered out; finished in 0.00s running 0 tests test result: ok. 0 passed; 0 failed;

Verify

min task run agent-verify exited 101, so this PR is a draft.

49.rlib --extern paths=/work/build-cache/cargo-home/build/debug/deps/libpaths-38d338f2d2882e54.rlib --extern proptest=/work/build-cache/cargo-home/build/debug/deps/libproptest-44d491d1a8aa49a0.rlib --extern ratatui=/work/build-cache/cargo-home/build/debug/deps/libratatui-1fc20dde22a8a62b.rlib --extern reqwest=/work/build-cache/cargo-home/build/debug/deps/libreqwest-5de86acda4cea8f4.rlib --extern russh=/work/build-cache/cargo-home/build/debug/deps/librussh-ed15d7ff509bfc78.rlib --extern russh_sftp=/work/build-cache/cargo-home/build/debug/deps/librussh_sftp-c0dd194e0f0fbcdd.rlib --extern serde=/work/build-cache/cargo-home/build/debug/deps/libserde-a2d31a39ef0e3ca2.rlib --extern serde_json_lenient=/work/build-cache/cargo-home/build/debug/deps/libserde_json_lenient-d40e6f0e7b3e9eef.rlib --extern sha2=/work/build-cache/cargo-home/build/debug/deps/libsha2-c9bcb32104c3d8ae.rlib --extern switch=/work/build-cache/cargo-home/build/debug/deps/libswitch-89cccedb7487721f.rlib --extern tempfile=/work/build-cache/cargo-home/build/debug/deps/libtempfile-a0e916d9301e1bc8.rlib --extern tokio=/work/build-cache/cargo-home/build/debug/deps/libtokio-13fd64194b408f82.rlib --extern tokio_stream=/work/build-cache/cargo-home/build/debug/deps/libtokio_stream-f2be74d61837d3fa.rlib --extern toml=/work/build-cache/cargo-home/build/debug/deps/libtoml-2aea33601fef026d.rlib --extern toml_edit=/work/build-cache/cargo-home/build/debug/deps/libtoml_edit-c70767a08866b85f.rlib --extern tracing=/work/build-cache/cargo-home/build/debug/deps/libtracing-83feaaf26e80a884.rlib --extern tracing_subscriber=/work/build-cache/cargo-home/build/debug/deps/libtracing_subscriber-b9d261067ec6d0c0.rlib --extern unicode_width=/work/build-cache/cargo-home/build/debug/deps/libunicode_width-b88ae913615e5a0f.rlib --extern url=/work/build-cache/cargo-home/build/debug/deps/liburl-7dfaaabb254cca5f.rlib --extern uuid=/work/build-cache/cargo-home/build/debug/deps/libuuid-2ad4c678aa627cb6.rlib --extern version=/work/build-cache/cargo-home/build/debug/deps/libversion-26aec4f378b53f65.rlib --extern zeroize=/work/build-cache/cargo-home/build/debug/deps/libzeroize-839e2912eb255706.rlib -L native=/work/build-cache/cargo-home/build/debug/build/zstd-sys-0d91391d9ed43bde/out -L native=/work/build-cache/cargo-home/build/debug/build/ring-43aedddb25fbb121/out -L native=/work/build-cache/cargo-home/build/debug/build/aws-lc-sys-467e076f78a0a3c4/out -L native=/work/build-cache/cargo-home/build/debug/build/tree-sitter-6abcf750100a3ada/out -L native=/work/build-cache/cargo-home/build/debug/build/tree-sitter-nickel-4d55240ed02e956b/out -L native=/work/build-cache/cargo-home/build/debug/build/blake3-493bdc0df5a171ff/out -L native=/work/build-cache/cargo-home/build/debug/build/blake3-493bdc0df5a171ff/out` (exit status: 101)
error: command `/usr/bin/cargo '--color=auto' test --no-run --message-format json-render-diagnostics --package minimal --package minimald --package minimald-rpc --package minvmd --locked` exited with code 101

Base

The base branch moved while the coder worked and was merged in before the tests ran. These files changed on BOTH sides since the branch point — read them first, because a rewrite from a stale reading can undo a merge without a conflict:

  • crates/minimal/src/cmd/boxes/create.rs
  • crates/minimal/src/tests.rs

Out of scope

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

  • crates/minimal/tests/cli.rs
  • crates/minimald/src/box_manager/tests.rs
  • crates/minimald/src/connection.rs
  • crates/minimald/src/rpc/tests.rs
  • crates/minvmd/tests/minimald_session_integration.rs

Closes #3276 (the original issue this task was triaged from).

The reply gains optional code, exit_code and hint fields on the
refusal. A plain error reply with no code still decodes (#3276).
The BOX-081 reply now fills the refusal's code, exit code and next
step, so the client can exit 5 and not 1 (#3276). The minimald tests
that match a CreateSession reply follow the new reply type.
min keeps the code, exit code and hint of a coded CreateSession
refusal, so a non-GitHub broker grant that only minimald refuses
exits 5 with gatehouse_unenrolled_node, not 1 (#3276). Tests that
match a CreateSession reply follow the new reply type.
@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: 860443cb-0cb3-4a0e-a6d9-78c62a2f73b9

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

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

Approved: no findings at e565ed7e4b56.

Nothing to do.

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 — approved

Verdict APPROVE — No findings.

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

@minimal-foundry minimal-foundry Bot added the review:approved minimal-review approved the current head label Nov 20, 2026
@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. A broker refusal that only minimald makes now carries its code, its next step and its exit code. So min exits 5 with gatehouse_unenrolled_node, as the exit code table (line 366) and Gatehouse section 6.2 require. The wire change adds only optional fields, and old replies still decode in both directions. The verify run exited 101 on cargo test --no-run. That is a build matter, and this ruling does not decide it.

Ruled at e75cce7 against gominimal/arch@8b824707cde6 by claude-opus-5-5.

@agent-137
Copy link
Copy Markdown
Member

/revise

This PR conflicts with main at e75cce7. Merge main into the branch and resolve the conflicts. The likely sources are #3644 (local-minvmd becomes the default provider on Linux with /dev/kvm; tests that mean native now say --provider local or MIN_PROVIDER=local), #3612 and #3610. Keep this PR's CreateSessionReply refusal variant. Move every caller that main added or changed to the new reply type, the same way the existing callers were moved.

In the PR body's Verify notes, say that the earlier agent-verify exit 101 came from the build environment, not from this change. It stopped at cargo test --no-run, while CI's build and test lanes passed at the same head. If the new verify run passes, say that instead.

Keep the PR body's line Closes #3276 (the original issue this task was triaged from).

Keep both new tests in crates/minimal/src/tests.rs. Callers that main
added compile against the CreateSessionReply refusal variant.
@minimal-foundry
Copy link
Copy Markdown
Contributor Author

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

Resolved conflicts in: crates/minimal/src/tests.rs

line exit tail
cargo test -p minimald-rpc create_session_refusal_carries_its_code 0 running 1 test test tests::create_session_refusal_carries_its_code ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 91 filtered out; finished in 0.00s warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: netw
cargo test -p minimald unenrolled_refusal_reply_carries_exit_code 0 running 1 test test rpc::unenrolled_refusal_tests::unenrolled_refusal_reply_carries_exit_code ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1532 filtered out; finished in 0.04s running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 13 filtered out; fini
cargo test -p minimal daemon_only_broker_refusal_exits_5 0 ed; 0 ignored; 0 measured; 1064 filtered out; finished in 0.04s running 1 test test tests::daemon_only_broker_refusal_exits_5_with_its_code ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 44 filtered out; finished in 0.00s running 0 tests test result: ok. 0 passed; 0 failed;

Verify min task run agent-verify exited 101.

49.rlib --extern paths=/work/build-cache/cargo-home/build/debug/deps/libpaths-38d338f2d2882e54.rlib --extern proptest=/work/build-cache/cargo-home/build/debug/deps/libproptest-44d491d1a8aa49a0.rlib --extern ratatui=/work/build-cache/cargo-home/build/debug/deps/libratatui-1fc20dde22a8a62b.rlib --extern reqwest=/work/build-cache/cargo-home/build/debug/deps/libreqwest-5de86acda4cea8f4.rlib --extern russh=/work/build-cache/cargo-home/build/debug/deps/librussh-ed15d7ff509bfc78.rlib --extern russh_sftp=/work/build-cache/cargo-home/build/debug/deps/librussh_sftp-c0dd194e0f0fbcdd.rlib --extern serde=/work/build-cache/cargo-home/build/debug/deps/libserde-a2d31a39ef0e3ca2.rlib --extern serde_json_lenient=/work/build-cache/cargo-home/build/debug/deps/libserde_json_lenient-d40e6f0e7b3e9eef.rlib --extern sha2=/work/build-cache/cargo-home/build/debug/deps/libsha2-c9bcb32104c3d8ae.rlib --extern switch=/work/build-cache/cargo-home/build/debug/deps/libswitch-89cccedb7487721f.rlib --extern tempfile=/work/build-cache/cargo-home/build/debug/deps/libtempfile-a0e916d9301e1bc8.rlib --extern tokio=/work/build-cache/cargo-home/build/debug/deps/libtokio-13fd64194b408f82.rlib --extern tokio_stream=/work/build-cache/cargo-home/build/debug/deps/libtokio_stream-f2be74d61837d3fa.rlib --extern toml=/work/build-cache/cargo-home/build/debug/deps/libtoml-2aea33601fef026d.rlib --extern toml_edit=/work/build-cache/cargo-home/build/debug/deps/libtoml_edit-c70767a08866b85f.rlib --extern tracing=/work/build-cache/cargo-home/build/debug/deps/libtracing-83feaaf26e80a884.rlib --extern tracing_subscriber=/work/build-cache/cargo-home/build/debug/deps/libtracing_subscriber-b9d261067ec6d0c0.rlib --extern unicode_width=/work/build-cache/cargo-home/build/debug/deps/libunicode_width-b88ae913615e5a0f.rlib --extern url=/work/build-cache/cargo-home/build/debug/deps/liburl-7dfaaabb254cca5f.rlib --extern uuid=/work/build-cache/cargo-home/build/debug/deps/libuuid-2ad4c678aa627cb6.rlib --extern version=/work/build-cache/cargo-home/build/debug/deps/libversion-26aec4f378b53f65.rlib --extern zeroize=/work/build-cache/cargo-home/build/debug/deps/libzeroize-839e2912eb255706.rlib -L native=/work/build-cache/cargo-home/build/debug/build/zstd-sys-0d91391d9ed43bde/out -L native=/work/build-cache/cargo-home/build/debug/build/ring-43aedddb25fbb121/out -L native=/work/build-cache/cargo-home/build/debug/build/aws-lc-sys-467e076f78a0a3c4/out -L native=/work/build-cache/cargo-home/build/debug/build/tree-sitter-6abcf750100a3ada/out -L native=/work/build-cache/cargo-home/build/debug/build/tree-sitter-nickel-4d55240ed02e956b/out -L native=/work/build-cache/cargo-home/build/debug/build/blake3-493bdc0df5a171ff/out -L native=/work/build-cache/cargo-home/build/debug/build/blake3-493bdc0df5a171ff/out` (exit status: 101)
error: command `/usr/bin/cargo '--color=auto' test --no-run --message-format json-render-diagnostics --package minimal --package minimald --package minimald-rpc --package minvmd --locked` exited with code 101

Outside the task's layers::

  • crates/minimal/tests/cli.rs
  • crates/minimald/src/box_manager/tests.rs
  • crates/minimald/src/connection.rs
  • crates/minimald/src/rpc/tests.rs
  • crates/minvmd/tests/minimald_session_integration.rs

Converted to a draft: verify exited 101; outside the task's layers:: crates/minimal/tests/cli.rs, crates/minimald/src/connection.rs, crates/minimald/src/rpc/tests.rs.

On an unenrolled node that a proxy serves, min with a non-GitHub broker grant that only minimald refuses exits 5 and reports gatehouse_unenrolled_node, not 1. The branch now merges origin/main cleanly and keeps this behaviour.

Notes from the agent: Merged origin/main into the branch. The only conflict was crates/minimal/src/tests.rs: both sides added a test at the same place, and the merge keeps both (daemon_only_broker_refusal_exits_5 and main's row_not_back tests). cargo clippy -p minimal -p minimald -p minimald-rpc --all-targets passed with no errors, so the callers that main added or changed already compile against the CreateSessionReply refusal variant. No caller needed an edit. The other changed files in the merge commit, .github/workflows/release.yml among them, come from origin/main and not from this task. For the PR body Verify notes: the earlier agent-verify exit 101 came from the build environment, not from this change. It stopped at cargo test --no-run, and CI's build and test lanes passed at the same head. At this head all three test lines compile and pass locally. Keep the PR body line 'Closes #3276 (the original issue this task was triaged from).' The merge commit message was shortened to fit 72 characters before any push.

@minimal-foundry
minimal-foundry Bot marked this pull request as draft November 20, 2026 03:29
@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 new head only merges main into the branch. The PR's own changes are the same as at e75cce73. The one conflict in crates/minimal/src/tests.rs keeps both tests. The earlier ruling stands: the coded refusal brings the gatehouse_unenrolled_node defined error from Gatehouse spec §6.2 to min.

Ruled at e565ed7 against gominimal/arch@8b824707cde6 by claude-opus-5-5.

@agent-137
agent-137 marked this pull request as ready for review November 20, 2026 05:31
@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 2fd3558 Nov 20, 2026
39 checks passed
@mitodrummer
mitodrummer deleted the agent/3665-a-broker-refusal-that-only-minimald-makes-reache branch November 20, 2026 06: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

2 participants

0