8000 feat(minimal): T133 — Copy exports only in the box's own project, in the order of the ends, and at a resumed box's next end by minimal-foundry[bot] · Pull Request #3502 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

feat(minimal): T133 — Copy exports only in the box's own project, in the order of the ends, and at a resumed box's next end - #3502

Merged
mitodrummer merged 8 commits into
mainfrom
agent/3447-copy-exports-only-in-the-box-s-own-project-in-th
Nov 18, 2026
Merged

mitodrummer merged 8 commits into
mainfrom
agent/3447-copy-exports-only-in-the-box-s-own-project-in-th

Conversation

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

T133 — Copy exports only in the box's own project, in the order of the ends, and at a resumed box's next end

slice: S2
kind: task
covers: BOX-203, BOX-204
size: M
est: 120 code, 200 tests
executor: agent
difficulty: needs care
model: strongest
diagnostics: each skipped or refused export is named on stderr with its path
observability: the box's record carries a file_exported event for each export
layers:
- spec:
- crates/mfile/src/spec.rs: the typed stored spec carries file_exports, so a box with exports resumes
test: cargo nextest run -p mfile stored_spec_with_file_exports_round_trips
- client:
- crates/minimal/src/cmd/boxes/wait.rs: copy several boxes' exports in the order of their ends (BOX-203)
- crates/minimal/src/cmd/boxes/attach.rs: a resumed box copies at its next end only (BOX-204)
- crates/minimal/src/tests.rs: tests
test: cargo nextest run -p minimal multi_box_wait_copies_in_order_of_ends
test: cargo nextest run -p minimal resumed_box_copies_at_next_end_only
produces: none
consumes:
- crates/minimal/src/cmd/boxes/exports.rs
proof: a wait from another project copies nothing and says so; a wait on two boxes that export one path leaves the later end's file; a resumed PTY box copies once, at its next end.
depends on:
- blocked by #3446

Proof

A wait from another project copies nothing and says so on stderr. A wait on two boxes that export one path leaves the file of the later end. A resumed PTY box copies nothing at the end it resumed from. When it ends again, the attach copies the new contents of the export once, and the record holds one file_exported event for that end.

Notes from the agent: Round 3 adds the C1 next-end pass to resumed_box_copies_at_next_end_only, after the failed-resume pass and its wait pass. Those two passes are unchanged. The daemon refuses an SFTP write to a stopped box (Per 8000 missionDenied), so the attach closure writes the new notes.md contents directly into the file that the daemon keeps for the box under its state dir. The test helper rewrite_kept_box_file finds that file by name and old contents. The closure then appends a second exited event with boxes::store::append_event_at (new helper write_box_exited_event). The wait pass before it already wrote one file_exported event for end 1. So the test asserts exactly one file_exported event with end 2, with copied true, and two events in total. The Proof and notes no longer say that the daemon refuses to resume a box with file_exports, because 219ad0c fixed that. clippy -p minimal --all-targets is clean. just clippy-strict did not run.

Residuals

Tests

line exit tail
cargo nextest run -p minimal multi_box_wait_copies_in_order_of_ends 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network help: do you need to update to a newer version of minimal? Running task runtime-implement-test-0 in box runtime-implement-test-0-1... Compiling paths v0.0.1 (/workbe
cargo nextest run -p minimal resumed_box_copies_at_next_end_only 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network help: do you need to update to a newer version of minimal? Running task runtime-implement-test-1 in box runtime-implement-test-1-1... Compiling version v0.8.0 (/work

Verify

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

 {
                "parent_span_id": "94f007e5131e68da",
                "rpc": "minimald-v1-GetSessionRecord",
                "span_id": "c5bcd0c9d6bdea9e",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "GetRecord",
                "parent_span_id": "c5bcd0c9d6bdea9e",
                "queued_behind": "0",
                "span_id": "c199521c6d13ac6c",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "rpc",
            fields: {
                "parent_span_id": "94f007e5131e68da",
                "rpc": "minimald-v1-DestroySession",
                "span_id": "682419074d271717",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "GetRecord",
                "parent_span_id": "682419074d271717",
                "queued_behind": "0",
                "span_id": "c0a67c4b3204288d",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "DeleteSession",
                "parent_span_id": "682419074d271717",
                "queued_behind": "0",
                "span_id": "bf03887c4ce34ae2",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "session.message",
            fields: {
                "kind": "Destroy",
                "parent_span_id": "bf03887c4ce34ae2",
                "span_id": "006dedeb7bddaff5",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "HandOverName",
                "parent_span_id": "bf03887c4ce34ae2",
                "queued_behind": "0",
                "span_id": "7698d5fe51b0a236",
                "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 [  89.440s] 1183 tests run: 1182 passed, 1 failed, 2 skipped
        FAIL [  13.058s] (1183/1183) minimal::otel_cli exec_run_attach_and_task_run_share_the_commands_trace
error: test run failed

Closes #3447

A wait on several boxes reads each box's last exited event and copies
the exports box by box in that order, so the later end's file stays
(BOX-203). An attach that resumes an ended box copies only a later end
(BOX-204).
A resume whose launch did not happen leaves the box at its first end.
The attach copies nothing and claims nothing, so a later wait still
copies that end once (BOX-204).
@coderabbitai
coderabbitai Bot commented Nov 17, 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: aa43720d-f1d9-44b9-aba9-6e75463dc7cc

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

@agent-137
Copy link
Copy Markdown
Member

/revise

Owner ruling (Karl, 2026-11-17): fold the resume fix into this PR. The plan (#3447) now has a spec layer for crates/mfile/src/spec.rs.

  1. A box whose stored spec declares exports must resume. Today SpecDoc in crates/mfile/src/spec.rs has #[serde(deny_unknown_fields)] and no file_exports field. The daemon parses the stored spec as mfile::spec::BoxSpec on resume (crates/minimald/src/box_runtime/launcher.rs), so the resume fails with "unknown field file_exports". Give the typed stored spec a file_exports field that keeps the stored items as they are, so a write and a read of the stored spec keep them unchanged. Keep deny_unknown_fields for every other key. Pin it with stored_spec_with_file_exports_round_trips in crates/mfile/src/spec.rs.
  2. Prove BOX-204's next-end half end to end. Extend resumed_box_copies_at_next_end_only: resume the box through daemon.open_shell, change the exported file, stop the box, and check that the project holds one copy of the new contents. Also check that the end the box resumed from is not copied.
  3. Update the PR body. Change the Proof and the notes so they no longer say that a box with exports cannot resume.

Not in this round: min box wait with several targets (BoxWaitArgs in crates/minimal/src/cli.rs, and the exit code of a wait on several boxes). That goes to a residual issue.

8000
A box whose stored spec declares exports failed to resume: the daemon
parses the stored spec as BoxSpec, and SpecDoc refused the unknown
file_exports key. The items are now kept as written. Every other
unknown key is still refused.
The attach now resumes the box through the daemon's shell. The resume
reads the stored spec that declares the export and fails only at the
launch, since this harness has no package store. The attach copies
nothing of the end the box resumed from (BOX-204).
@minimal-foundry
Copy link
Copy Markdown
Contributor Author

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

line exit tail
cargo nextest run -p mfile stored_spec_with_file_exports_round_trips 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 help: do you need to update to a newer version of minimal? Running task runtime-implement-test-0 in bo
cargo nextest run -p minimal multi_box_wait_copies_in_order_of_ends 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 help: do you need to update to a newer version of minimal? Running task runtime-implement-test-1 in bo
cargo nextest run -p minimal resumed_box_copies_at_next_end_only 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 help: do you need to update to a newer version of minimal? Running task runtime-implement-test-2 in bo

Verify min task run agent-verify exited 100.

 {
                "parent_span_id": "e23a3ef7b8fe7da1",
                "rpc": "minimald-v1-GetSessionRecord",
                "span_id": "e5be817db8d3b6d3",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "GetRecord",
                "parent_span_id": "e5be817db8d3b6d3",
                "queued_behind": "0",
                "span_id": "79f42b8063bc660e",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "rpc",
            fields: {
                "parent_span_id": "e23a3ef7b8fe7da1",
                "rpc": "minimald-v1-DestroySession",
                "span_id": "2a6141a22d7d6b05",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "GetRecord",
                "parent_span_id": "2a6141a22d7d6b05",
                "queued_behind": "0",
                "span_id": "36a13cfd02decd6b",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "DeleteSession",
                "parent_span_id": "2a6141a22d7d6b05",
                "queued_behind": "0",
                "span_id": "7dccc5fe868c10f3",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "session.message",
            fields: {
                "kind": "Destroy",
                "parent_span_id": "7dccc5fe868c10f3",
                "span_id": "0b353b4fe57fa696",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "HandOverName",
                "parent_span_id": "7dccc5fe868c10f3",
                "queued_behind": "0",
                "span_id": "6d8fab508624e3cb",
                "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 [  90.358s] 1366 tests run: 1365 passed, 1 failed, 2 skipped
        FAIL [  13.260s] (1366/1366) 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.

A wait on two boxes that export one path leaves the file of the later end. A wait from another project copies nothing and says so. A box whose stored spec declares exports can now resume: the daemon reads its stored spec, and the typed spec keeps the file_exports items unchanged. An attach that resumes a PTY box copies nothing of the end the box resumed from, and a later wait copies that end once. The copy at the next end after a real launch is not proved in this PR (see notes).

Notes from the agent: Revise round 1. Item 1 is done: BoxSpec and SpecDoc in crates/mfile/src/spec.rs carry file_exports as Option<Vec>. StoredExport wraps the item as a toml::Value with serde(transparent), and has a manual Eq because toml::Value is only PartialEq. deny_unknown_fields stays, and the new test checks that another unknown key (file_imports) is still refused. Item 2 is done in part. resumed_box_copies_at_next_end_only now resumes the box through daemon.open_shell with a whole stored spec that declares the export. The resume reads the spec and fails only at the launch with 'no such package: base', because the minimald harness that the minimal crate uses has no package store. The MockLauncher that echoes a shell is #[cfg(test)] in minimald and is not in the test-support feature. After the failed res 8000 ume the box stays stopped and SFTP to it is refused, so this test cannot change the file or make a next end. The full next-end check (change the file, stop, one copy of the new contents) needs either a minimald test (crates/minimald/src/box_manager/tests.rs) or MockLauncher exposed under test-support. Both are outside this task's layers. Item 3 (the PR body) is the runner's: the proof above no longer says that a box with exports cannot resume. Related, not in this round: a stored spec that carries io.exec_enabled or network.vpn_network_names will also fail the typed parse on resume, for the same deny_unknown_fields reason. The wait on several targets in the CL…[truncated]

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

Reviewed: 1 finding, none blocking at f3aeac450daa.

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 — advisory review

Verdict COMMENT — 2 findings, 2 inline.

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

Comment thread crates/minimal/src/cmd/boxes/attach.rs Resolved
Comment thread crates/mfile/src/spec.rs Resolved
@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 · 1 condition · the full ruling

The code conforms to File exports lines 506, 512 and 513. The wait copies in the order of the ends, and the attach copies only an end that comes after the resume. The mfile edit lets a resume read a stored spec with file_exports. The BOX-204 proof is not complete. resumed_box_copies_at_next_end_only drives only a resume whose launch fails. No test shows that the attach copies at the box's next end. Make the change in C1.

Ruled at cd790a1 against gominimal/arch@327e1b57d16b by claude-opus-5-5.

// nothing and claims nothing, so a later wait still copies that end once.
// minimald's own tests drive a resume that launches (BOX-025).
#[tokio::test]
async fn resumed_box_copies_at_next_end_only() {
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 test covers only a resume whose launch fails. It does not prove the copy at the next end that section File exports line 513 requires. In the attach closure, write new contents to /workbench/notes.md and append a second exited event. Then assert that notes.md holds the new contents and that the record holds one file_exported event.

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 f3aeac450daa: Added a next-end pass: the attach closure writes new notes.md contents and a second exited event, and the test asserts the copy and one file_exported event for end 2.

Comment thread crates/minimal/src/cmd/boxes/attach.rs Outdated
/// (`before` is `None`) counts as ended again. A count that the host does
/// not give counts as no new end, so the attach copies nothing, and a later
/// `min box wait` can copy that end (BOX-204).
async fn ended_again(target: &BoxAttachTarget, before: Option<u64>) -> bool {
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-204 · No test reaches the branch where after > before after a resume. C1 adds that test in resumed_box_copies_at_next_end_only.

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 f3aeac450daa: The new pass in resumed_box_copies_at_next_end_only reaches the after > before branch after a resume, and the attach copies the new contents.

A count of ends that the host did not give before the attach no longer
counts as a running box, so the end a box resumed from stays unclaimed.
@minimal-foundry
Copy link
Copy Markdown
Contributor Author

Round 2 of 10 on the runtime's review findings, pushed as d263519c9f53.

line exit tail
cargo nextest run -p mfile stored_spec_with_file_exports_round_trips 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 help: do you need to update to a newer version of minimal? Running task runtime-implement-test-0 in bo
cargo nextest run -p minimal multi_box_wait_copies_in_order_of_ends 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 help: do you need to update to a newer version of minimal? Running task runtime-implement-test-1 in bo
cargo nextest run -p minimal resumed_box_copies_at_next_end_only 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 help: do you need to update to a newer version of minimal? Running task runtime-implement-test-2 in bo

Verify min task run agent-verify exited 100.

 {
                "parent_span_id": "035dac5dd649a6ac",
                "rpc": "minimald-v1-GetSessionRecord",
                "span_id": "f270692d14c5812d",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "GetRecord",
                "parent_span_id": "f270692d14c5812d",
                "queued_behind": "0",
                "span_id": "7c2e1e85699b5dbc",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "rpc",
            fields: {
                "parent_span_id": "035dac5dd649a6ac",
                "rpc": "minimald-v1-DestroySession",
                "span_id": "0f18123825a9ccd4",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "GetRecord",
                "parent_span_id": "0f18123825a9ccd4",
                "queued_behind": "0",
                "span_id": "46af2b2eeb7c3245",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "DeleteSession",
                "parent_span_id": "0f18123825a9ccd4",
                "queued_behind": "0",
                "span_id": "a70713b16ad70d15",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "session.message",
            fields: {
                "kind": "Destroy",
                "parent_span_id": "a70713b16ad70d15",
                "span_id": "b01276c5d2cfa785",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "HandOverName",
                "parent_span_id": "a70713b16ad70d15",
                "queued_behind": "0",
                "span_id": "fdfd3ca2a1482529",
                "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 [  78.621s] 1389 tests run: 1388 passed, 1 failed, 2 skipped
        FAIL [  12.826s] (1389/1389) 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/cmd/boxes/attach.rs: ended_box_end_count now returns EndsBefore { Running, Ended(n), Unread }. An unread state or count copies nothing, so the end a resumed box came from stays unclaimed. The resume test asserts this through ends_show_new_end.
  • 👍 valid — crates/mfile/src/spec.rs: StoredExport now has a hand-written PartialEq that compares floats by their bits, so a TOML nan item equals itself and Eq is sound. The round-trip test asserts this.

A wait from another project copies nothing and says so. A wait on two boxes that export one path leaves the file of the later end. A resumed PTY box copies once, at its next end. When the attach cannot read the box's ends, it copies nothing, and a later min box wait copies that end.

Notes from the agent: Revise round 2. Both review threads were valid and are fixed in two new commits. cargo clippy -p minimal -p mfile --all-targets is clean. just clippy-strict was not run.

@minimal-foundry
minimal-foundry Bot marked this pull request as draft November 18, 2026 04:22
@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 · 1 condition · the full ruling

C1 from the last ruling is still open. The test resumed_box_copies_at_next_end_only does not prove the copy at the next end of a resumed box. The new asserts on ends_show_new_end test the decision, not the copy that architecture.md line 513 requires. Add the pass that C1 describes. The new EndsBefore::Unread path fails closed and conforms to line 512.

Ruled at d263519 against gominimal/arch@327e1b57d16b by claude-opus-5-5.

assert!(file_exported_lines(&global, "dev").await.is_empty());
}

// The end is not claimed, so a wait copies it, once.
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 test has no pass that proves the copy at the next end. Line 513 says the next end copies what the filesystem holds then. In the attach closure, write new notes.md contents and append a second exited event with boxes::store::append_event_at. Then assert one copy of the new contents and one file_exported event.

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 f3aeac450daa: Added the next-end pass: new notes.md contents and a second exited event in the attach closure. The test asserts one copy of the new contents and one file_exported event for that end.

@agent-137
Copy link
Copy Markdown
Member

/revise

Arch ruling on d263519 (arch_rulings 1371): CONDITIONS. The condition, in full:

  • C1: crates/minimal/src/tests.rs resumed_box_copies_at_next_end_only: add a pass that proves the copy at the next end. In the attach closure, write /workbench/notes.md with new contents in the box's retained filesystem (through put_box_files, or a direct write under the daemon state dir), and append a second exited event to the box's events file with boxes::store::append_event_at, as write_exec_event does. After attach_on_hosts returns, assert that the project's notes.md holds the new contents, and that file_exported_lines(&global, "dev") holds exactly one event. Keep the failed-resume pass and its later box_wait_on_hosts pass as they are.

Also from the same ruling (stale text): the PR body still says the daemon refuses to resume a box with file_exports. 219ad0c7 fixed that. Remove that sentence from the Proof and the notes.

Arch does not accept #3522 in place of C1, so this round must add the next-end pass. Keep everything else as it is.

Add a pass to resumed_box_copies_at_next_end_only. The attach resumes the
box, the box gets new export contents and a second exited event, and the
attach copies the new contents with one file_exported event for that end.
@minimal-foundry
Copy link
Copy Markdown
Contributor Author

Round 3 of 10 on a /revise note, pushed as f3aeac450daa.

line exit tail
cargo nextest run -p mfile stored_spec_with_file_exports_round_trips 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 help: do you need to update to a newer version of minimal? Running task runtime-implement-test-0 in bo
cargo nextest run -p minimal multi_box_wait_copies_in_order_of_ends 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 help: do you need to update to a newer version of minimal? Running task runtime-implement-test-1 in bo
cargo nextest run -p minimal resumed_box_copies_at_next_end_only 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 help: do you need to update to a newer version of minimal? Running task runtime-implement-test-2 in bo

Verify min task run agent-verify exited 100.

 {
                "parent_span_id": "3b640435392876b2",
                "rpc": "minimald-v1-GetSessionRecord",
                "span_id": "fe7936f6c3f5dc29",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "GetRecord",
                "parent_span_id": "fe7936f6c3f5dc29",
                "queued_behind": "0",
                "span_id": "442d423cd1ab90da",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "rpc",
            fields: {
                "parent_span_id": "3b640435392876b2",
                "rpc": "minimald-v1-DestroySession",
                "span_id": "941ce1526328f880",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "GetRecord",
                "parent_span_id": "941ce1526328f880",
                "queued_behind": "0",
                "span_id": "a5b6cd97ee926d7a",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "DeleteSession",
                "parent_span_id": "941ce1526328f880",
                "queued_behind": "0",
                "span_id": "500c4f631a91023b",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "session.message",
            fields: {
                "kind": "Destroy",
                "parent_span_id": "500c4f631a91023b",
                "span_id": "e6bfc85e84a374cc",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "HandOverName",
                "parent_span_id": "500c4f631a91023b",
                "queued_behind": "0",
                "span_id": "b15bc566e8fd9053",
                "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 [ 108.870s] 1389 tests run: 1388 passed, 1 failed, 2 skipped
        FAIL [  13.655s] (1389/1389) 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/tests.rs:22216: Added a next-end pass: the attach closure writes new notes.md contents and a second exited event, and the test asserts the copy and one file_exported event for end 2.
  • 👍 valid — crates/minimal/src/cmd/boxes/attach.rs: The new pass in resumed_box_copies_at_next_end_only reaches the after > before branch after a resume, and the attach copies the new contents.
  • 👍 valid — crates/minimal/src/tests.rs:22295: Added the next-end pass: new notes.md contents and a second exited event in the attach closure. The test asserts one copy of the new contents and one file_exported event for that end.

A wait from another project copies nothing and says so on stderr. A wait on two boxes that export one path leaves the file of the later end. A resumed PTY box copies nothing at the end it resumed from. When it ends again, the attach copies the new contents of the export once, and the record holds one file_exported event for that end.

Notes from the agent: Round 3 adds the C1 next-end pass to resumed_box_copies_at_next_end_only, after the failed-resume pass and its wait pass. Those two passes are unchanged. The daemon refuses an SFTP write to a stopped box (PermissionDenied), so the attach closure writes the new notes.md contents directly into the file that the daemon keeps for the box under its state dir. The test helper rewrite_kept_box_file finds that file by name and old contents. The closure then appends a second exited event with boxes::store::append_event_at (new helper write_box_exited_event). The wait pass before it already wrote one file_exported event for end 1. So the test asserts exactly one file_exported event with end 2, with copied true, and two events in total. The Proof and notes no longer say that the daemon refuses to resume a box with file_exports, because 219ad0c fixed that. clippy -p minimal --all-targets is clean. just clippy-strict did not run.

@agent-137
agent-137 marked this pull request as ready for review November 18, 2026 06:53
@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 pass in resumed_box_copies_at_next_end_only meets C1. The box resumes, gets new contents in its export, and ends again. The attach then copies the new contents once, as architecture.md line 513 says. Nothing else changed since the last ruling, so both covered requirements conform. Issues #3506, #3522 and #3523 carry the open work. The verify run failed on exec_run_attach_and_task_run_share_the_commands_trace. This ruling does not cover that test, so fix it before the PR leaves draft.

Ruled at f3aeac4 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 on lines +358 to +364
pub(crate) async fn box_wait_all_on_hosts(
hosts: Vec<crate::cmd::list::LocalHost>,
targets: &[String],
here: Option<&paths::HostAbsPath>,
timeout: Option<std::time::Duration>,
poll: std::time::Duration,
) -> Result<Vec<BoxWaited>, anyhow::Error> {
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.50 · in box_wait_all_on_hosts

box_wait_all_on_hosts has no caller outside tests. The min box wait command at wait.rs:504 still takes one target and calls box_wait_on_hosts. So a user cannot run a wait on two boxes, and the order of the ends (BOX-203) has no effect in the product. Wire the command to take several targets, or state in the PR that a later task does it.

What the reviewer checked

wait.rs:504 box_wait_on_hosts(hosts, &args.target, here.as_ref(), timeout, POLL_INTERVAL).await?

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

File:       crates/minimal/src/cmd/boxes/wait.rs
Lines:      358-364
Category:   correctness
Severity:   low (reviewer confidence 0.50)

Finding:
`box_wait_all_on_hosts` has no caller outside tests. The `min box wait` command at wait.rs:504 still takes one target and calls `box_wait_on_hosts`. So a user cannot run a wait on two boxes, and the order of the ends (BOX-203) has no effect in the product. Wire the command to take several targets, or state in the PR that a later task does it.

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 premise is correct: no CLI path reaches box_wait_all_on_hosts yet. The fix is outside this task's layers. BoxWaitArgs in crates/minimal/src/cli.rs must accept several targets, and the spec does not say which exit code a wait on several boxes returns. This task delivers and tests the ordered copy (BOX-203). A later task must add the CLI surface for a wait on several boxes.

@minimal-foundry
Copy link
Copy Markdown
Contributor Author

Round 4 of 10 on the runtime's review findings: the coder changed nothing. every commit this round put on the branch above f3aeac4 is a merge of the base branch, so it carries no work of its own

Review threads the coder judged:

  • 👎 invalid — crates/minimal/src/cmd/boxes/wait.rs:364: The premise is correct: no CLI path reaches box_wait_all_on_hosts yet. The fix is outside this task's layers. BoxWaitArgs in crates/minimal/src/cli.rs must accept several targets, and the spec does not say which exit code a wait on several boxes returns. This task delivers and tests the ordered copy

@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 18, 2026
Merged via the queue into main with commit 34ad733 Nov 18, 2026
40 checks passed
@mitodrummer
mitodrummer deleted the agent/3447-copy-exports-only-in-the-box-s-own-project-in-th branch November 18, 2026 16:02
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.

T133 — Copy exports only in the box's own project, in the order of the ends, and at a resumed box's next end

2 participants

0