Skip to content

T62 — Relay a task's exit code and inputs through the in-box min helper - #2971

Merged
agent-137 merged 13 commits into
mainfrom
agent/2953-relay-a-task-s-exit-code-and-inputs-through-the
Nov 4, 2026
Merged

agent-137 merged 13 commits into
mainfrom
agent/2953-relay-a-task-s-exit-code-and-inputs-through-the

Conversation

@minimal-foundry

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

Copy link
Copy Markdown
Contributor

T62 — Relay a task's exit code and inputs through the in-box min helper

slice: S2
kind: task
covers: BOX-015
size: M
est: 220 code, 200 tests
executor: agent
difficulty: needs care
model: strongest
diagnostics: the daemon log names the task and the exit code it relays
observability: none: the task's run span already carries its exit code; this changes only what reaches it
layers:
- helper:
- crates/minimald/src/env.rs: run_task relays the task exit code; env vars, inherit_cwd and args reach the in-box run
- crates/minimald/src/env_min_helper.sh: min task run exits with the relayed code
test: cargo nextest run -p minimald task_entrypoint_relays_the_task_exit_code
test: cargo nextest run -p minimald task_entrypoint_carries_env_cwd_and_args
produces: none
consumes: none
proof: A task box's entrypoint exits with the task's own exit code, with its env vars, working directory and args.
depends on:
- blocked by #2398

Proof

In a box, min task run <task> [args...] (the entrypoint of a task box) now exits with the task's own exit code: 0 when the task passes, the failing command's code (for example 3, or 137 for SIGKILL) when it fails, and 1 when the run is refused before it starts. The task gets the caller's args with their spaces intact. Its inherit variables take the caller's exported values. An inherit_cwd task starts in the caller's directory under /workbench.

Notes from the agent: Wire change: the helper now sends run%<PWD> 0x1e <task> 0x1f <arg>... 0x1e <NAME=value> 0x1f ..., with backslash escapes for newline, CR and the two separators. The channel answers a run with exit:<code>. The channel still accepts the older run%<task> <args> line from a helper installed before this change, and it gives that helper the earlier error: replies. On a failed task the channel now sends only exit:<code>. It no longer sends the long 'Invocation N failed with exit code' report and 'error: sandbox command failed.', because the task's output already streamed. An inherit variable that the caller does not set is now dropped, not read from the daemon's environment (#585). The [vars] ignore policy of the host client is not applied on this path. The helper sends every exported variable, but the daemon uses only the names that the task declares as inherit. The helper lists exported names with compgen -e. A bash built without it sends no variables. An inherit_cwd task outside /workbench, or in a directory the session tree does not have, runs in /workbench, and the helper prints one new line: '

is not a directory under /workbench, so the task runs in /workbench.' Before this change inherit_cwd had no effect in a box, because the session layout ignores the working directory that make_env_with_network takes. So a run with a start directory spawns each invocation in run_invocations_in (env.rs) with current_dir. A run without one still goes through Env::run.…[truncated]

Tests

line exit tail
cargo nextest run -p minimald task_entrypoint_relays_the_task_exit_code 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-ada5... Compiling paths v0.0.1 (/workbench/crates/paths) Compiling args v0.0.1 (/workbench/crates/args) Compiling ot v0.0.1 (/workbench/crates/ot) Compiling client-config v0.0.1 (/wo
cargo nextest run -p minimald task_entrypoint_carries_env_cwd_and_args 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-dcd9... Compiling stdlib v0.0.22 (/workbench/crates/stdlib) Compiling version v0.8.0 (/workbench/crates/version) Compiling decode v0.0.1 (/workbench/crates/decode) Compiling mlog v0.

Verify

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

Closes #2953

Out-of-layer edit accepted by the maintainer (2026-11-04): crates/sandbox/src/listener.rs. The request-line trace redaction and the non-UTF-8 handling need it.

Out-of-layer edit accepted by the maintainer (2026-11-04): crates/sandbox/src/lib.rs. Channel::handle carries the listener's lossy-decode flag, which arch's non-UTF-8 condition needs.

Residuals

A task box's entrypoint is the in-box `min task run <task>`. It exited
0 or 1, whatever the task returned. The helper now sends its argv, its
$PWD and its exported variables, and the channel answers with
`exit:<code>`, which the helper exits with.

The channel fills the task's `inherit` variables from the caller's
environment, and starts an `inherit_cwd` task in the caller's directory
under /workbench. A helper that sends the older `<task> <args>` line
still gets the earlier replies. The daemon log names the task and the
code it relays.
@coderabbitai

coderabbitai Bot commented Nov 4, 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: 6f6752b2-035d-4d66-a974-afc526c083d9

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@minimal-foundry

minimal-foundry Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor Author

Approved: every review thread resolved at e7bc71ea6433.

@agent-137 resolved the last thread, which releases the approval this review had withheld.

Nothing to do.

@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/minimald/src/env_min_helper.sh 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 · 8 conditions · the full ruling

The relay of the task's exit code is in the correct owner and conforms to the Exit codes table, line 377. The helper fails open: a run that loses the channel exits 0 (C2). Refusals exit 1, not 4, 2 or 125 (C3). The new notice goes to stdout, the payload stream (C4). An unset inherit variable drops silently, but the laptop path refuses (C6). The daemon trace now logs the caller's whole environment, secrets included (C7, as in #2960). start_dir_in_box follows box symlinks onto the host (C8). C1 fixes the requirement id, and C5 files the open stdio gaps as a residual.

Outside the diff

  • crates/minimald/src/env.rs:1578: C7 · This trace now records the caller's whole environment, secrets included. Log only channel_method(request) (line 384, D9 line 795).

Ruled at 49d9e43 against gominimal/arch@7a86ec7bb3c0 by claude-opus-5-5.

Comment thread crates/minimald/src/env.rs Resolved
Comment thread crates/minimald/src/env_min_helper.sh Resolved
Comment thread crates/minimald/src/env.rs Resolved
Comment thread crates/minimald/src/env.rs Resolved
Comment thread crates/minimald/src/env.rs Resolved
Comment thread crates/minimald/src/env.rs Resolved
Comment thread crates/minimald/src/env.rs Resolved
A run stream that ends with no exit: or error: line lost its
connection. The helper now exits 1 with an error instead of 0.

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

The task's own exit code now reaches the caller, and a lost stream fails. Those parts conform. Every other path still exits 1. The design gives 4 for an unknown task, 2 for a usage error, and 125 for a min-side failure (Exit codes lines 363 to 371). C1 and C2 fix this. The task's stderr and the new inherit_cwd notice go to stdout. Line 400 and line 493 forbid this, and C3 fixes it. C4 asks for a residual for stdin, and C5 corrects covers: from BOX-015 to BCLI-010.

Ruled at 0030917 against gominimal/arch@7a86ec7bb3c0 by claude-opus-5-5.

Comment thread crates/minimald/src/env.rs Resolved
Comment thread crates/minimald/src/env.rs Resolved
Comment thread crates/minimald/src/env.rs Resolved
Comment thread crates/minimald/src/env.rs Resolved
Comment thread crates/minimald/src/env.rs Resolved
Comment thread crates/minimald/src/env.rs Resolved
Comment thread crates/minimald/src/env.rs Resolved
Comment thread crates/minimald/src/env_min_helper.sh Resolved
Comment thread crates/minimald/src/env_min_helper.sh Resolved

@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/minimald/src/env.rs Resolved
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

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

line exit tail
cargo nextest run -p minimald task_entrypoint_relays_the_task_exit_code 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-59d8... Compiling paths v0.0.1 (/workbench/crates/paths) Compiling args v0.0.1 (/workbench/crates/args) Compiling ot v0.0.1 (/workbench/crates/ot) Compiling client-config v0.0.1 (/wo
cargo nextest run -p minimald task_entrypoint_carries_env_cwd_and_args 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-fd65... Compiling stdlib v0.0.22 (/workbench/crates/stdlib) Compiling version v0.8.0 (/workbench/crates/version) Compiling decode v0.0.1 (/workbench/crates/decode) Compiling graph v0

Verify min task run agent-verify passed.

Review threads the coder judged:

  • 👍 valid — PRRT_kwDOPdfcxM6zZZ96: __min_rpc now returns 1 with an error for run when the stream ends with no exit: or error: line. The test task_entrypoint_relays_the_task_exit_code covers a truncated stream, a done: line and an empty stream. (not posted on the thread: not an open thread on the pull request)

A task box's entrypoint (min task run) exits with the task's own exit code and gets the caller's env vars, working directory and args. When the connection ends before the task reports an exit status, the entrypoint now exits 1 with an error, not 0.

Notes from the agent: Revise round 1: the helper's run path now returns 1 and prints 'error: the connection closed before the task reported its exit status' when the stream ends with no exit: or error: line. This includes a stream that ends with a done: line. The relays-exit test covers three such replies.

@mitodrummer

Copy link
Copy Markdown
Member

/revise

Arch's conditions on 0030917e, all inside this task's two files:

  1. Give each refusal of a relaying run its design exit code (C1). In crates/minimald/src/env.rs BoxChannel::run_task, when request.relays_exit(), follow each refusal with an exit:<code> line:

    • exit:4 after error: no such task '<task>'
    • exit:2 after error: failed parsing arguments for task
    • exit:2 after error: cannot run interactive tasks from within an environment
    • exit:125 after every min-side failure: the refresh failure, a ctx.task Err, error: session is gone, and the write_error fallthrough when relayed_exit_code is None

    In crates/minimald/src/env_min_helper.sh __min_rpc, for method == run, keep reading after an error: line, and return the relayed code before the error == true check. An older helper still breaks on error: and ignores the new line. Update the assertion at env.rs ~4289 to expect 4.

  2. A run stream with no exit: line exits 125, not 1 (C2). In env_min_helper.sh, change the return 1 after error: the connection closed before the task reported its exit status (~214) to return 125. Do the same for a run whose error: line has no exit: line after it. Update the three assertions in the loop at env.rs ~4300 to expect 125.

  3. Keep stderr and helper lines off stdout for a relaying run (C3). Add an err: reply tag that __min_rpc prints with >&2. In env.rs, when request.relays_exit():

    • run_invocations_in forwards the stderr pipe (~3081) as err: lines;
    • the second writer of StreamWriter::pair on the Env::run path emits err:;
    • the inherit_cwd notice (~2161), the argument-parse usage lines and the write_error lines go as err:, not msg:.

    Keep msg: for an older helper (TaskRunArgs::Line). Add a test that a task writing to stderr leaves the helper's stdout empty.

  4. Traceability (C5). Change the BOX-015 (T62) comments at env.rs ~2238, ~4233 and ~4308 to BCLI-010 (T62). In the PR body, say that this change implements BCLI-010 (docs/specs/28-spec-box-cli, "exit with the exit code of the entrypoint").

  5. Residual (C4). Add a ## Residuals section to the PR body: the in-box min task run does not wire the caller's stdin to the task, because __min_rpc feeds socat only the request line. T7 — Run an entry with its stdio and its exit code #2892 (BCLI T7, which passes stdin and stdout through) owns it.

A relaying min task run now ends each refusal with an exit line: 4 for
an unknown task, 2 for bad arguments, an interactive task or a missing
inherit variable, and 125 for a failure of min itself. A stream with no
exit line exits 125. The task's stderr and min's notes go as err: lines,
which the helper prints on stderr. An inherit_cwd directory must resolve
under the box's tree.

@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: 2 of 3 personas ran (correctness, security); did not complete: supply-chain.

Comment thread crates/minimald/src/env_min_helper.sh 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 compare fixes the refusal exit codes and moves stderr and notes off stdout. It now conforms to Exit codes lines 365, 371 and 377, and to line 493. One gap is new. A broken minimal.toml in the box makes min task run exit 125. Exit codes line 364 gives invalid configuration exit 3, and the laptop min already exits 3 for it. Make the change in C1. Then the change conforms. The plan's covers: BOX-015 names the idle-stop rule, so I escalate that correction.

Ruled at f9f8841 against gominimal/arch@7a86ec7bb3c0 by claude-opus-5-5.

Comment thread crates/minimald/src/env.rs Resolved
Comment thread crates/minimald/src/env.rs Resolved
Comment thread crates/minimald/src/env.rs Resolved
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

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

line exit tail
cargo nextest run -p minimald task_entrypoint_relays_the_task_exit_code 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-5cd6... Compiling paths v0.0.1 (/workbench/crates/paths) Compiling args v0.0.1 (/workbench/crates/args) Compiling ot v0.0.1 (/workbench/crates/ot) Compiling client-config v0.0.1 (/wo
cargo nextest run -p minimald task_entrypoint_carries_env_cwd_and_args 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-5187... Compiling stdlib v0.0.22 (/workbench/crates/stdlib) Compiling version v0.8.0 (/workbench/crates/version) Compiling decode v0.0.1 (/workbench/crates/decode) Compiling mlog v0.

Verify min task run agent-verify passed.

Review threads the coder judged:

  • 👍 valid — crates/minimald/src/env.rs: The ID is wrong, but BCLI-010 replaces it, not BCLI-035, per the later thread and the /revise note. The comments at run_task and the two tests now say BCLI-010 (T62).
  • 👍 valid — crates/minimald/src/env_min_helper.sh:217: A run with no exit: line now returns 125 in __min_rpc. A refused run with no exit: line also returns 125.
  • 👍 valid — crates/minimald/src/env.rs: For a relaying run, write_error is now followed by exit:125, an unknown task by exit:4, and the interactive refusal by exit:2.
  • 👍 valid — crates/minimald/src/env.rs: For a relaying run, the inherit_cwd notice goes as err:. __min_rpc prints err: lines with >&2.
  • 👍 valid — crates/minimald/src/env.rs: For a relaying run, stderr now goes as err: lines. The stdin gap stays a residual that T7 — Run an entry with its stdio and its exit code #2892 owns. The PR body must name it, and the runner writes the body.
  • 👍 valid — crates/minimald/src/env.rs: inherit_from_caller now returns Err(name). run_task refuses the run with the laptop's text from crates/minimal/src/task.rs, followed by exit:2.
  • 👍 valid — crates/minimald/src/env.rs: start_dir_in_box now canonicalizes both paths and accepts the directory only under the canonical working tree. A test covers a symlink that points out of the tree.
  • 👍 valid — crates/minimald/src/env.rs:2129: An unknown task now sends exit:4 after the error line for a relaying run, so the helper exits 4.
  • 👍 valid — crates/minimald/src/env.rs: write_error_tagged is now followed by exit:125 when the request relays exit codes.
  • 👍 valid — crates/minimald/src/env.rs: The notice goes as err: for a relaying run. The helper prints err: lines on stderr.
  • 👍 valid — crates/minimald/src/env.rs: run_invocations_in now forwards the stderr pipe as err: lines for a relaying run (forward_lines takes a tag).
  • 👍 valid — crates/minimald/src/env.rs: The test now expects 4 for an unknown task that has an exit:4 line. Cases for 2 and 125 are added.
  • 👍 valid — crates/minimald/src/env.rs: The loop for a stream with no exit: line now expects 125.
  • 👍 valid — crates/minimald/src/env.rs: The comments at run_task and at the two test doc comments now say BCLI-010 (T62).
  • 👍 valid — crates/minimald/src/env_min_helper.sh: For a run, __min_rpc reads on after an error: line, and the relayed code is checked before the error flag.
  • 👍 valid — crates/minimald/src/env_min_helper.sh:229: The dropped-connection path now returns 125.
  • 👎 invalid — PRRT_kwDOPdfcxM6zZjVZ: One loop needs a working-directory option on Sandbox::run_with_cancel in crates/sandbox/src/lib.rs. That file is outside this task's layers (env.rs and env_min_helper.sh). The empty stdout/stderr tails on an inherit_cwd failure are real, so the sandbox option needs a task of its own. (not posted on the thread: not an open thread on the pull request)

In a task box, min task run <task> exits with the task's own exit code. It exits 4 for an unknown task. It exits 2 for bad arguments, an interactive task or a missing inherit variable. It exits 125 when min fails or the connection drops. The task's stderr and min's notes reach stderr, so stdout carries only the task's output. The task gets the caller's env vars, working directory and args.

Notes from the agent: Directive items 4 and 5 are PR-body edits. The runner writes the body, so I did not make them. The body must say: this change implements BCLI-010 (docs/specs/28-spec-box-cli, 'exit with the exit code of the entrypoint'). It also needs a '## Residuals' section: the in-box min task run does not wire the caller's stdin to the task, because __min_rpc feeds socat only the request line. #2892 (BCLI T7) owns that. Choices to review: (1) refresh failures in run_task now send their report as err: lines through a new refresh_tagged. Other channel methods keep refresh and msg:. (2) A missing inherit variable (C6) now refuses the run with the laptop's text from crates/minimal/src/task.rs, followed by exit:2. The directive gives no code for that case, so I chose 2. That text has a semicolon, which the printed-text rule rejects. I copied it as it is, so that the two surfaces print the same sentence. (3) The daemon log now records the task and the exit code for each refusal (relay_refusal_exit), and for each relayed task exit, as before. I did not run clippy-strict or the whole crate suite.

@mitodrummer

Copy link
Copy Markdown
Member

/revise

Arch's condition on f9f88412 (C1): a project configuration failure exits 3, not 125.

  • In crates/minimald/src/env.rs, add const EXIT_CONFIG: u8 = 3; beside EXIT_MIN_FAILURE.
  • Change refresh_tagged() to return the Error it reports (for example Result<_, Error>, after it writes the report lines), in place of Err(()).
  • Add fn refusal_exit_code(e: &Error) -> u8. It returns EXIT_CONFIG for Error::Config, Error::Format and Error::MFile, and EXIT_MIN_FAILURE for every other variant.
  • In run_task(), use refusal_exit_code(&e) in place of EXIT_MIN_FAILURE in three places: the refresh_tagged failure (~2120), the ctx.task Err(e) arm (~2126), and the final if let Err(e) = result arm. Keep 125 for session is gone and every other error.
  • In task_entrypoint_relays_the_task_exit_code, add the reply case "err:report\nerror: sandbox command failed.\nexit:3\n", expecting 3.
  • Add a unit test of refusal_exit_code: Error::Format gives 3, and Error::Other gives 125.

A refused in-box min task run with a project configuration error
(Config, Format or MFile) now exits 3, not 125. refresh_tagged returns
the Error it reports so run_task can map it.

The channel trace log also cuts a run request's environment group, so
exported secrets do not reach the host log.

@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/minimald/src/env.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 compare gives a configuration refusal exit 3 and keeps the run environment out of the trace log. Both conform to lines 364 and 972 of architecture.md. One gap is open. A package layer that does not evaluate reaches refusal_exit_code as Error::Graph and exits 125. The doc comment for EXIT_CONFIG and line 364 say that this error is exit 3. A missing package exits 125, but line 365 gives it 4. Make the change in C1.

Ruled at 30d5a59 against gominimal/arch@7a86ec7bb3c0 by claude-opus-5-5.

Comment thread crates/minimald/src/env.rs Resolved
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

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

line exit tail
cargo nextest run -p minimald task_entrypoint_relays_the_task_exit_code 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-a399... Compiling paths v0.0.1 (/workbench/crates/paths) Compiling args v0.0.1 (/workbench/crates/args) Compiling ot v0.0.1 (/workbench/crates/ot) Compiling client-config v0.0.1 (/wo
cargo nextest run -p minimald task_entrypoint_carries_env_cwd_and_args 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-9dbd... Compiling stdlib v0.0.22 (/workbench/crates/stdlib) Compiling version v0.8.0 (/workbench/crates/version) Compiling decode v0.0.1 (/workbench/crates/decode) Compiling mlog v0.

Verify min task run agent-verify passed.

Review threads the coder judged:

  • 👍 valid — PRRT_kwDOPdfcxM6za77y: The channel trace log in BoxChannel::run now cuts a run request's env group (loggable_request, with a test). The same log in crates/sandbox/src/listener.rs:72 is outside this task's layers and needs a follow-up. (not posted on the thread: not an open thread on the pull request)
  • 👍 valid — crates/minimald/src/env.rs: refresh_tagged returns the Error it reports, and run_task exits with refusal_exit_code(&e): 3 for a config error.
  • 👍 valid — crates/minimald/src/env.rs: The ctx.task Err arm and the final Err arm now use refusal_exit_code(&e).
  • 👍 valid — crates/minimald/src/env.rs:3088: Added const EXIT_CONFIG: u8 = 3 and fn refusal_exit_code, which maps Config, Format and MFile to 3 and every other variant to 125.

A task box's entrypoint (the in-box min task run) exits with the task's own exit code, and the task gets the caller's env vars, working directory and args. A refusal for a project configuration error now exits 3, and other min-side failures exit 125.

Notes from the agent: Revise round 3. I added EXIT_CONFIG = 3 and refusal_exit_code(). refresh_tagged now returns the Error it reports, and refresh() maps it to (). run_task uses refusal_exit_code at the refresh_tagged failure, the ctx.task Err arm and the final Err arm. 'session is gone' keeps 125. Deviation: the directive asks the refusal_exit_code unit test (refusal_exit_code_gives_a_config_error_exit_3) to use Error::Format. minimald has no toml dependency, so it cannot build a toml::de::Error. The test uses Error::Config(ConfigError::InvalidRemoteCacheUrl) for the code-3 case and Error::Other for 125. A Format case needs toml as a dev-dependency in crates/minimald/Cargo.toml, which is outside the layers. For the security thread, the BoxChannel::run trace log now prints the request through loggable_request(), which replaces a run request's environment group with ''. A test pins this: loggable_request_cuts_the_run_environment. The same leak remains in crates/sandbox/src/listener.rs:72 (listener received), which is outside this task's layers. A follow-up must redact it there. I applied cargo fmt after the test runs. It changed only layout. clippy -p minimald --all-targets is clean.

@mitodrummer

Copy link
Copy Markdown
Member

/revise

Arch's condition on 30d5a594 (C1). In crates/minimald/src/env.rs refusal_exit_code() (~3096), add an Error::Graph(g) arm that matches on *g:

  • graph::Error::Decode, ConflictingPackage, ConflictingProfile, ConflictingStack, ConflictingContainer, UpstreamNotPinned and NoSuchOutput → EXIT_CONFIG (3).
  • NoSuchPkg, NoSuchProfile and NoSuchStack → EXIT_NOT_FOUND (4).
  • Fetch and every other error stay EXIT_MIN_FAILURE (125).

Today a Nickel package layer that does not evaluate reaches refresh_tagged as Error::Graph(Decode) and exits 125, though the EXIT_CONFIG doc comment says a package file is exit 3. Extend refusal_exit_code_gives_a_config_error_exit_3 with one Error::Graph case each for 3, 4 and 125.

A package layer that does not evaluate reaches refresh_tagged as
Error::Graph(Decode). It now exits 3, as a config error does. A missing
package, profile or stack exits 4. A fetch failure stays 125.

@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 compare closes the refusal exit codes. A graph error now exits 3 for a bad layer and 4 for a missing package, profile or stack (Exit codes lines 364, 365). A fetch failure exits 125 (line 371). The match covers every graph::Error variant. The rest of the change relays the task's own code and keeps stdout for the task's output, as lines 39, 377 and 493 require. No condition is open. Correct the plan's covers: BOX-015 to BCLI-010 when you next edit the plan.

Ruled at 27636d9 against gominimal/arch@7a86ec7bb3c0 by claude-opus-5-5.

@minimal-foundry minimal-foundry Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

minimal-review — approval withheld

Verdict COMMENT — APPROVE withheld: 21 unresolved threads — minimal-arch[bot] crates/minimald/src/env.rs, minimal-arch[bot] crates/minimald/src/env_min_helper.sh:217, minimal-arch[bot] crates/minimald/src/env.rs, minimal-arch[bot] crates/minimald/src/env.rs, minimal-arch[bot] crates/minimald/src/env.rs, …. No findings.

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

@minimal-foundry

Copy link
Copy Markdown
Contributor Author

Round 4 of 10 on a /revise note, pushed as 27636d9adf91.

line exit tail
cargo nextest run -p minimald task_entrypoint_relays_the_task_exit_code 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-16c3... Compiling paths v0.0.1 (/workbench/crates/paths) Compiling args v0.0.1 (/workbench/crates/args) Compiling ot v0.0.1 (/workbench/crates/ot) Compiling client-config v0.0.1 (/wo
cargo nextest run -p minimald task_entrypoint_carries_env_cwd_and_args 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-55dc... Compiling stdlib v0.0.22 (/workbench/crates/stdlib) Compiling version v0.8.0 (/workbench/crates/version) Compiling decode v0.0.1 (/workbench/crates/decode) Compiling mlog v0.

Verify min task run agent-verify passed.

Review threads the coder judged:

  • 👎 invalid — crates/minimald/src/env.rs:1590: Outside this task's layers. listener.rs:72 does trace the raw request line, env included, before BoxChannel::run redacts it. The fix belongs in crates/sandbox/src/listener.rs, which T62 does not name. It needs its own task to redact or drop that trace line.
  • 👍 valid — crates/minimald/src/env.rs:3099: Added an Error::Graph arm: Decode, Conflicting*, UpstreamNotPinned and NoSuchOutput exit 3. NoSuchPkg/Profile/Stack exit 4. Fetch exits 125. The test has one Graph case for each code.

A task box's entrypoint exits with the task's own exit code, with its env vars, working directory and args. A refused in-box min task run now exits 3 when a package layer does not evaluate or conflicts, 4 when a package, profile or stack is missing, and 125 for a fetch failure.

Notes from the agent: This round adds an Error::Graph arm to refusal_exit_code() and extends its test with one case each for 3, 4 and 125. The match on graph::Error has no wildcard, so a new graph variant must get an exit code at compile time. cargo clippy -p minimald --all-targets and cargo fmt --check are clean. The listener finding (PRRT_kwDOPdfcxM6zbUrc) is real, but its fix is in crates/sandbox/src/listener.rs, which is outside this task's layers. A follow-up task must redact or drop the trace line there.

@mitodrummer

Copy link
Copy Markdown
Member

/revise

From the maintainer's pre-merge review at 27636d9a. The maintainer accepts the out-of-layer edit to crates/sandbox/src/listener.rs that items 1 and 2 need.

  1. Don't log raw request lines (security, the open minimal-review HIGH). crates/sandbox/src/listener.rs ~72 does tracing::trace!("listener received: {}", line) before loggable_request (env.rs ~1577) redacts it. Every run now carries the caller's whole exported environment, so under trace logging every box secret reaches the minimald log and diag bundles. Log only the redacted form (loggable_request), or the method and length, never the raw line. Add a test that a run request's env values don't appear in the trace output.
  2. Read request lines as bytes. The listener uses BufReader::lines(), which errors on invalid UTF-8 and drops the connection. So one non-UTF-8 exported variable, or $PWD, makes every in-box min task run exit 125. Read bytes and decode lossily in the listener, or have the helper skip variables that aren't valid UTF-8. Add a test with a non-UTF-8 env value.
  3. Keep protocol lines out of echoed text. error: no such task '{task_name}' (env.rs ~2140, ~2173–2175) and the cwd notice (~2186, ~3055) echo unescaped text after \n is unescaped. A task name containing \nexit:0 makes the helper exit 0 for a task that doesn't exist. Escape or drop newlines in any echoed name or path.
  4. printf '%s\n', not echo. In env_min_helper.sh (~166 msg:, ~175 err:), echo "$rest" drops a line that is exactly -n and mangles -E.
  5. Refresh the PR body. It's truncated and stale. The refusal codes are now 2, 3, 4 and 125, not 1. An unset inherit variable is refused with exit 2, not dropped. Add ## Residuals:

The listener traced each request line before the channel redacted it,
so a run request's environment reached the trace log. It also read with
lines(), which dropped a request that held a non-UTF-8 byte. It now logs
only the length and decodes the line lossily. The in-box helper prints
relayed lines with printf, not echo.
A task name or a $PWD with a newline in it, echoed in the no-such-task
refusal or the inherit_cwd notice, started a protocol line of its own,
so a name ending in exit:0 made the helper exit 0. Control characters
in them are now escaped. Tests pin the escape and the printf output.

@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 listener and one_line() changes conform. The trace no longer leaks the caller's environment, and an echoed name cannot end the run. One change deviates. serve_connection() now decodes an invalid byte as U+FFFD, and the task runs with an altered inherit value or argument. On a laptop, min task run refuses a non-UTF-8 inherit value. Line 395 of architecture.md says the in-box form behaves exactly as on a laptop. Make the change in C1. Then the change conforms.

Ruled at 15a166e against gominimal/arch@7a86ec7bb3c0 by claude-opus-5-5.

Comment thread crates/sandbox/src/listener.rs Resolved
Comment thread crates/minimald/src/env.rs Resolved

@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: 23 unresolved threads — minimal-arch[bot] crates/minimald/src/env.rs, minimal-arch[bot] crates/minimald/src/env_min_helper.sh:217, minimal-arch[bot] crates/minimald/src/env.rs, minimal-arch[bot] crates/minimald/src/env.rs, minimal-arch[bot] crates/minimald/src/env.rs, …. No findings.

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

@minimal-foundry

Copy link
Copy Markdown
Contributor Author

Round 5 of 10 on a /revise note, pushed as 15a166e4b865.

line exit tail
cargo nextest run -p minimald task_entrypoint_relays_the_task_exit_code 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-1d19... Compiling paths v0.0.1 (/workbench/crates/paths) Compiling args v0.0.1 (/workbench/crates/args) Compiling ot v0.0.1 (/workbench/crates/ot) Compiling client-config v0.0.1 (/wo
cargo nextest run -p minimald task_entrypoint_carries_env_cwd_and_args 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-7d2a... Compiling stdlib v0.0.22 (/workbench/crates/stdlib) Compiling version v0.8.0 (/workbench/crates/version) Compiling decode v0.0.1 (/workbench/crates/decode) Compiling mlog v0.

Verify min task run agent-verify exited 100 under rustc 1.99.0, which the repository does not pin (1.99.1 in rust-toolchain.toml); the PR is not a draft on that alone — CI, which honours the pin, is the gate.

 PASS [   0.007s] (1392/1405) sandbox tests::the_tap_descriptor_goes_to_the_provider_once
        PASS [   0.007s] (1393/1405) sandbox tests::userns_restricted_and_unconfined_is_diagnosed
        PASS [   0.007s] (1394/1405) sandbox tests::userns_restricted_but_confined_is_clear
        PASS [   0.006s] (1395/1405) sandbox tests::userns_restricted_but_root_is_clear
        PASS [   0.006s] (1396/1405) sandbox tests::userns_restricted_with_unreadable_label_is_diagnosed
        PASS [   0.007s] (1397/1405) sandbox tests::userns_unrestricted_is_clear
        PASS [   0.006s] (1398/1405) sandbox tests::userns_zero_or_missing_quota_is_disabled
        PASS [   0.010s] (1399/1405) sandbox tests::write_hosts_concurrent_writers_lose_nothing
        PASS [   0.007s] (1400/1405) sandbox tests::write_hosts_strips_ipv6_without_plan_entries
        FAIL [   0.323s] (1401/1405) sandbox::caps_root_integration boxes_lack_cap_net_raw
  stdout ───

    running 1 test
    test boxes_lack_cap_net_raw ... FAILED

    failures:

    failures:
        boxes_lack_cap_net_raw

    test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 1 filtered out; finished in 0.32s

  stderr ───
    box base: /run (refused: /tmp: the filesystem is mounted nodev, so the read-only remounts hakoniwa does on every rootfs subdirectory inside the user namespace are refused with EPERM; /var/tmp: cannot create a temp dir here: No such file or directory (os error 2) at path "/var/tmp/.tmpQcxcRu")
    box base: /run (refused: /tmp: the filesystem is mounted nodev, so the read-only remounts hakoniwa does on every rootfs subdirectory inside the user namespace are refused with EPERM; /var/tmp: cannot create a temp dir here: No such file or directory (os error 2) at path "/var/tmp/.tmpN6JoNT")

    thread 'boxes_lack_cap_net_raw' (8078) panicked at crates/sandbox/tests/caps_root_integration.rs:525:5:
    assertion `left == right` failed: a none box's family filter must still refuse the socket family itself, seal and credentials together in the same launch
      left: 1
     right: 97
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

  Cancelling due to test failure: 3 tests still running
        PASS [   5.169s] (1402/1405) minimald::otel_shutdown_integration a_connection_open_at_shutdown_still_exports_its_span
        PASS [   0.880s] (1403/1405) sandbox tests::every_box_has_its_own_ipc_namespace
        SLOW [>120.000s] (─────────) minimald exec::tests::end_to_end::exec_request_scrubs_credentials_from_log
        PASS [ 134.835s] (1404/1405) minimald exec::tests::end_to_end::exec_request_scrubs_credentials_from_log
────────────
     Summary [ 277.616s] 1404/1405 tests run: 1403 passed (1 slow, 1 leaky), 1 failed, 24 skipped
        FAIL [   0.323s] (1401/1405) sandbox::caps_root_integration boxes_lack_cap_net_raw
warning: 1/1405 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/sandbox/src/listener.rs

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

A task box's entrypoint (the in-box min task run) exits with the task's own exit code, and the task gets the caller's env vars, working directory and args. A run request no longer reaches the trace log with its environment, a non-UTF-8 variable or $PWD no longer makes the run exit 125, and a task name or path with a newline cannot fake an exit: line.

Notes from the agent: Round 5 note items. (1) crates/sandbox/src/listener.rs, outside the layers, accepted by the maintainer: the listener now traces only the request length ('listener received a request', bytes=N). The channel still logs the redacted form through loggable_request. Test listener_trace_leaves_out_the_run_environment captures the trace output with a recording subscriber and checks that the env name and value are absent. (2) The listener reads the request with read_until(b'\n') and decodes it with String::from_utf8_lossy, so a non-UTF-8 byte becomes U+FFFD and the request is served. Test listener_serves_a_request_with_a_non_utf8_value. The per-connection code moved into serve_connection so a test can drive it on its own thread. (3) env.rs: new one_line() escapes control characters (escape_debug) in the task name of the no-such-task refusal and in the $PWD of the inherit_cwd notice. Tests in both task_entrypoint_ tests. (4) env_min_helper.sh: msg:, err: and error: lines and the request line now print with printf '%s\n', not echo. The relay test pins that a 'msg:-n' line prints '-n' and an 'err:-E' line prints '-E'. (5) The PR body is the runner's to write. For it: the refusal exit codes are 2 (usage, interactive task, unset inherit variable), 3 (invalid configuration), 4 (task or package not found) and 125 (min failed, or the stream ended with no exit: line). An unset inherit variable is refused with exit 2, not dropped. ## Residuals: #2892 (BCLI T7) the in-box stdin relay (arch C5); #2983 one run path for inherit_cwd, plus the trailing-line flush. I did not run just clippy-strict or the whole …[truncated]

@minimal-foundry
minimal-foundry Bot marked this pull request as draft November 4, 2026 04:25
@mitodrummer
mitodrummer marked this pull request as ready for review November 4, 2026 04:31
@mitodrummer

Copy link
Copy Markdown
Member

/revise

Arch's condition on 15a166e4 (C1). The maintainer's acceptance of crates/sandbox/src/listener.rs stands.

  • crates/sandbox/src/listener.rs serve_connection() keeps the lossy decode. It also tells the channel which bytes were not valid UTF-8: pass the raw bytes, or a lossy flag, through Channel::handle.
  • crates/minimald/src/env.rs run_task() refuses the run with EXIT_USAGE (2) when a value that inherit_from_caller() takes from request.env held an invalid byte. It does the same for an argv item of TaskRunRequest. For the inherit case, send the text the laptop prints when std::env::var returns NotUnicode (crates/minimal/src/task.rs ~256–261).
  • An exported variable that the task does not declare still neither refuses nor drops the run.
  • Pin both refusals, and the pass for an undeclared variable, in tests next to listener_serves_a_request_with_a_non_utf8_value.

The listener still decodes a request lossily, and now hands the raw bytes
of a line that was not valid UTF-8 to the channel through a new
Channel::handle_lossy hook. run_task refuses the run with exit 2 when a
declared inherit value or an argument held an invalid byte, with the
laptop's text for the inherit case. An undeclared variable still neither
refuses nor drops the run.

@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 compare adds one branch commit. It refuses a declared inherit value or an argument that is not valid UTF-8, with exit 2. Before this commit, the lossy value reached the task. The inherit refusal uses the laptop's text, so the in-box run behaves as the laptop does (architecture.md line 395). The refusal goes to stderr, so stdout carries only the task output (line 493). The maintainer note names only listener.rs. The new hook in crates/sandbox/src/lib.rs is in the trait's owner crate, so the design has no objection.

Ruled at e7bc71e against gominimal/arch@7a86ec7bb3c0 by claude-opus-5-5.

@minimal-foundry minimal-foundry Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

minimal-review — approval withheld

Verdict COMMENT — APPROVE withheld: 23 unresolved threads — minimal-arch[bot] crates/minimald/src/env.rs, minimal-arch[bot] crates/minimald/src/env_min_helper.sh:217, minimal-arch[bot] crates/minimald/src/env.rs, minimal-arch[bot] crates/minimald/src/env.rs, minimal-arch[bot] crates/minimald/src/env.rs, …. No findings.

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

@minimal-foundry

Copy link
Copy Markdown
Contributor Author

Round 6 of 10 on a /revise note, pushed as e7bc71ea6433.

line exit tail
cargo nextest run -p minimald task_entrypoint_relays_the_task_exit_code 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-311e... Compiling paths v0.0.1 (/workbench/crates/paths) Compiling ot v0.0.1 (/workbench/crates/ot) Compiling args v0.0.1 (/workbench/crates/args) Compiling client-config v0.0.1 (/wo
cargo nextest run -p minimald task_entrypoint_carries_env_cwd_and_args 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-20d3... Compiling stdlib v0.0.22 (/workbench/crates/stdlib) Compiling version v0.8.0 (/workbench/crates/version) Compiling decode v0.0.1 (/workbench/crates/decode) Compiling mlog v0.

Verify min task run agent-verify exited 100 under rustc 1.99.0, which the repository does not pin (1.99.1 in rust-toolchain.toml); the PR is not a draft on that alone — CI, which honours the pin, is the gate.

 PASS [   0.006s] (1409/1422) sandbox tests::the_tap_descriptor_goes_to_the_provider_once
        PASS [   0.005s] (1410/1422) sandbox tests::userns_restricted_and_unconfined_is_diagnosed
        PASS [   0.005s] (1411/1422) sandbox tests::userns_restricted_but_confined_is_clear
        PASS [   0.005s] (1412/1422) sandbox tests::userns_restricted_but_root_is_clear
        PASS [   0.006s] (1413/1422) sandbox tests::userns_restricted_with_unreadable_label_is_diagnosed
        PASS [   0.009s] (1414/1422) sandbox tests::userns_unrestricted_is_clear
        PASS [   0.008s] (1415/1422) sandbox tests::userns_zero_or_missing_quota_is_disabled
        PASS [   0.010s] (1416/1422) sandbox tests::write_hosts_concurrent_writers_lose_nothing
        PASS [   0.008s] (1417/1422) sandbox tests::write_hosts_strips_ipv6_without_plan_entries
        FAIL [   0.306s] (1418/1422) sandbox::caps_root_integration boxes_lack_cap_net_raw
  stdout ───

    running 1 test
    test boxes_lack_cap_net_raw ... FAILED

    failures:

    failures:
        boxes_lack_cap_net_raw

    test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 1 filtered out; finished in 0.30s

  stderr ───
    box base: /run (refused: /tmp: the filesystem is mounted nodev, so the read-only remounts hakoniwa does on every rootfs subdirectory inside the user namespace are refused with EPERM; /var/tmp: cannot create a temp dir here: No such file or directory (os error 2) at path "/var/tmp/.tmpKzksEm")
    box base: /run (refused: /tmp: the filesystem is mounted nodev, so the read-only remounts hakoniwa does on every rootfs subdirectory inside the user namespace are refused with EPERM; /var/tmp: cannot create a temp dir here: No such file or directory (os error 2) at path "/var/tmp/.tmpfgjOZJ")

    thread 'boxes_lack_cap_net_raw' (8091) panicked at crates/sandbox/tests/caps_root_integration.rs:525:5:
    assertion `left == right` failed: a none box's family filter must still refuse the socket family itself, seal and credentials together in the same launch
      left: 1
     right: 97
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

  Cancelling due to test failure: 3 tests still running
        PASS [   0.750s] (1419/1422) sandbox tests::every_box_has_its_own_ipc_namespace
        PASS [   5.145s] (1420/1422) minimald::otel_shutdown_integration a_connection_open_at_shutdown_still_exports_its_span
        SLOW [>120.000s] (─────────) minimald exec::tests::end_to_end::exec_request_scrubs_credentials_from_log
        PASS [ 133.938s] (1421/1422) minimald exec::tests::end_to_end::exec_request_scrubs_credentials_from_log
────────────
     Summary [ 269.701s] 1421/1422 tests run: 1420 passed (1 slow, 1 leaky), 1 failed, 25 skipped
        FAIL [   0.306s] (1418/1422) sandbox::caps_root_integration boxes_lack_cap_net_raw
warning: 1/1422 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/sandbox/src/lib.rs
  • crates/sandbox/src/listener.rs

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

Review threads the coder judged:

  • 👍 valid — crates/sandbox/src/listener.rs: The listener keeps the lossy decode, and passes the raw bytes of a non-UTF-8 line to the channel through the new Channel::handle_lossy.
  • 👍 valid — crates/minimald/src/env.rs: run_task refuses with exit 2 for a declared inherit value (laptop text) or an argv item that held an invalid byte. An undeclared variable does not refuse the run. Tests pin all three cases.

A task box's entrypoint exits with the task's own exit code, with its env vars, working directory and args. In-box min task run now refuses with exit 2 when a declared inherit variable or an argument holds bytes that are not valid UTF-8. The inherit case prints the same text as the laptop. An undeclared variable with such bytes does not stop the run.

Notes from the agent: Revise round 6. Arch's note C1 is done. The listener keeps the lossy decode. For a line that is not valid UTF-8 it now calls a new default method Channel::handle_lossy(stream, line, raw, rootfs) with the raw bytes. That method is in crates/sandbox/src/lib.rs, which is outside the task's layers. It is a defaulted trait method, so the other implementers (mctx EnvChannel, the unit impl) do not change. The listener.rs change was already accepted by the maintainer. In crates/minimald/src/env.rs the bridge carries the raw bytes to the actor. TaskRunRequest::mark_invalid_bytes records which env names and args held an invalid byte. run_task refuses with EXIT_USAGE (2) for an invalid argv item, with the new text "error: an argument for task '' is not valid UTF-8, so the task did not run". It also refuses for a declared inherit value, with the laptop's text from crates/minimal/src/task.rs (the laptop prints the same text for NotUnicode as for an unset variable). The directive asked for the refusal tests next to listener_serves_a_request_with_a_non_utf8_value. The sandbox crate cannot reach minimald, so listener.rs has a test that the channel gets the raw bytes (listener_tells_the_channel_which_bytes_were_not_utf8). The two refusals and the undeclared pass are pinned through the channel in env.rs: task_run_refuses_an_inherit_value_that_is_not_utf8, task_run_refuses_an_argument_that_is_not_utf8, task_run_ignores_an_undeclared_value_that_is_not_utf8. task_entrypoint_carries_env_cwd_and_args also covers the parsing at unit level. BoxChannel::handle is now cfg(test) and delegates to the…[truncated]

@minimal-foundry
minimal-foundry Bot marked this pull request as draft November 4, 2026 05:02
@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 4, 2026
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

The runtime will not revise this pull request again on its own: the diff is +1358/-67 (1425 lines), past 3x the plan's estimate of 420 lines (est: 220 code, 200 tests, as #2953 reads now), at round 6 (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 #2953 by hand.

@mitodrummer mitodrummer removed the needs-human An agent handed off; a human must act, then clear this label. Set by defer and handoffs. label Nov 4, 2026
@mitodrummer
mitodrummer marked this pull request as ready for review November 4, 2026 05:16

@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.

Reviewed at e7bc71ea. A whole-PR review at 27636d9a ran all 59 env::tests, which pass. It also checked the exit codes (0, 3, 42, 137, 4, 2, 125) and back-compat between old and new helpers. Rounds 5 and 6 land the requested fixes:

  • the listener traces only the byte count, never the raw request line, which carries the caller's env (e5fe604a);
  • request lines are read as bytes and decoded lossily. Non-UTF-8 in a declared inherit value or an argv item is refused with exit 2, and an undeclared variable passes through (a00dea71);
  • echoed task names and paths stay on one line, so a crafted name can't inject an exit: line (15a166e4);
  • the helper prints with printf '%s\n'.

Residuals: #2892 (in-box stdin) and #2983 (one run path for inherit_cwd). The out-of-layer crates/sandbox/src/{lib,listener}.rs edits are accepted. The test-kvm failure was an unrelated minvmd egress-gate flake, and it passed on rerun.

@agent-137 agent-137 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.

Reviewed at e7bc71e against #2953 (BCLI-010). run_task relays the entrypoint's exit code; refusals carry 2/3/4/125; a run stream with no exit line returns 125; notes, refusals and task stderr go out as err: lines, so stdout stays clean; inherit and inherit_cwd follow the laptop's rules; the listener and channel traces no longer log the request environment. All 23 open threads are fixed on this head. The run_invocations_in duplication of run_with_cancel is deferred to #2983 and stdin to #2892, both named as residuals. Non-blocking: the body's embedded plan says covers: BOX-015 (the issue says BCLI-010), and its Proof says a refused run exits 1 (it exits 2/3/4/125).

@minimal-foundry minimal-foundry Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

minimal-review — approved

Verdict APPROVE — every review thread is resolved; @agent-137 closed the last one. The review of e7bc71ea6433 withheld this approval on the threads open then. Posted as a comment: the App cannot approve its own pull request; the check and the label carry it.

@minimal-foundry minimal-foundry Bot added the review:approved minimal-review approved the current head label Nov 4, 2026
@agent-137
agent-137 added this pull request to the merge queue Nov 4, 2026
Merged via the queue into main with commit ca2d699 Nov 4, 2026
38 of 40 checks passed
@agent-137
agent-137 deleted the agent/2953-relay-a-task-s-exit-code-and-inputs-through-the branch November 4, 2026 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review:approved minimal-review approved the current head

Projects

None yet

Development

Successfully merging this pull request may close these issues.

T62 — Relay a task's exit code and inputs through the in-box min helper

2 participants