Skip to content

fix(mfile,minimal): every create path stores the expanded spec's file_exports, so min task run, min - #3558

Merged
mitodrummer merged 5 commits into
mainfrom
agent/3550-every-create-path-stores-the-expanded-spec-s-fil
Nov 19, 2026
Merged

mitodrummer merged 5 commits into
mainfrom
agent/3550-every-create-path-stores-the-expanded-spec-s-fil

Conversation

@minimal-foundry

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

Copy link
Copy Markdown
Contributor

Follow-up

Fixes #3550

Task marker
### D3527 — Every create path stores the expanded spec's file_exports, so min task run, min box run and min box start copy the exports when the box ends
  kind: task
  size: M
  est: 120 code, 220 tests
  executor: agent
  origin: bug
  epic: 2236
  layers:
    - spec:
      - crates/mfile/src/spec.rs: BoxSpec::build copies the [[file_exports]] items of the expanded entry table into BoxSpec::file_exports, not None
      - crates/mfile/src/expand.rs: expose a helper that reads the expanded spec's file_exports items as StoredExport values, if build needs it
      - crates/mfile/src/lib.rs: the legacy task loader stops the unknown fields warning for file_exports on a task entry
      test: cargo nextest run -p mfile for_session_entry_stores_file_exports
      test: cargo nextest run -p mfile for_task_stores_file_exports
    - cli:
      - crates/minimal/src/task.rs: task_box_spec builds the stored spec from the expansion of the task entry, so file_exports reaches the record for min task run and min box run
      - crates/minimal/src/cmd/boxes/create.rs: stamp_session_spec_as and the task entry expansion keep file_exports in the spec that put_spec stores for min box start
      - crates/minimal/src/tests.rs: end-to-end tests create a box from a minimal.toml with one [[file_exports]] item through each command and assert the copy and one file_exported event
      test: cargo nextest run -p minimal task_run_copies_declared_file_exports
      test: cargo nextest run -p minimal box_run_copies_declared_file_exports
      test: cargo nextest run -p minimal box_start_detach_then_wait_copies_declared_file_exports
  proof: After min task run build with one [[file_exports]] item, the file is in the project, the record holds one file_exported event, and no unknown fields warning prints.

Proof

Take a project whose minimal.toml gives task build one [[file_exports]] item. min task run build now stores that item in the box's spec. When the box ends, the file is copied into the project and the record holds one file_exported event. The load no longer prints an unknown fields warning for file_exports on the task. min box run and min box start of a session entry with a declared export store and copy it in the same way.

Notes from the agent: BoxSpec::build reads file_exports from the entry table: the expanded table for a session entry, and the task's extra keys for a task. The new helper mfile::expand::stored_file_exports does the read. task_box_entry now returns the whole BoxEntryExpansion, not only the wire entry. run_entry puts the expansion's file_exports on the task spec with the new task::take_expanded_exports and stores the spec again with put_spec, so [defaults] exports reach a task box too. The layer note said task_box_spec builds from the expansion. The expansion runs later in run_entry than task_box_spec, so a separate helper applies it after the expansion, and task_box_spec is unchanged. stamp_session_spec_as needed no change, because for_session_entry now carries the exports. The lib.rs change adds file_exports to SPEC_READ_ENTRY_KEYS. That list applies to [session] too, which is correct because for_session also reads the key now. I added the test file_exports_entry_key_is_not_reported_unknown in lib.rs. Two existing tests in tests.rs now read .wire from task_box_entry. The minimal end-to-end tests build the spec through the same functions that run_entry and the start path call, then create the box on the harness daemon, stop it and run box wait. They do not run a task entrypoint, because the harness daemon cannot run one. I did not run just ci or clippy-strict. The full mfile suite passed (226), and the minimal tests matching export or entry passed (60).

Tests

line exit tail
cargo nextest run -p mfile for_session_entry_stores_file_exports 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 for_task_stores_file_exports 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 minimal task_run_copies_declared_file_exports 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 minimal box_run_copies_declared_file_exports 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 minimal box_start_detach_then_wait_copies_declared_file_exports 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 exited 100, so this PR is a draft.

 {
                "parent_span_id": "801801a22791b289",
                "rpc": "minimald-v1-GetSessionRecord",
                "span_id": "b477cae64551aea4",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "GetRecord",
                "parent_span_id": "b477cae64551aea4",
                "queued_behind": "0",
                "span_id": "211b40c493540365",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "rpc",
            fields: {
                "parent_span_id": "801801a22791b289",
                "rpc": "minimald-v1-DestroySession",
                "span_id": "a682327e0224161f",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "GetRecord",
                "parent_span_id": "a682327e0224161f",
                "queued_behind": "0",
                "span_id": "60b1d310085be8cf",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "DeleteSession",
                "parent_span_id": "a682327e0224161f",
                "queued_behind": "0",
                "span_id": "42a3c6d8676965bb",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "session.message",
            fields: {
                "kind": "Destroy",
                "parent_span_id": "42a3c6d8676965bb",
                "span_id": "24a31d9a4f94c025",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "HandOverName",
                "parent_span_id": "42a3c6d8676965bb",
                "queued_behind": "0",
                "span_id": "3164793e1228a297",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
    ]
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

  Cancelling due to test failure: 
────────────
     Summary [  84.284s] 1423 tests run: 1422 passed, 1 failed, 2 skipped
        FAIL [  12.962s] (1423/1423) minimal::otel_cli exec_run_attach_and_task_run_share_the_commands_trace
error: test run failed

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

BoxSpec::build copies the [[file_exports]] items of the entry table into
the spec, and a task's file_exports is no longer an unknown field.
The task run puts the expanded task entry's [[file_exports]] items on the
stored spec, so min task run, min box run and min box start copy them
when the box ends.
The declared-export tests build two requests that never reach the daemon.
Only their stored specs do, so each site asserts nothing.
@coderabbitai

coderabbitai Bot commented Nov 18, 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: a1b4e49c-8ca3-4929-a822-0808d5907f5c

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 18, 2026 •

Copy link
Copy Markdown
Contributor Author

Reviewed: no findings; approval withheld, 1 thread unresolved at 2d13ec6af393.

APPROVE withheld: 1 unresolved thread — minimal-foundry[bot] crates/minimal/src/task.rs. Resolving the last thread releases the approval on this head.

Resolve the open threads. Resolving the last one releases the approval on this head; no new review is required.

Verdict APPROVE, posted as a comment: the App cannot review its own pull request; the check and the label carry it.

Clobber: none seen.

@minimal-arch minimal-arch Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

arch-review: PASS · the full ruling

The change stores the declared [[file_exports]] in the spec on every create path. So the command that waits for the box can copy them, as architecture.md File exports line 508 requires for every Box Type. Bad paths are still refused at expansion with exit 3 before the create (line 516), and the copy checks them again. The new comments cite BOX-203. Spec 29 gives that id to the multi-box wait order, and BOX-185 is the requirement that governs. That is a note for review, not a design condition.

Ruled at 08fb3c5 against gominimal/arch@327e1b57d16b 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/task.rs Outdated
Comment on lines +1636 to +1640
// command that waits for the box copies them when it ends.
if let (Some(spec), Some(expanded)) = (spec.as_mut(), expanded.as_ref()) {
take_expanded_exports(spec, &expanded.spec);
crate::put_spec(&mut request, spec)?;
}

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.

MEDIUM · correctness · confidence 0.80 · in run_entry

This second put_spec rebuilds request.spec from the local spec. That drops the --vpn-network-names values that add_vpn_network_names wrote into the stored JSON at about line 1598. After this change, min task run --vpn-network-names X on a task with [[file_exports]] stores a spec without the names. Fix: put the exports on spec before the first put_spec, or set spec.network.vpn_network_names on the typed spec. Alternatively, only edit the file_exports key of the stored JSON.

What the reviewer checked

task.rs:1598 add_vpn_network_names(&mut request, ...); task.rs:1639 crate::put_spec(&mut request, spec)?; put_spec sets request.spec = to_value(spec)

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

File:       crates/minimal/src/task.rs
Lines:      1636-1640
Category:   correctness
Severity:   medium (reviewer confidence 0.80)

Finding:
This second `put_spec` rebuilds `request.spec` from the local `spec`. That drops the `--vpn-network-names` values that `add_vpn_network_names` wrote into the stored JSON at about line 1598. After this change, `min task run --vpn-network-names X` on a task with `[[file_exports]]` stores a spec without the names. Fix: put the exports on `spec` before the first `put_spec`, or set `spec.network.vpn_network_names` on the typed spec. Alternatively, only edit the `file_exports` key of the stored JSON.

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.

Addressed in 2d13ec6af393: run_entry now puts the exports on the spec before its only put_spec, through put_task_spec, which calls add_vpn_network_names last. task_run_stores_vpn_network_names_with_declared_file_exports pins the names and the export together.

@agent-137

Copy link
Copy Markdown
Member

/revise

Owner ruling (Karl, 2026-11-19): round 1 has shown "running" since 22:01Z with no update, so this is a fresh round. Do these:

  1. Merge main into the branch. It conflicts with main after fix(mfile,minimald): a box whose stored spec carries an expansion key that the typed BoxSpec lacks #3557 (D3523) merged, which also changes crates/mfile/src/spec.rs. Keep fix(mfile,minimald): a box whose stored spec carries an expansion key that the typed BoxSpec lacks #3557's stored-spec reader (the kept keys and the flat egress refusal) along with this PR's file_exports.
  2. Keep --vpn-network-names in the stored spec (thread at crates/minimal/src/task.rs:1640). The second put_spec in run_entry rebuilds request.spec from the local spec, so it drops the names that add_vpn_network_names wrote into the stored JSON. Put the exports on the spec before the first put_spec call, then call add_vpn_network_names once, last. Pin it with a test: min task run --vpn-network-names X on a task with one [[file_exports]] item stores a spec that has both the names and the export. Answer the thread.
  3. Keep the PR body's line Closes #3527 (the original issue this task was triaged from).

…te-path-stores-the-expanded-spec-s-fil

# Conflicts:
#	crates/mfile/src/spec.rs
The stored spec takes the expansion's exports before put_spec, and
add_vpn_network_names runs once, last, through put_task_spec. A second
put_spec no longer drops the names.
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

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

Resolved conflicts in: crates/mfile/src/spec.rs

line exit tail
cargo nextest run -p mfile for_session_entry_stores_file_exports 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 for_task_stores_file_exports 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 minimal task_run_copies_declared_file_exports 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 minimal box_run_copies_declared_file_exports 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 minimal box_start_detach_then_wait_copies_declared_file_exports 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 exited 100.

 {
                "parent_span_id": "de974d90b38482da",
                "rpc": "minimald-v1-GetSessionRecord",
                "span_id": "036cb29f9936a8c2",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "GetRecord",
                "parent_span_id": "036cb29f9936a8c2",
                "queued_behind": "0",
                "span_id": "fec68c51dd78f535",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "rpc",
            fields: {
                "parent_span_id": "de974d90b38482da",
                "rpc": "minimald-v1-DestroySession",
                "span_id": "7d95638c818b3fdd",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "GetRecord",
                "parent_span_id": "7d95638c818b3fdd",
                "queued_behind": "0",
                "span_id": "c51673a9121a6aff",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "DeleteSession",
                "parent_span_id": "7d95638c818b3fdd",
                "queued_behind": "0",
                "span_id": "9de3df72a352e353",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "session.message",
            fields: {
                "kind": "Destroy",
                "parent_span_id": "9de3df72a352e353",
                "span_id": "fb4421a82145ce66",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "HandOverName",
                "parent_span_id": "9de3df72a352e353",
                "queued_behind": "0",
                "span_id": "36ba15004d922c7e",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
    ]
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

  Cancelling due to test failure: 
────────────
     Summary [  86.807s] 1427 tests run: 1426 passed, 1 failed, 2 skipped
        FAIL [  12.948s] (1427/1427) minimal::otel_cli exec_run_attach_and_task_run_share_the_commands_trace
error: test run failed

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

Review threads the coder judged:

  • 👍 valid — crates/minimal/src/task.rs:1640: run_entry now puts the exports on the spec before its only put_spec, through put_task_spec, which calls add_vpn_network_names last. task_run_stores_vpn_network_names_with_declared_file_exports pins the names and the export together.

After min task run build with one [[file_exports]] item, the file is in the project and the record holds one file_exported event. min task run --vpn-network-names corp build now stores a spec that has both the names and the export.

Notes from the agent: Merged origin/main. The one conflict was in crates/mfile/src/spec.rs, in BoxSpec::build. The resolution keeps this PR's file_exports and the kept_keys field from #3557. The rest of #3557 merged without conflict. In run_entry, the project root resolution and the task entry expansion now run before the spec is stored. The new helper put_task_spec puts the exports on the spec, calls put_spec once, and then calls add_vpn_network_names last. So the refusal of --vpn-network-names for an interactive task now comes after the upload-root check and the expansion, not before them. A new test, task_run_stores_vpn_network_names_with_declared_file_exports, pins the names and the export together through put_task_spec. The vpn_network_names tests and every_create_session_asserts_the_daemon_build also pass. The runner keeps the PR body line 'Closes #3527 (the original issue this task was triaged from).' No commit message carries a closing keyword. I did not run just clippy-strict.

@minimal-foundry
minimal-foundry Bot marked this pull request as draft November 19, 2026 01:51

@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 commit stores the task spec once, through task::put_task_spec. The expansion's [[file_exports]] go on the spec before put_spec, and --vpn-network-names goes on after. The names now stay on the stored spec, as the Box Isolation Model requires (architecture.md lines 1333-1339). The merge from main keeps file_exports and kept_keys in BoxSpec::build. The rest of the change keeps the PASS at 08fb3c57. Verify still reports one failing otel test, exec_run_attach_and_task_run_share_the_commands_trace. Make it pass before the PR leaves draft.

Ruled at 2d13ec6 against gominimal/arch@327e1b57d16b 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 — approval withheld

Verdict COMMENT — APPROVE withheld: 1 unresolved thread — minimal-foundry[bot] crates/minimal/src/task.rs. No findings.

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

@agent-137
agent-137 marked this pull request as ready for review November 19, 2026 03:22

@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 19, 2026
Merged via the queue into main with commit 60503dd Nov 19, 2026
39 checks passed
@mitodrummer
mitodrummer deleted the agent/3550-every-create-path-stores-the-expanded-spec-s-fil branch November 19, 2026 04:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants