8000 T124 — Gate loadouts on loadout_mode: session open, task sealed, an unknown mode refused by minimal-foundry[bot] · Pull Request #3291 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

T124 — Gate loadouts on loadout_mode: session open, task sealed, an unknown mode refused - #3291

Merged
mitodrummer merged 3 commits into
mainfrom
agent/3247-gate-loadouts-on-loadout-mode-session-open-task
Nov 12, 2026
Merged

mitodrummer merged 3 commits into
mainfrom
agent/3247-gate-loadouts-on-loadout-mode-session-open-task

Conversation

@minimal-foundry
Copy link
Copy Markdown
Contributor

T124 — Gate loadouts on loadout_mode: session open, task sealed, an unknown mode refused

slice: S5
kind: task
covers: BOX-166, BOX-167, BOX-168, BOX-169, BOX-170, BOX-174
size: M
est: 130 code, 170 tests
executor: agent
difficulty: needs care
model: strongest
diagnostics: the refusal names the value and the layer that set loadout_mode
observability: the expansion report carries loadout_mode and its layer, shown by min box spec
layers:
- types:
- crates/mfile/src/box_types.rs: session root defaults loadout_mode open, task root sealed
- expansion:
- crates/mfile/src/expand.rs: read loadout_mode from the layers up to the entry; refuse an unknown value; leave the loadouts layer empty when sealed, whole when open
- crates/mfile/src/error.rs: the unknown-mode refusal
- crates/mfile/src/spec.rs: the merge-mode test becomes open
test: cargo nextest run -p mfile sealed_spec_applies_no_loadout
test: cargo nextest run -p mfile open_spec_applies_whole_loadout
test: cargo nextest run -p mfile builtin_roots_default_loadout_mode
test: cargo nextest run -p mfile loadout_gate_follows_setting_not_type_name
test: cargo nextest run -p mfile unknown_loadout_mode_refused_exit3
produces: none
consumes:
- crates/mfile/src/box_types.rs
proof: A session entry takes its loadouts and a task entry takes none, from the setting alone, and an unknown mode fails before a loadout is applied.
depends on:
- blocked by #2410
- blocked by #2420

Proof

When mfile expands an entry, a session entry takes the selected loadouts' packages, patches, vars, vars_lenient and lifecycle hooks, and a task entry takes none of them. The loadout_mode setting alone decides this: a session set to sealed takes nothing, and a type that extends task and sets open takes the loadout. A loadout_mode other than sealed or open fails with exit 3 before any loadout applies. The error names the key, the value, the layer that set it, and sealed and open as the accepted values.

Notes from the agent: The built-in root defaults come from the new box_types::builtin_defaults. ResolvedType.defaults[0] now carries loadout_mode for the session and task roots. The existing box_type_resolves_to_builtin_root test changed from 'root defaults are empty' to 'root defaults equal builtin_defaults("task")'. The gate reads either the flat loadout_mode key or [box].loadout_mode, whichever a later layer set. When no layer sets loadout_mode, the loadouts layer applies as before. That case is reachable only when a caller does not pass the root's type defaults. A non-string value applies no loadout, and the existing shape check then refuses it. The refusal is the new SpecKeyProblem::UnknownValue variant on Error::InvalidSpecKey (exit 3). Its text is: " sets loadout_mode to "x". loadout_mode accepts only sealed or open. Fix the value." The expansion report already carries loadout_mode and its origin under report.values. I added no new report field. The minimal crate's create paths (create.rs) do not pass type defaults or a loadouts layer to expand yet, so a box creation shows no change today except the unknown-value refusal from [defaults], [defaults.] or the entry. min box spec also needs no change from this task. A test in expand.rs (invalid_key_exit3_names_key_and_layer) also used loadout_mode = "merge" in a session type default. I changed it to "open" because the new refusal rejects "merge". All 150 mfile tests pass, and cargo…[truncated]

Tests

line exit tail
cargo nextest run -p mfile sealed_spec_applies 8000 _no_loadout 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p mfile open_spec_applies_whole_loadout 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p mfile builtin_roots_default_loadout_mode 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p mfile loadout_gate_follows_setting_not_type_name 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p mfile unknown_loadout_mode_refused_exit3 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt

Verify

min task run agent-verify passed ([tasks.verify]).

Closes #3247

The session root now defaults loadout_mode to open and the task root
to sealed. Expansion reads the mode from the layers up to and
including the entry. A sealed entry takes an empty loadouts layer and
an open entry takes it whole, whatever the type name. Any other value
fails with exit 3 before a loadout applies, and names the key, the
value, the layer that set it and the accepted values.

Covers BOX-166, BOX-167, BOX-168, BOX-169, BOX-170 and BOX-174.
@coderabbitai
coderabbitai Bot commented Nov 11, 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: 521cb795-2413-465b-b078-7ee15c992d5a

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

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

Reviewed: 1 finding, none blocking at 308198c9ecff.

Address the comments on the diff.

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 — 1 finding, 1 inline.

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

Comment thread crates/mfile/src/box_types.rs Resolved
@minimal-foundry minimal-foundry Bot added the review:approved minimal-review approved the current head label Nov 11, 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: CONDITIONS · 2 conditions · the full ruling

The gate is in the right place and reads the mode before the loadouts layer. That conforms to Expansion line 1285. One case fails open. When no layer sets loadout_mode, the gate applies the loadouts. The agent, service, build and container-build roots supply no mode, so their entries take loadouts. Line 1219 seals every shipped type but session. Make None seal (C1), and link the interim in builtin_defaults to gominimal/inbox#678 (C2). The upstream-only conflict between BOX-174 and the design goes to an arch issue. It does not block this change.

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

Comment thread crates/mfile/src/expand.rs Outdated
let sealed = toml::Table::new();
let loadouts = match loadout_mode(entry, &ordered)? {
Some(LoadoutMode::Sealed) => &sealed,
Some(LoadoutMode::Open) | None => &layers.loadouts,
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 · This arm applies the loadouts when no layer sets loadout_mode. The agent, service, build and container-build roots set no mode, so their entries take loadouts. Line 1219 seals them. Write Some(LoadoutMode::Open) => &layers.loadouts and Some(LoadoutMode::Sealed) | None => &sealed.

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 308198c9ecff: The gate is now Some(Open) => loadouts, Some(Sealed) | None => sealed. The gate test asserts an [agents.helper] entry takes no loadout.

Comment thread crates/mfile/src/box_types.rs Outdated

/// The defaults that the built-in type `root` supplies as the first layer
/// of a type chain. `session` is `open` to loadouts (BOX-168) and `task`
/// is `sealed` (BOX-169). The other built-in types supply nothing yet.
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 sentence states an interim with no owner. Name gominimal/inbox#678 as the owner of the agent, service, build and container-build defaults. Say that the expansion gate seals those roots until then.

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 308198c9ecff: The builtin_defaults doc now names gominimal/inbox#678 as owner of the agent, service, build and container-build defaults, sealed by the gate until then.

@agent-137
Copy link
Copy Markdown
Member

/revise

Arch conditions (arch_rulings 1142, ruled at f14d332), in full:

  • C1: crates/mfile/src/expand.rs expand(): change the gate to Some(LoadoutMode::Open) => &layers.loadouts, Some(LoadoutMode::Sealed) | None => &sealed, so a chain whose root supplies no loadout_mode (agent, service, build, container-build) takes no loadout. Update the doc comment of fn loadout_mode to say the gate treats None as sealed. Give the tests that pass a loadouts layer the session root's mode: example_layers() and the layer-order test near line 960 set type_defaults to start with ("session", box_types::builtin_defaults("session")). In loadout_gate_follows_setting_not_type_name, add an [agents.helper] entry and assert assert_no_loadout for it.
  • C2: crates/mfile/src/box_types.rs builtin_defaults doc comment: replace "The other built-in types supply nothing yet." with a sentence that names gominimal/inbox#678 as the owner of the agent, service, build and container-build defaults, and says that until then the expansion gate seals those roots.

The "Needs a design decision" item (the dropped upstream-only mode) is with the owner. Keep refusing upstream-only with exit 3, as BOX-174 states.

A chain whose root supplies no loadout_mode (agent, service, build,
container-build) now takes no loadout. The tests that pass a loadouts
layer start their chain with the session root's defaults, and the gate
test asserts that an [agents.helper] entry takes no loadout.

The builtin_defaults doc names gominimal/inbox#678 as the owner of the
other roots' defaults, and the acyclic_graph doc is back on its function.
@minimal-foundry
Copy link
Copy Markdown
Contributor Author

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

line exit tail
cargo nextest run -p mfile sealed_spec_applies_no_loadout 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p mfile open_spec_applies_whole_loadout 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p mfile builtin_roots_default_loadout_mode 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p mfile loadout_gate_follows_setting_not_type_name 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p mfile unknown_loadout_mode_refused_exit3 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt

Verify min task run agent-verify passed.

Review threads the coder judged:

  • 👍 valid — crates/mfile/src/box_types.rs:444: Moved the acyclic_graph doc comment back onto acyclic_graph, after builtin_roots_default_loadout_mode.
  • 👍 valid — crates/mfile/src/expand.rs: The gate is now Some(Open) => loadouts, Some(Sealed) | None => sealed. The gate test asserts an [agents.helper] entry takes no loadout.
  • 👍 valid — crates/mfile/src/box_types.rs: The builtin_defaults doc now names gominimal/inbox#678 as owner of the agent, service, build and container-build defaults, sealed by the gate until then.

A session entry takes its loadouts and a task entry takes none, from loadout_mode alone. An entry whose layers set no loadout_mode, such as one rooted at agent, now also takes none. An unknown mode fails with exit 3 before a loadout applies, and upstream-only is still refused.

Notes from the agent: C1: the gate is now Some(Open) => loadouts, Some(Sealed) | None => sealed, and the loadout_mode doc says the gate treats None as sealed. example_layers(), the layer-order test and expansion_reports_layer_and_type_per_value_outside_spec_bytes (which overrides type_defaults on example_layers) now start type_defaults with the session root's builtin defaults. expansion_is_byte_identical_across_runs now expects loadout_mode = "open" in its spec bytes. This release refuses [agents.*] in expandable_type, so expand_typed_with cannot expand [agents.helper]. The test expands it through expand_in with the agent root's builtin defaults and asserts assert_no_loadout and no loadout_mode in the spec. C2: the builtin_defaults doc names gominimal/inbox#678 and says the expansion gate seals those roots until then. Full mfile suite: 150 passed. cargo clippy -p mfile --all-targets is clean. just clippy-strict was not run.

@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 on lines +278 to +282
let sealed = toml::Table::new();
let loadouts = match loadout_mode(entry, &ordered)? {
Some(LoadoutMode::Open) => &layers.loadouts,
Some(LoadoutMode::Sealed) | None => &sealed,
};
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.

LOW · correctness · confidence 0.55 · in expand

When no layer sets loadout_mode, the gate seals and drops every selected loadout without a report. The PR notes say the loadouts layer then applies as before. A caller that passes loadouts but no root type defaults loses them silently. Either match the notes or refuse that case.

What the reviewer checked

expand.rs:281 Some(LoadoutMode::Sealed) | None => &sealed,

Hand this to an agent
Act on a code-review finding.

File:       crates/mfile/src/expand.rs
Lines:      278-282
Category:   correctness
Severity:   low (reviewer confidence 0.55)

Finding:
When no layer sets `loadout_mode`, the gate seals and drops every selected loadout without a report. The PR notes say the loadouts layer then applies as before. A caller that passes loadouts but no root type defaults loses them silently. Either match the notes or refuse that case.

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.

Disputed — not addressed: The sealed default when no layer sets loadout_mode is deliberate. Finding C1 in round 1 asked for it, because agent, service, build and container-build set no mode until gominimal/inbox#678 gives them defaults. loadout_gate_follows_setting_not_type_name pins it. BOX-171 requires that a skipped loadout prints nothing. A loadout named by a flag on a sealed box is refused under BOX-173 in a later task. The earlier PR notes were stale. This round's notes say that the loadouts layer is empty in this case.

10000
@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 gate now fails closed. An entry whose layers set no loadout_mode takes no loadout, and that matches the shipped-types table at line 1219. The gate reads only the setting, before the loadouts layer, as principle 8 and layer 6 at line 1285 say. The explicit sealed default for agent, service, build and container-build stays with gominimal/inbox#678 as a residual. Line 850 of the design still lists upstream-only, and BOX-174 refuses it. I escalated that to arch. It is not a change for this PR.

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


impl LoadoutMode {
/// The values `loadout_mode` accepts, as the file writes them.
pub const ACCEPTED: &'static [&'static str] = &["sealed", "open"];
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

BOX-174 · This list agrees with BOX-174 and the owner ruling of 2026-11-05. Line 850 of architecture.md still lists upstream-only. That conflict is escalated to arch. Do not change this line in this PR.

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.

Disputed — not addressed: No change is needed here: LoadoutMode::ACCEPTED is ["sealed", "open"], which agrees with BOX-174, as the comment says. The line stays unchanged. The architecture.md line 850 conflict is outside this task's layers and is with arch.

@minimal-foundry minimal-foundry Bot removed the review:approved minimal-review approved the current head label Nov 11, 2026
@minimal-foundry
Copy link
Copy Markdown
Contributor Author

Round 2 of 10 on the runtime's review findings: the coder changed nothing. Revise round 2: no code change. The one open finding asks the gate to apply loadouts when no layer sets loadout_mode. Round 1 made that case sealed on purpose, after finding C1: the agent, service, build and container-build roots set no mode yet, and gominimal/inbox#678 owns their defaults. Until then the gate seals those roots, and a test pins it (loadout_gate_follows_setting_not_type_name, with an [agents.helper] entry). The silent skip follows BOX-171: a skipped loadout prints nothing. A loadout that a flag names on a sealed box is the refusal of BOX-173, which a later task owns. Correction to the earlier PR notes: when no layer sets loadout_mode, the loadouts layer is empty. It does not apply as before.

Review threads the coder judged:

  • 👎 invalid — crates/mfile/src/expand.rs:282: The sealed default when no layer sets loadout_mode is deliberate. Finding C1 in round 1 asked for it, because agent, service, build and container-build set no mode until gominimal/inbox#678 gives them defaults. loadout_gate_follows_setting_not_type_name pins it. BOX-171 requires that a skipped loado

@minimal-foundry
Copy link
Copy Markdown
Contributor Author

Round 3 of 10 on a failed check suite: the coder changed nothing. Round 3 adds no commit. The failed checks do not come from this diff. ci-linux-native-success is the lane aggregator. Its own log shows only 'exit 1'. The real failure is native-daemon-e2e: 'min session activate --network own_ip' of e2e-nnat-a got 'ssh connect: Connection reset by peer' from minimald. The SSH connection to the daemon failed before the client sent a request. This diff changes only crates/mfile. minimald does not call mfile::expand. The client calls it in crates/minimal/src/cmd/boxes/create.rs (entry_egress and the spec read). Those calls use Layers with no loadouts, so the gate changes nothing on them. loadout_mode is a known key in spec.rs (line 550), so the root default does not make a spec invalid. I did not run the native daemon e2e on this box. It needs the CI native-daemon lane. I recommend a re-run of that job. If it fails again at the same step, the diagnostic bundle from that run will show why minimald reset the connection.

Review threads the coder judged:

  • 👎 invalid — crates/mfile/src/expand.rs:303: No change is needed here: LoadoutMode::ACCEPTED is ["sealed", "open"], which agrees with BOX-174, as the comment says. The line stays unchanged. The architecture.md line 850 conflict is outside this task's layers and is with arch.

@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 12, 2026
Merged via the queue into main with commit aa03f56 Nov 12, 2026
40 of 42 checks passed
@mitodrummer
mitodrummer deleted the agent/3247-gate-loadouts-on-loadout-mode-session-open-task branch November 12, 2026 01:32
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.

T124 — Gate loadouts on loadout_mode: session open, task sealed, an unknown mode refused

2 participants

0