Repository navigation
T124 — Gate loadouts on loadout_mode: session open, task sealed, an unknown mode refused - #3291
Conversation
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.
|
Important Review skippedBot user detected. To trigger a single review, invoke the
|
|
Reviewed: 1 finding, none blocking at Address the comments on the diff. Clobber: none seen. |
There was a problem hiding this comment.
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.
| let sealed = toml::Table::new(); | ||
| let loadouts = match loadout_mode(entry, &ordered)? { | ||
| Some(LoadoutMode::Sealed) => &sealed, | ||
| Some(LoadoutMode::Open) | None => &layers.loadouts, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
|
|
||
| /// 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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
|
/revise Arch conditions (arch_rulings 1142, ruled at f14d332), in full:
The "Needs a design decision" item (the dropped |
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.
…uts-on-loadout-mode-session-open-task
|
Round 1 of 10 on a /revise note, pushed as
Verify Review threads the coder judged:
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. |
| let sealed = toml::Table::new(); | ||
| let loadouts = match loadout_mode(entry, &ordered)? { | ||
| Some(LoadoutMode::Open) => &layers.loadouts, | ||
| Some(LoadoutMode::Sealed) | None => &sealed, | ||
| }; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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"]; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
|
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:
|
|
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:
|
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_modeto "x".loadout_modeaccepts onlysealedoropen. 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
cargo nextest run -p mfile sealed_spec_applies 8000 _no_loadoutcargo nextest run -p mfile open_spec_applies_whole_loadoutcargo nextest run -p mfile builtin_roots_default_loadout_modecargo nextest run -p mfile loadout_gate_follows_setting_not_type_namecargo nextest run -p mfile unknown_loadout_mode_refused_exit3Verify
min task run agent-verifypassed ([tasks.verify]).Closes #3247