8000 feat: T130 — The command that waits for a box copies its declared exports back to the project by minimal-foundry[bot] · Pull Request #3448 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

feat: T130 — The command that waits for a box copies its declared exports back to the project - #3448

Draft
minimal-foundry[bot] wants to merge 15 commits into
mainfrom
agent/3444-the-command-that-waits-for-a-box-copies-its-decl
Draft

minimal-foundry[bot] wants to merge 15 commits into
mainfrom
agent/3444-the-command-that-waits-for-a-box-copies-its-decl

Conversation

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

T130 — The command that waits for a box copies its declared exports back to the project

slice: S2
kind: task
covers: BOX-185, BOX-186, BOX-187, BOX-188, BOX-189
size: L
est: 280 code, 300 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:
- expansion:
- crates/mfile/src/expand.rs: refuse an absolute, .. or project-root export path (BOX-189)
- crates/mfile/src/error.rs: the BOX-189 refusal
test: cargo nextest run -p mfile export_path_outside_project_refused_exit3
- client:
- crates/minimal/src/cmd/boxes/exports.rs (new): the copy: each export's file or tree, through min box cp's file reads, each file written under a temporary name and renamed into place (BOX-187, BOX-188)
- crates/minimal/src/task.rs: an attached run copies after the box ends; --detach copies nothing
- crates/minimal/src/cmd/boxes/attach.rs: an attach, and a start that attaches, copy after the box ends
- crates/minimal/src/cmd/boxes/wait.rs: min box wait copies for a box that ended
- crates/minimal/src/tests.rs: tests
test: cargo nextest run -p minimal waiting_command_copies_file_exports_after_box_ends
test: cargo nextest run -p minimal detached_start_or_stop_copies_no_exports
test: cargo nextest run -p minimal directory_export_copies_its_tree_and_deletes_nothing
test: cargo nextest run -p minimal export_writes_each_file_atomically
- daemon:
- crates/minimald/src/box_manager.rs: drop file_exports from UNENFORCED_SECTIONS, since the client now copies it
- crates/minimald/src/box_manager/tests.rs: unenforced_sections_warn_once_each_naming_section no longer expects file_exports
produces:
- crates/minimal/src/cmd/boxes/exports.rs
consumes: none
proof: a task box whose entry declares a file and a directory export ends, and the waiting command leaves both in the project; a detached run copies nothing; an export path outside the project fails before any box is created.
depends on:
- blocked by #2401

Also delivers

This PR also delivers T134 (#3453) and covers BOX-192, BOX-196 and BOX-199: an export that leads out of the project or out of /workbench, or a copy into another project, is refused and named on stderr.

Residuals

Each is owned by a later task:

Proof

A box whose spec declares a file export and a folder export is stopped. Then min box wait, or an attach that sees the box end, leaves both in the project folder: the folder export has its whole tree, empty folders included, and no project file is deleted. Each file is written under a temporary name and renamed into place. A detach and min box stop copy nothing, and a --detach run returns before the copy. An export path that is absolute, has a .. component, or names the project folder fails the expansion with exit 3, before any box is created.

Notes from the agent: Files outside the layers: crates/minimal/src/cmd/boxes.rs declares the new exports module (one mod line and one use line). crates/minimal/Cargo.toml adds russh-sftp.workspace = true, and Cargo.lock changes to match. min needs it to list the folders of a folder export through the box's file service. min box cp reads one file only, and its reader in events.rs is private, so exports.rs opens the same sftp subsystem itself.

The spec excerpt does not fix the key of a [[file_exports]] item. The code reads path, or the item itself when it is a string. An item with no path is not refused, so the existing mfile test that sets src/dst still passes. A later spec change can pin the key.

Observability is not delivered. The file_exported event on the box's record (BOX-195) needs a report RPC in minimald-rpc and minimald, and neither is in this task's layers. The client logs one tracing line per export only, with its path, whether it was copied, and its file count. ExportOutcome already carries each file's path, size and sha256 for that report.

Diagnostics: each skipped or failed export prints one stderr line that names its path and the box. These are the lines: "min did not copy <path> from box , because it was not found in the box.", "... because the path points outside the folder that holds minimal.toml.", "min did not copy all of <path> from box : …[truncated]

Tests

line exit tail
cargo nextest run -p mfile export_path_outside_project_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
cargo nextest run -p minimal waiting_command_copies_file_exports_after_box_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 warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p minimal detached_start_or_stop_copies_no_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 directory_export_copies_its_tree_and_deletes_nothing 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 export_writes_each_file_atomically 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 101, so this PR is a draft.

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

Out of scope

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

  • crates/minimal/Cargo.toml
  • crates/minimal/src/cmd/boxes.rs

Closes #3444

An absolute path, a path with a .. component, or a path that names the
project root fails the expansion with exit 3 (BOX-189), so no box is
created. Adds file_export_paths for the client copy.
An attached run, an attach and min box wait copy each declared
[[file_exports]] path from /workbench in the ended box to the project.
A folder export creates its tree and deletes nothing. Each file is
written under a temporary name and renamed into place (BOX-185 to 188).
Covers the wait and attach copy, a detach and a stop that copy
nothing, a folder export that deletes nothing, and the atomic write
of each file (BOX-185 to BOX-188).
The command that waits for a box now copies [[file_exports]] on the
client (BOX-185), so the daemon no longer lists it as unenforced.
@coderabbitai
coderabbitai Bot commented Nov 14, 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: d34b576f-00c5-4af7-93ae-c194ab41a5ab

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

…d-that-waits-for-a-box-copies-its-decl

# Conflicts:
#	crates/minimal/src/tests.rs
@minimal-foundry
Copy link
Copy Markdown
Contributor Author

A merge of main before round 1, not counted against the cap (1 of 3), pushed as fcc14116b51e.

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

line exit tail
cargo nextest run -p mfile export_path_outside_project_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
cargo nextest run -p minimal waiting_command_copies_file_exports_after_box_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 warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p minimal detached_start_or_stop_copies_no_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 directory_export_copies_its_tree_and_deletes_nothing 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 export_writes_each_file_atomically 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.

               "span_id": "6da997619d859072",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "rpc",
            fields: {
                "parent_span_id": "ffbcf1224c3ed782",
                "rpc": "minimald-v1-DestroySession",
                "span_id": "743591ad5895074f",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "GetRecord",
                "parent_span_id": "743591ad5895074f",
                "queued_behind": "0",
                "span_id": "1ff27bae51b8d1ee",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "DeleteSession",
                "parent_span_id": "743591ad5895074f",
                "queued_behind": "0",
                "span_id": "5add4d32c2427a41",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "session.message",
            fields: {
                "kind": "Destroy",
                "parent_span_id": "5add4d32c2427a41",
                "span_id": "9561d3713c51967e",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "HandOverName",
                "parent_span_id": "5add4d32c2427a41",
                "queued_behind": "0",
                "span_id": "c78a464eab930798",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
    ]
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

  Cancelling due to test failure: 3 tests still running
        PASS [   2.502s] (1342/2810) minimald box_actor::tests::a_contended_walk_never_replaces_a_present_verdict
        PASS [   2.652s] (1343/2810) minimald box_actor::tests::a_box_nobody_handed_an_address_publishes_at_the_answerers_grant
        PASS [   2.676s] (1344/2810) minimald box_actor::tests::a_box_re_registered_inside_the_landing_window_keeps_its_grant
────────────
     Summary [  99.605s] 1344/2810 tests run: 1343 passed, 1 failed, 29 skipped
        FAIL [   3.998s] (1341/2810) minimal::otel_cli exec_run_attach_and_task_run_share_the_commands_trace
warning: 1466/2810 tests were not run due to test failure (run with --no-fail-fast to run all tests, or run with --max-fail)
error: test run failed

Outside the task's layers::

  • crates/minimal/Cargo.toml
  • crates/minimal/src/cmd/boxes.rs

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

A task box whose entry declares a file and a directory export ends, and the waiting command leaves both in the project. A detached run copies nothing. An export path outside the project fails before any box is created. The branch now merges cleanly with main.

Notes from the agent: Revise round: resolved the one conflict in crates/minimal/src/tests.rs. Both sides only added tests at the end of the file: this branch's file export tests and main's expander_skew_reports_and_continues. The resolution keeps both, unchanged. The merge commit is fcc1411. cargo clippy -p minimal --all-targets is clean after the merge, and main's expander_skew_reports_and_continues also passes.

10000

@agent-137
agent-137 marked this pull request as ready for review November 15, 2026 22:10
@agent-137
agent-137 requested a review from a team as a code owner November 15, 2026 22:10
@minimal-foundry
minimal-foundry Bot commented Nov 15, 2026 •
Copy link
Copy Markdown
Contributor Author

Reading f8b5329bdb53.

This comment updates when the review finishes.

@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 — 3 findings, 3 inline.

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

Comment on lines +455 to +465
ExportKind::File
} else if file_type.is_symlink() {
// The file service refuses a link that leaves the box's
// folders, so a link it follows stays inside them.
match self.kind(&format!("{path}/{name}")).await {
Ok(kind) => kind,
Err(e) => return Err(e),
}
} else {
tracing::debug!(
path,
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.60 · in BoxFiles::list

One dangling symlink inside a folder export aborts the whole export. list calls self.kind on each link, metadata returns NoSuchFile, and that error propagates out of read_tree through ?. copy_one then reports 'a folder inside ... is no longer in the box', and nothing is copied. Skip the link, or treat it as a failed entry, so the other files still come back.

What the reviewer checked

exports.rs list(): file_type.is_symlink() => match self.kind(...).await { Ok(kind) => kind, Err(e) => return Err(e) }; read_tree: let mut names = source.list(&dir).await?;

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

File:       crates/minimal/src/cmd/boxes/exports.rs
Lines:      455-465
Category:   correctness
Severity:   medium (reviewer confidence 0.60)

Finding:
One dangling symlink inside a folder export aborts the whole export. `list` calls `self.kind` on each link, `metadata` returns NoSuchFile, and that error propagates out of `read_tree` through `?`. `copy_one` then reports 'a folder inside ... is no longer in the box', and nothing is copied. Skip the link, or treat it as a failed entry, so the other files still come back.

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 bc14088cc58a: BoxFiles::list now skips a link whose target is not found (debug log), so one dangling link no longer aborts the folder export. Other read failures still propagate.

Comment thread crates/minimal/src/cmd/boxes/attach.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 · 4 conditions · the full ruling

The copy is in the right place, and BOX-186 and BOX-189 conform. This change makes exports live, but the copy does not check symlinks at copy time. Section File exports line 516 requires that check on both sides. A symlink committed in a cloned project can send the write outside the project root (C1). A box link into the box's home passes the file service (C2). attach and wait write into the record's project root from any project, and line 514 forbids that (C3). Name each rule that later tasks own (125, once per end, file_exported) with its issue in the PR body (C4).

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

};
let rel = parts.join("/");
let src = format!("{BOX_PROJECT_DIR}/{rel}");
let dest = parts
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 destination is not resolved before the write. create_dir_all and tempfile_in follow a symlink in the project, so a committed link sends the write outside the project root. Section File exports line 516 forbids this. Canonicalize each destination of the export first, and write nothing for the export if one escapes.

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 6184244d35ae: copy_one now resolves every destination (the export's dest, and each folder and file of a folder export) with canonicalize before any write, and writes nothing for an export that leads outside the project root. New test: export_through_escaping_symlink_writes_nothing.

Comment thread crates/minimal/src/cmd/boxes/exports.rs Outdated
} else if file_type.is_file() {
ExportKind::File
} else if file_type.is_symlink() {
// The file service refuses a link that leaves the box's
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 · The file service serves /workbench and the box's home. A link into the home passes its check. Line 516 limits the source to the box's copy of the project. Canonicalize each source through sftp.canonicalize, and refuse the export unless the path is under /workbench. Remove this comment.

8
10BC8

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 6184244d35ae: Each source and every folder and file of its tree is resolved through SftpSession::canonicalize and must be /workbench or under it, else the export writes nothing. The comment in BoxFiles::list is removed. New test: export_source_symlink_out_of_workbench_writes_nothing.

if let BoxAfterAttach::Listed(entry) = &ended
&& matches!(entry.state.as_str(), "stopped" | "exited")
{
let root = entry.project_root.as_ref();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

C3 · This root comes from the box record, not from the command. Line 514 says a command copies only when its own project root is the one the record names. Discover the command's root, compare the two, and copy nothing on a mismatch. Print one stderr line that names the box and its project folder.

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 6184244d35ae: The attach now finds its own project root from the cwd and passes it to attach_on_hosts. copy_box_exports copies only when it equals the record's project_root, else it prints one line naming the box and that folder.

if let Some(ended) = wait_exit(&shown.record, target) {
// BOX-185: the wait copies the box's declared exports, on
// every end, before it gives back the box's code.
let root = shown.record.project_root.as_ref();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

C3 · The same issue as in attach.rs: the wait writes into the record's root from any cwd. Pass the command's own project root into box_wait_on_hosts, and copy only when it equals shown.record.project_root.

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 6184244d35ae: cmd_box_wait passes the command's own project root into box_wait_on_hosts, and the copy happens only when it equals shown.record.project_root. New test: exports_not_copied_from_another_project.

root.map(|root| std::path::Path::new(root.as_str())),
&mut std::io::stderr(),
)
.await;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

C4 · The outcomes are discarded, so a skipped export does not give exit 125 (line 517). Nothing claims the end, so a later wait copies again (line 512). Nothing reports the outcome as file_exported (line 518). These rules can stay for later tasks, but the PR body must name each one with its issue.

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 6184244d35ae: No code change here, as the thread allows. The Residuals list for the PR body is in this round's notes: exit 125 (#3445, #3446), the once-for-each-end claim (#3446), the file_exported report (#3446), and the several-box wait order (#3447).

@agent-137
Copy link
Copy Markdown
Member

/revise Arch ruling 1313 on fcc1411 set four conditions. Karl ruled on 2026-11-15 that C1, C2 and C3 are done in this PR: BOX-192 and BOX-196 move here from T131 (#3445), and BOX-199 moves here from T133 (#3447). Do all four. The arch conditions C1 to C3, in full:

  • C1: crates/minimal/src/cmd/boxes/exports.rs copy_one: before you write anything for an export, resolve each destination. That is the export's dest, and for a folder export each dest.join(dir) and dest.join(file). Resolve the deepest part that exists with std::fs::canonicalize, and compare it with canonicalize(project_root). Also check a destination that is itself a symlink. If any destination resolves outside the project root, write nothing for that export. Return a new NotCopied variant whose stderr line names the export's path and says it leads outside the project folder, and go on with the next export (BOX-192). Add a test with a project symlink that points outside the root.

  • C2: crates/minimal/src/cmd/boxes/exports.rs: before you write any file of an export, resolve the export's source and every folder and file of its tree with SftpSession::canonicalize (BoxFiles::identity already calls it). Refuse the export unless each resolved path is /workbench or starts with /workbench/. Write nothing for a refused export, print a stderr line that names its path and says it leads outside the box's copy of the project, and go on with the next export (BOX-196). Remove the comment in BoxFiles::list that says a link the file service follows stays inside the box's folders. The service also serves the box's home. Add a test with a /workbench link that points into the home.

  • C3: crates/minimal/src/cmd/boxes/attach.rs attach_on_hosts and crates/minimal/src/cmd/boxes/wait.rs box_wait_on_hosts: copy into the waiting command's own project root, not into project_root from the box record. Discover the root from the command's cwd, as box_list_scope does, and pass it in. Copy only when it equals the record's project_root. If it does not, copy nothing and print one stderr line that names the box and the record's project folder (BOX-199). Leave the exit code unchanged.

  • C4 (adjusted for the move above): add a Residuals list to the PR body. It names each design rule this change still leaves undone, with the issue that owns it:

Keep the tests this task names passing, and add the tests C1, C2 and C3 ask for. Do not rewrite history and do not force-push.

@minimal-foundry
Copy link
Copy Markdown
Contributor Author

That /revise is held, not dropped. A coder is already running on #3444. Your note is kept and goes into the next round here, which starts when that coder finishes.

Nothing to type again: the command gets a rocket when its round starts, or a refusal that names the reason. No round was counted for it yet.

@agent-137
Copy link
Copy Markdown
Member

/revise Addendum to the previous /revise note: use the exact text and test names that the plan fixes for C1, C2 and C3. Each message is one stderr line. The test named next to it pins the text.

  • C1 (BOX-192): Export <path> was not copied: it leads outside the project folder. Test: cargo nextest run -p minimal export_through_escaping_symlink_writes_nothing
  • C2 (BOX-196): Export <path> was not copied: it leads outside the box's copy of the project. Test: cargo nextest run -p minimal export_source_symlink_out_of_workbench_writes_nothing
  • C3 (BOX-199): Box <box> was created in <project folder>, so its exports were not copied here. Test: cargo nextest run -p minimal exports_not_copied_from_another_project

<path> is the export's path as minimal.toml declares it. <box> is the box's name, and <project folder> is the record's project_root. Put the tests in crates/minimal/src/tests.rs.

@minimal-foundry
Copy link
Copy Markdown
Contributor Author

That /revise is held, not dropped. A coder is already running on #3444. Your note is kept and goes into the next round here, which starts when that coder finishes.

Nothing to type again: the command gets a rocket when its round starts, or a refusal that names the reason. No round was counted for it yet.

A link to nothing inside a folder export no longer aborts the whole
copy. An attach that ends with another code now waits for the box to
leave running only when the box declares an export.
@agent-137
Copy link
Copy Markdown
Member

/revise Addendum to the two held notes: the runtime caps a task at 6 IDs, so BOX-192, BOX-196 and BOX-199 now belong to a new task, T134 (#3453), and not to T130. The work in the held notes does not change, and this PR still does all of it. In the PR body, add one line that says this PR also delivers T134 (#3453) and covers BOX-192, BOX-196 and BOX-199. Do not use a closing keyword for #3453.

@minimal-foundry
Copy link
Copy Markdown
Contributor Author

That /revise is held, not dropped. A coder is already running on #3444. Your note is kept and goes into the next round here, which starts when that coder finishes.

Nothing to type again: the command gets a rocket when its round starts, or a refusal that names the reason. No round was counted for it yet.

@minimal-foundry
Copy link
Copy Markdown
Contributor Author

Round 1 of 10 on the runtime's review findings, pushed as bc14088cc58a.

line exit tail
cargo nextest run -p mfile export_path_outside_project_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
cargo nextest run -p minimal waiting_command_copies_file_exports_after_box_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 warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p minimal detached_start_or_stop_copies_no_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 directory_export_copies_its_tree_and_deletes_nothing 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 export_writes_each_file_atomically 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 timed out after 1800s.

rkbench/crates/async-dialog)
   Compiling minvmd v0.8.0 (/workbench/crates/minvmd)
    Checking mlog v0.0.1 (/workbench/crates/mlog)
    Checking google-cloud-lro v1.11.0
   Compiling serial_test_derive v4.0.1
    Checking google-cloud-storage v1.20.0
    Checking serial_test v4.0.1
    Checking common v0.0.1 (/workbench/crates/common)
    Checking boxes v0.0.1 (/workbench/crates/boxes)
    Checking sandbox v0.0.1 (/workbench/crates/sandbox)
    Checking mfile v0.0.1 (/workbench/crates/mfile)
    Checking minimald-rpc v0.0.1 (/workbench/crates/minimald-rpc)
    Checking decode v0.0.1 (/workbench/crates/decode)
    Checking checkouts v0.0.1 (/workbench/crates/checkouts)
    Checking graph v0.0.1 (/workbench/crates/graph)
    Checking minimal-client v0.8.0 (/workbench/crates/minimal-client)
    Checking lcache v0.0.1 (/workbench/crates/lcache)
    Checking rcache v0.0.1 (/workbench/crates/rcache)
    Checking op v0.0.1 (/workbench/crates/op)
    Checking check v0.0.1 (/workbench/crates/check)
    Checking orchestrator v0.0.1 (/workbench/crates/orchestrator)
    Checking mctx v0.0.1 (/workbench/crates/mctx)
    Checking minimald v0.8.0 (/workbench/crates/minimald)
    Checking minimal v0.8.0 (/workbench/crates/minimal)
    Finished `dev` profile [unoptimized] target(s) in 3m 48s
   Compiling opentelemetry v0.33.1
   Compiling version v0.8.0 (/workbench/crates/version)
   Compiling stdlib v0.0.22 (/workbench/crates/stdlib)
   Compiling serial_test v4.0.1
   Compiling opentelemetry_sdk v0.33.1
   Compiling tracing-opentelemetry v0.34.0
   Compiling opentelemetry-http v0.33.1
   Compiling opentelemetry-appender-tracing v0.33.1
   Compiling google-cloud-gax-internal v0.7.20
   Compiling opentelemetry-proto v0.33.0
   Compiling opentelemetry-otlp v0.33.0
   Compiling google-cloud-longrunning v1.14.0
   Compiling google-cloud-iam-v1 v1.13.0
   Compiling mlog v0.0.1 (/workbench/crates/mlog)
   Compiling google-cloud-lro v1.11.0
   Compiling google-cloud-storage v1.20.0
   Compiling common v0.0.1 (/workbench/crates/common)
   Compiling boxes v0.0.1 (/workbench/crates/boxes)
   Compiling sandbox v0.0.1 (/workbench/crates/sandbox)
   Compiling mfile v0.0.1 (/workbench/crates/mfile)
   Compiling minimald-rpc v0.0.1 (/workbench/crates/minimald-rpc)
   Compiling minimal-client v0.8.0 (/workbench/crates/minimal-client)
   Compiling minvmd v0.8.0 (/workbench/crates/minvmd)
   Compiling decode v0.0.1 (/workbench/crates/decode)
   Compiling checkouts v0.0.1 (/workbench/crates/checkouts)
   Compiling graph v0.0.1 (/workbench/crates/graph)
   Compiling lcache v0.0.1 (/workbench/crates/lcache)
   Compiling rcache v0.0.1 (/workbench/crates/rcache)
   Compiling op v0.0.1 (/workbench/crates/op)
   Compiling orchestrator v0.0.1 (/workbench/crates/orchestrator)
   Compiling check v0.0.1 (/workbench/crates/check)
   Compiling mctx v0.0.1 (/workbench/crates/mctx)
   Compiling minimald v0.8.0 (/workbench/crates/minimald)
   Compiling minimal v0.8.0 (/workbench/crates/minimal)

Outside the task's layers::

  • crates/minimal/Cargo.toml
  • crates/minimal/src/cmd/boxes.rs

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

Review threads the coder judged:

  • 👍 valid — crates/minimal/src/cmd/boxes/exports.rs:465: BoxFiles::list now skips a link whose target is not found (debug log), so one dangling link no longer aborts the folder export. Other read failures still propagate.
  • 👍 valid — crates/minimal/src/cmd/boxes/attach.rs:1500: For an unread ending, attach_on_hosts reads the box once. It waits for the settle bound only when the box still runs and its spec declares an export.

A task box whose entry declares a file and a directory export ends, and the waiting command leaves both in the project. A link to nothing inside the directory no longer stops the other files from coming back. A detached run copies nothing. An export path outside the project fails before any box is created.

Notes from the agent: Revise round 1. Both review threads are fixed in exports.rs and attach.rs. No new test covers the dangling-link skip, because it is in the SFTP-backed BoxFiles source, and the unit tests use a fake source. The settle change adds one GetBoxSpec read when an attach ends with a code other than 0 or 254 and the box still reads running.

@minimal-foundry
minimal-foundry Bot marked this pull request as draft November 16, 2026 00:23
@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: 3 of 3 personas ran (correctness, security, supply-chain).

Comment thread crates/minimal/src/task.rs Resolved
An export now writes nothing when a destination resolves through a link
outside the project root (BOX-192), or when a source in the box resolves
outside /workbench (BOX-196). A waiting command copies only when its own
project root is the one in the box's record (BOX-199).
@agent-137
agent-137 marked this pull request as ready for review November 16, 2026 01:20
A run with no exit status lost its connection, and its box can still
run. Read the record first, as the attach does. Mark the unused export
outcomes as interim and name BOX-193, BOX-195 and BOX-198.
@agent-137
agent-137 marked this pull request as ready for review November 16, 2026 02:57
@minimal-foundry
Copy link
Copy Markdown
Contributor Author

Round 3 of 10 on the runtime's review findings, pushed as 7fbe33b5ed6f.

line exit tail
cargo nextest run -p mfile export_path_outside_project_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
cargo nextest run -p minimal waiting_command_copies_file_exports_after_box_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 warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p minimal detached_start_or_stop_copies_no_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 directory_export_copies_its_tree_and_deletes_nothing 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 export_writes_each_file_atomically 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 101.

e/cargo-home/build/debug/deps/libserial_test-8e7a105cb1948559.rlib --extern sha2=/work/build-cache/cargo-home/build/debug/deps/libsha2-c9bcb32104c3d8ae.rlib --extern size=/work/build-cache/cargo-home/build/debug/deps/libsize-0a8a7350b7e7e72e.rlib --extern stdlib=/work/build-cache/cargo-home/build/debug/deps/libstdlib-9905d85919a12313.rlib --extern switch=/work/build-cache/cargo-home/build/debug/deps/libswitch-6c812704e5da955c.rlib --extern sysinfo=/work/build-cache/cargo-home/build/debug/deps/libsysinfo-c713cd278cf33e00.rlib --extern tar=/work/build-cache/cargo-home/build/debug/deps/libtar-bb27b0a5d6ba0193.rlib --extern tempfile=/work/build-cache/cargo-home/build/debug/deps/libtempfile-a0e916d9301e1bc8.rlib --extern thiserror=/work/build-cache/cargo-home/build/debug/deps/libthiserror-d936554554fa5dac.rlib --extern tokio=/work/build-cache/cargo-home/build/debug/deps/libtokio-13fd64194b408f82.rlib --extern tokio_util=/work/build-cache/cargo-home/build/debug/deps/libtokio_util-55bfa9e349d7b2c1.rlib --extern tokio_vsock=/work/build-cache/cargo-home/build/debug/deps/libtokio_vsock-721a779abb11ee8a.rlib --extern tracing=/work/build-cache/cargo-home/build/debug/deps/libtracing-83feaaf26e80a884.rlib --extern tracing_appender=/work/build-cache/cargo-home/build/debug/deps/libtracing_appender-4049512b24d27abd.rlib --extern tracing_opentelemetry=/work/build-cache/cargo-home/build/debug/deps/libtracing_opentelemetry-4bc00377a5611f16.rlib --extern tracing_subscriber=/work/build-cache/cargo-home/build/debug/deps/libtracing_subscriber-b9d261067ec6d0c0.rlib --extern uuid=/work/build-cache/cargo-home/build/debug/deps/libuuid-2ad4c678aa627cb6.rlib --extern version=/work/build-cache/cargo-home/build/debug/deps/libversion-26aec4f378b53f65.rlib --extern vsock=/work/build-cache/cargo-home/build/debug/deps/libvsock-28a991460262852d.rlib --extern vt100=/work/build-cache/cargo-home/build/debug/deps/libvt100-cfaab5484d385f52.rlib --extern walkdir=/work/build-cache/cargo-home/build/debug/deps/libwalkdir-8278203427ac3159.rlib --extern zstd=/work/build-cache/cargo-home/build/debug/deps/libzstd-587a39a8eee416fb.rlib -L native=/work/build-cache/cargo-ho
10BC8
me/build/debug/build/tree-sitter-6abcf750100a3ada/out -L native=/work/build-cache/cargo-home/build/debug/build/tree-sitter-nickel-4d55240ed02e956b/out -L native=/work/build-cache/cargo-home/build/debug/build/zstd-sys-0d91391d9ed43bde/out -L native=/work/build-cache/cargo-home/build/debug/build/ring-43aedddb25fbb121/out -L native=/work/build-cache/cargo-home/build/debug/build/aws-lc-sys-467e076f78a0a3c4/out -L native=/work/build-cache/cargo-home/build/debug/build/blake3-493bdc0df5a171ff/out -L native=/work/build-cache/cargo-home/build/debug/build/blake3-493bdc0df5a171ff/out` (exit status: 2)
warning: build failed, waiting for other jobs to finish...
error: command `/usr/bin/cargo '--color=auto' test --no-run --message-format json-render-diagnostics --package mfile --package minimal --package minimald --locked` exited with code 101

Outside the task's layers::

  • crates/minimal/Cargo.toml
  • crates/minimal/src/cmd/boxes.rs

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

Review threads the coder judged:

  • 👍 valid — crates/minimal/src/task.rs: The attached run now reads the record and copies only when the box is stopped or exited, so a dropped connection with a live box copies nothing.
  • 👍 valid — crates/minimal/src/task.rs:1930: Same fix as the sibling thread: run_entry gates copy_box_exports on a Stopped or Exited record state.
  • 👎 invalid — crates/minimal/src/cmd/boxes/exports.rs:401: True that nothing emits file_exported, but that is BOX-195, which this task does not cover. It needs a report RPC in crates/minimald-rpc and a daemon handler in minimald, outside this task's layers. The interim is now stated in the copy_box_exports doc comment.
  • 👍 valid — crates/minimal/src/cmd/boxes/exports.rs:738: The copy_box_exports doc comment now states the interim (copies on each call, outcomes unused) and its flip condition, citing BOX-198, BOX-195 and BOX-193.
  • 👍 valid — crates/minimal/src/task.rs: task.rs binds the result to _outcomes with a comment that names BOX-193 and BOX-195 as later tasks.
  • 👍 valid — crates/minimal/src/cmd/boxes/wait.rs: wait.rs binds the result to _outcomes with a comment that names BOX-198, BOX-195 and BOX-193 as later tasks.

A task box whose entry declares a file and a directory export ends, and the waiting command (an attached run, an attach, or min box wait) leaves both in the project. A detached run copies nothing. An attached run that loses its connection while the box still runs now copies nothing. An export path outside the project fails at expansion with exit 3, before any box is created.

Notes from the agent: Revise round 3. The attached task run now reads the box record and copies only when the state is stopped or exited. The unused export outcomes are bound to _outcomes in task.rs, attach.rs and wait.rs, and the copy_box_exports doc comment states the interim and its flip condition. I do not know the issue numbers for BOX-193, BOX-195 and BOX-198, because this box has no gh access. The comments cite the requirement IDs, and the PR body must name the issues. The file_exported event (the task's observability line) is not delivered: BOX-195 needs a client report RPC in minimald-rpc and a daemon handler, outside this task's layers.

@minimal-foundry
minimal-foundry Bot marked this pull request as draft November 16, 2026 03:00
@minimal-foundry minimal-foundry Bot added the needs-human An agent handed off; a human must act, then clear this label. Set by defer and handoffs. label Nov 16, 2026
@minimal-foundry
Copy link
Copy Markdown
Contributor Author

The runtime will not revise this pull request again on its own: the diff is +1748/-9 (1757 lines), past 3x the plan's estimate of 580 lines (est: 280 code, 300 tests, as #3444 reads now), at round 3 (the last trigger was the runtime's review findings). A person decides now. Remove needs-human from this pull request to let /revise <note> or the automatic rounds resume, or finish #3444 by hand.

@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: 12 unresolved threads — minimal-foundry[bot] crates/minimal/src/cmd/boxes/exports.rs:624, minimal-arch[bot] crates/minimal/src/cmd/boxes/exports.rs:454, minimal-arch[bot] crates/minimal/src/cmd/boxes/exports.rs, minimal-arch[bot] crates/minimal/src/cmd/boxes/attach.rs:1525, minimal-arch[bot] crates/minimal/src/cmd/boxes/wait.rs:242, …. No findings.

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

@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 · 3 conditions · the full ruling

The attached run copies the exports into the wrong folder when it starts in a subfolder of the project. task.rs run_entry gives abs_path, the folder the command ran in, as the project root, and gives it again as the command's own root. Lines 511 and 1218 of architecture.md put the copy under the project root, and line 514 compares the command's root with the record's. C1 passes upload_root for both. C2 adds a test that proves where the run writes. C3 links the owning issues in the interim comments. The wait and attach paths, the containment checks and the atomic writes conform.

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

Comment thread crates/minimal/src/task.rs Outdated
&mut client,
id,
&session_name,
Some(std::path::Path::new(abs_path.as_str())),
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 · abs_path is the folder the command ran in. The record holds upload_root. From a subfolder, the exports go to the subfolder, and the check of line 514 compares the folder with itself. Pass upload_root here and on the next line (architecture.md lines 511, 514, 1218).

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 a7410f46779b: The attached run's copy now passes upload_root as both project_root and here, through the new task::copy_ended_task_box_exports. It no longer passes abs_path.

// `min task run --detach`, `min box run --detach` and `min box start
// --detach` take the `--detach` branch of the one run path, which
// returns before the copy.
let source = include_str!("task.rs");
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 checks the source text of task.rs. It does not prove where the attached run writes. Add a test that runs the copy from a folder below the project root, and assert that the file is at <project root>/<path> (line 511).

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 a7410f46779b: Added attached_run_from_subfolder_copies_exports_to_project_root. It drives copy_ended_task_box_exports from a root resolved from /src/deep. It asserts the file is at /out/report.txt and nothing is below the subfolder.


/// [`copy_box_exports_on_host`] over a connected `client`.
///
/// Interim: this copies again on each call, and its callers do not use the
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

C3 · The interim states its flip condition but links no issue. Name #3445 beside BOX-193 and #3446 beside BOX-195 and BOX-198. Do the same in wait.rs, attach.rs and task.rs.

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 a7410f46779b: The interim comments in exports.rs, wait.rs, attach.rs and task.rs now name #3445 for BOX-193 and #3446 for BOX-195 and BOX-198.

< 10BC8 !-- '"` -->

@agent-137 agent-137 removed the needs-human An agent handed off; a human must act, then clear this label. Set by defer and handoffs. label Nov 16, 2026
@agent-137
Copy link
Copy Markdown
Member

/revise Arch ruling 1320 on 7fbe33b set three conditions. Karl accepted this PR's size on 2026-11-16, and the needs-human label is removed. Do all three. In full:

  • C1: crates/minimal/src/task.rs run_entry: in the copy_box_exports call after the box ended (lines 1918-1919), pass upload_root (the root that stamp_project_root put on the create request, so the record's project_root) as both project_root and here, in place of abs_path. abs_path is the folder the command ran in, and it is below the project root when the run starts in a subfolder.
  • C2: crates/minimal/src/tests.rs: add a test that drives the attached run's copy (run_entry, or a function that C1's call is moved into) from a folder below the project root, and asserts that the export is at <project root>/<path> and that nothing is at <subfolder>/<path>. The source-text check in detached_start_or_stop_copies_no_exports is not a proof that the attached run copies to the project root.
  • C3: Name the owning issue beside each requirement id in the interim comments: crates/minimal/src/cmd/boxes/exports.rs copy_box_exports doc (line 732), crates/minimal/src/cmd/boxes/wait.rs line 237, crates/minimal/src/cmd/boxes/attach.rs line 1526 and crates/minimal/src/task.rs line 1909. BOX-193 is T131 — Skip and name each export that cannot be copied, and end a successful command with exit 125 #3445. BOX-195 and BOX-198 are T132 — Claim each export from the daemon before copying, and record a file_exported event for each #3446. Keep the flip condition that the comments state now.

Keep the tests this task and T134 (#3453) name passing. Do not rewrite history and do not force-push.

@agent-137
Copy link
Copy Markdown
Member

/revise This replaces the 03:38Z note, which started a round that produced no commit. Do two things.

  1. Merge origin/main into this branch and resolve the conflicts. feat(minimal): T128 — A real create sends the client's projection digest and store rules #3441 (T128) merged to main at about 04:10Z on 2026-11-16 and changed crates/minimal/src/cmd/boxes/create.rs and crates/minimal/src/tests.rs. Keep both sides' behaviour.

  2. Arch ruling 1320 on 7fbe33b set three conditions. Karl accepted this PR's size on 2026-11-16. Do all three. In full:

  • C1: crates/minimal/src/task.rs run_entry: in the copy_box_exports call after the box ended (lines 1918-1919), pass upload_root (the root that stamp_project_root put on the create request, so the record's project_root) as both project_root and here, in place of abs_path. abs_path is the folder the command ran in, and it is below the project root when the run starts in a subfolder.
  • C2: crates/minimal/src/tests.rs: add a test that drives the attached run's copy (run_entry, or a function that C1's call is moved into) from a folder below the project root, and asserts that the export is at <project root>/<path> and that nothing is at <subfolder>/<path>. The source-text check in detached_start_or_stop_copies_no_exports is not a proof that the attached run copies to the project root.
  • C3: Name the owning issue beside each requirement id in the interim comments: crates/minimal/src/cmd/boxes/exports.rs copy_box_exports doc (line 732), crates/minimal/src/cmd/boxes/wait.rs line 237, crates/minimal/src/cmd/boxes/attach.rs line 1526 and crates/minimal/src/task.rs line 1909. BOX-193 is T131 — Skip and name each export that cannot be copied, and end a successful command with exit 125 #3445. BOX-195 and BOX-198 are T132 — Claim each export from the daemon before copying, and record a file_exported event for each #3446. Keep the flip condition that the comments state now.

Keep the tests this task and T134 (#3453) name passing. Do not rewrite history and do not force-push. Add a merge commit.

@minimal-foundry
Copy link
Copy Markdown
Contributor Author

That /revise is held, not dropped. A coder is already running on #3444. Your note is kept and goes into the next round here, which starts when that coder finishes.

Nothing to type again: the command gets a rocket when its round starts, or a refusal that names the reason. No round was counted for it yet.

…d-that-waits-for-a-box-copies-its-decl

# Conflicts:
#	crates/minimal/src/tests.rs
The attached task run passed the folder the command ran in as the
export root. From a subfolder, the exports went below that folder.
The copy now takes the root stamped on the create request, and lives
in copy_ended_task_box_exports so a test can drive it from a
subfolder. The interim comments name the owning issues.
@minimal-foundry
Copy link
Copy Markdown
Contributor Author

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

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

line exit tail
cargo nextest run -p mfile export_path_outside_project_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
cargo nextest run -p minimal waiting_command_copies_file_exports_after_box_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 warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p minimal detached_start_or_stop_copies_no_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 directory_export_copies_its_tree_and_deletes_nothing 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 export_writes_each_file_atomically 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 timed out after 1800s.

crates/mlog)
    Checking async-dialog v0.0.1 (/workbench/crates/async-dialog)
   Compiling minvmd v0.8.0 (/workbench/crates/minvmd)
    Checking google-cloud-lro v1.11.0
   Compiling serial_test_derive v4.0.1
    Checking google-cloud-storage v1.20.0
    Checking serial_test v4.0.1
    Checking common v0.0.1 (/workbench/crates/common)
    Checking boxes v0.0.1 (/workbench/crates/boxes)
    Checking sandbox v0.0.1 (/workbench/crates/sandbox)
    Checking mfile v0.0.1 (/workbench/crates/mfile)
    Checking minimald-rpc v0.0.1 (/workbench/crates/minimald-rpc)
    Checking minimal-client v0.8.0 (/workbench/crates/minimal-client)
    Checking decode v0.0.1 (/workbench/crates/decode)
    Checking checkouts v0.0.1 (/workbench/crates/checkouts)
    Checking graph v0.0.1 (/workbench/crates/graph)
    Checking lcache v0.0.1 (/workbench/crates/lcache)
    Checking rcache v0.0.1 (/workbench/crates/rcache)
    Checking op v0.0.1 (/workbench/crates/op)
    Checking check v0.0.1 (/workbench/crates/check)
    Checking orchestrator v0.0.1 (/workbench/crates/orchestrator)
    Checking mctx v0.0.1 (/workbench/crates/mctx)
    Checking minimald v0.8.0 (/workbench/crates/minimald)
    Checking minimal v0.8.0 (/workbench/crates/minimal)
    Finished `dev` profile [unoptimized] target(s) in 3m 07s
   Compiling opentelemetry v0.33.1
   Compiling version v0.8.0 (/workbench/crates/version)
   Compiling stdlib v0.0.22 (/workbench/crates/stdlib)
   Compiling serial_test v4.0.1
   Compiling opentelemetry_sdk v0.33.1
   Compiling tracing-opentelemetry v0.34.0
   Compiling opentelemetry-http v0.33.1
   Compiling opentelemetry-appender-tracing v0.33.1
   Compiling google-cloud-gax-internal v0.7.20
   Compiling opentelemetry-proto v0.33.0
   Compiling opentelemetry-otlp v0.33.0
   Compiling mlog v0.0.1 (/workbench/crates/mlog)
   Compiling google-cloud-longrunning v1.14.0
   Compiling google-cloud-iam-v1 v1.13.0
   Compiling google-cloud-lro v1.11.0
   Compiling google-cloud-storage v1.20.0
   Compiling common v0.0.1 (/workbench/crates/common)
   Compiling boxes v0.0.1 (/workbench/crates/boxes)
   Compiling sandbox v0.0.1 (/workbench/crates/sandbox)
   Compiling mfile v0.0.1 (/workbench/crates/mfile)
   Compiling minimald-rpc v0.0.1 (/workbench/crates/minimald-rpc)
   Compiling minimal-client v0.8.0 (/workbench/crates/minimal-client)
   Compiling minvmd v0.8.0 (/workbench/crates/minvmd)
   Compiling decode v0.0.1 (/workbench/crates/decode)
   Compiling checkouts v0.0.1 (/workbench/crates/checkouts)
   Compiling graph v0.0.1 (/workbench/crates/graph)
   Compiling lcache v0.0.1 (/workbench/crates/lcache)
   Compiling rcache v0.0.1 (/workbench/crates/rcache)
   Compiling op v0.0.1 (/workbench/crates/op)
   Compiling orchestrator v0.0.1 (/workbench/crates/orchestrator)
   Compiling check v0.0.1 (/workbench/crates/check)
   Compiling mctx v0.0.1 (/workbench/crates/mctx)
   Compiling minimald v0.8.0 (/workbench/crates/minimald)
   Compiling minimal v0.8.0 (/workbench/crates/minimal)

Outside the task's layers::

  • crates/minimal/Cargo.toml
  • crates/minimal/src/cmd/boxes.rs

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

Review threads the coder judged:

A task box whose entry declares a file and a folder export ends, and the waiting command leaves both in the project. An attached run that starts in a subfolder now puts the exports at the project root, not in the subfolder. A detached run copies nothing. An export path outside the project fails before any box is created.

Notes from the agent: Merged origin/main (T128, #3441) in a merge commit. The only conflict was in crates/minimal/src/tests.rs, where both sides appended independent tests. I kept both blocks. create.rs merged without conflicts. C1: the attached run's copy moved into task::copy_ended_task_box_exports. That function takes upload_root, which is the root stamped on the create request, and passes it as both project_root and here. It keeps the check that the record shows the box ended. C2: the new test attached_run_from_subfolder_copies_exports_to_project_root resolves the root from /src/deep the way run_entry does, then drives copy_ended_task_box_exports against a harness daemon. It asserts that the file is at /out/report.txt and that the subfolder stays empty. The source-text check in detached_start_or_stop_copies_no_exports now looks for the new function name. C3: exports.rs, wait.rs, attach.rs and task.rs name #3445 beside BOX-193 and #3446 beside BOX-195 and BOX-198. Their flip conditions did not change. I could not find T134 (#3453) on main or on this branch, so I could not run its tests by name. The full minimal suite passed once at the end instead. I did not run just clippy-strict.

@minimal-foundry minimal-foundry Bot added the needs-human An agent handed off; a human must act, then clear this label. Set by defer and handoffs. label Nov 16, 2026
@minimal-foundry
Copy link
Copy Markdown
Contributor Author

The runtime will not revise this pull request again on its own: the diff is +1841/-9 (1850 lines), past 3x the plan's estimate of 580 lines (est: 280 code, 300 tests, as #3444 reads now), at round 2 (the last trigger was a /revise note). A person decides now. Remove needs-human from this pull request to let /revise <note> or the automatic rounds resume, or finish #3444 by hand.

@agent-137 agent-137 removed the needs-human An agent handed off; a human must act, then clear this label. Set by defer and handoffs. label Nov 16, 2026
@agent-137
agent-137 marked this pull request as ready for review November 16, 2026 07:20
@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/cmd/boxes/exports.rs Outdated
// The umask applies to this mode, as it does to `File::create`, so the
// file gets the default mode and not the 0600 of a temporary file.
#[cfg(unix)]
builder.permissions(std::os::unix::fs::PermissionsExt::from_mode(0o666));
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 write_file_atomically

The temporary file gets mode 0666 minus umask, and persist renames it over the destination. The box file's mode is never copied. An exported executable (a build output) loses its execute bit. An existing executable in the project also loses its bit when it is replaced. Copy the source mode, or keep the destination's mode, before persist.

What the reviewer checked

exports.rs: builder.permissions(PermissionsExt::from_mode(0o666)); no set_permissions or set_mode anywhere in the diff

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

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

Finding:
The temporary file gets mode 0666 minus umask, and `persist` renames it over the destination. The box file's mode is never copied. An exported executable (a build output) loses its execute bit. An existing executable in the project also loses its bit when it is replaced. Copy the source mode, or keep the destination's mode, before `persist`.

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
Member

Choose a reason for hiding this comment

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

Tracked in #3462: copying the source file's mode before the rename, with a test that exports an executable. Spec 29 does not bind the mode yet (BOX-188 binds only the atomic write), so that issue also decides whether it needs a requirement.

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 f8b5329bdb53: The temporary file now gets the box file's permission bits (from the file service metadata, minus the umask) before the rename, so an exported executable stays executable. The atomic-write test checks this.

@minimal-arch minimal-arch Bot left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

arch-review: PASS · the full ruling

The change conforms to the File exports rules in architecture.md, lines 508-516. At this head the attached run copies to the project root on the box record, not to the folder where the run started (line 511, line 514). Each interim comment now names its issue. Exit 125, the once-for-each-end claim, the file_exported event and the order of a several-box wait stay open as residuals #3445, #3446 and #3447. The PR body reports that cargo test --no-run failed. Make the build green before the merge.

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

The temporary file got 0666 minus the umask, so an exported
executable lost its execute bit when it was renamed into place.
@minimal-foundry
Copy link
Copy Markdown
Contributor Author

Round 1 of 10 on the runtime's review findings, pushed as f8b5329bdb53.

line exit tail
cargo nextest run -p mfile export_path_outside_project_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
cargo nextest run -p minimal waiting_command_copies_file_exports_after_box_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 warning: unknown fields in task runtime-implement-test-3: network warning: unknown fields in task runt
cargo nextest run -p minimal detached_start_or_stop_copies_no_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 directory_export_copies_its_tree_and_deletes_nothing 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 export_writes_each_file_atomically 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 timed out after 1800s.

king google-cloud-longrunning v1.14.0
    Checking google-cloud-iam-v1 v1.13.0
   Compiling minvmd v0.8.0 (/workbench/crates/minvmd)
    Checking google-cloud-lro v1.11.0
   Compiling serial_test_derive v4.0.1
    Checking google-cloud-storage v1.20.0
    Checking serial_test v4.0.1
    Checking common v0.0.1 (/workbench/crates/common)
    Checking boxes v0.0.1 (/workbench/crates/boxes)
    Checking sandbox v0.0.1 (/workbench/crates/sandbox)
    Checking mfile v0.0.1 (/workbench/crates/mfile)
    Checking minimald-rpc v0.0.1 (/workbench/crates/minimald-rpc)
    Checking minimal-client v0.8.0 (/workbench/crates/minimal-client)
    Checking decode v0.0.1 (/workbench/crates/decode)
    Checking checkouts v0.0.1 (/workbench/crates/checkouts)
    Checking graph v0.0.1 (/workbench/crates/graph)
    Checking lcache v0.0.1 (/workbench/crates/lcache)
    Checking rcache v0.0.1 (/workbench/crates/rcache)
    Checking op v0.0.1 (/workbench/crates/op)
    Checking check v0.0.1 (/workbench/crates/check)
    Checking orchestrator v0.0.1 (/workbench/crates/orchestrator)
    Checking mctx v0.0.1 (/workbench/crates/mctx)
    Checking minimald v0.8.0 (/workbench/crates/minimald)
    Checking minimal v0.8.0 (/workbench/crates/minimal)
    Finished `dev` profile [unoptimized] target(s) in 2m 53s
   Compiling opentelemetry v0.33.1
   Compiling version v0.8.0 (/workbench/crates/version)
   Compiling stdlib v0.0.22 (/workbench/crates/stdlib)
   Compiling serial_test v4.0.1
   Compiling opentelemetry_sdk v0.33.1
   Compiling tracing-opentelemetry v0.34.0
   Compiling opentelemetry-http v0.33.1
   Compiling opentelemetry-appender-tracing v0.33.1
   Compiling google-cloud-gax-internal v0.7.20
   Compiling opentelemetry-proto v0.33.0
   Compiling opentelemetry-otlp v0.33.0
   Compiling mlog v0.0.1 (/workbench/crates/mlog)
   Compiling google-cloud-longrunning v1.14.0
   Compiling google-cloud-iam-v1 v1.13.0
   Compiling google-cloud-lro v1.11.0
   Compiling google-cloud-storage v1.20.0
   Compiling common v0.0.1 (/workbench/crates/common)
   Compiling boxes v0.0.1 (/workbench/crates/boxes)
   Compiling sandbox v0.0.1 (/workbench/crates/sandbox)
   Compiling mfile v0.0.1 (/workbench/crates/mfile)
   Compiling minimald-rpc v0.0.1 (/workbench/crates/minimald-rpc)
   Compiling minvmd v0.8.0 (/workbench/crates/minvmd)
   Compiling minimal-client v0.8.0 (/workbench/crates/minimal-client)
   Compiling decode v0.0.1 (/workbench/crates/decode)
   Compiling checkouts v0.0.1 (/workbench/crates/checkouts)
   Compiling graph v0.0.1 (/workbench/crates/graph)
   Compiling lcache v0.0.1 (/workbench/crates/lcache)
   Compiling rcache v0.0.1 (/workbench/crates/rcache)
   Compiling op v0.0.1 (/workbench/crates/op)
   Compiling check v0.0.1 (/workbench/crates/check)
   Compiling orchestrator v0.0.1 (/workbench/crates/orchestrator)
   Compiling mctx v0.0.1 (/workbench/crates/mctx)
   Compiling minimald v0.8.0 (/workbench/crates/minimald)
   Compiling minimal v0.8.0 (/workbench/crates/minimal)

Outside the task's layers::

  • crates/minimal/Cargo.toml
  • crates/minimal/src/cmd/boxes.rs

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

Review threads the coder judged:

  • 👍 valid — crates/minimal/src/cmd/boxes/exports.rs: The temporary file now gets the box file's permission bits (from the file service metadata, minus the umask) before the rename, so an exported executable stays executable. The atomic-write test checks this.

A task box whose entry declares a file and a directory export ends, and the waiting command leaves both in the project, with the permission bits of the box's files. A detached run copies nothing. An export path outside the project fails before any box is created.

Notes from the agent: Revise round 1. The one open thread is valid. ExportSource has a new mode() read. BoxFiles reads it from the box's file service metadata. The temporary file gets those bits (masked to 0o777, then the umask), and falls back to 0666 when the box does not say. export_writes_each_file_atomically now also checks that an executable in the box stays executable when it replaces a 0644 file. cargo clippy -p minimal --all-targets is clean. I did not run just ci or just clippy-strict.

@minimal-foundry
minimal-foundry Bot marked this pull request as draft November 16, 2026 08:35
@minimal-foundry minimal-foundry Bot added the needs-human An agent handed off; a human must act, then clear this label. Set by defer and handoffs. label Nov 16, 2026
@minimal-foundry
Copy link
Copy Markdown
Contributor Author

The runtime will not revise this pull request again on its own: the diff is +1883/-9 (1892 lines), past 3x the plan's estimate of 580 lines (est: 280 code, 300 tests, as #3444 reads now), at round 1 (the last trigger was the runtime's review findings). A person decides now. Remove needs-human from this pull request to let /revise <note> or the automatic rounds resume, or finish #3444 by hand.

@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 still conforms to the File exports section of architecture.md, lines 508-518. The new commit gives an exported file the permission bits of the box's file. It masks them to 0o777, so no setuid bit reaches the project. The mode is set on the temporary file before the rename, so the copy stays whole-file as line 515 requires. The other parts keep the PASS on a7410f4.

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

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-human An agent handed off; a human must act, then clear this label. Set by defer and handoffs.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

T130 — The command that waits for a box copies its declared exports back to the project

1 participant

0