Skip to content

T123 — A piped stdin reaches a task box's task - #3086

Merged
agent-137 merged 7 commits into
mainfrom
agent/3055-a-piped-stdin-reaches-a-task-box-s-task
Nov 7, 2026
Merged

agent-137 merged 7 commits into
mainfrom
agent/3055-a-piped-stdin-reaches-a-task-box-s-task

Conversation

@minimal-foundry

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

Copy link
Copy Markdown
Contributor

T123 — A piped stdin reaches a task box's task

slice: S2
kind: task
covers: BOX-038
size: M
est: 220 code, 200 tests
executor: agent
difficulty: needs care
model: strongest
diagnostics: a stdin that cannot be forwarded fails the run naming why, never a task that silently reads nothing
observability: the task_run span records whether stdin was forwarded
layers:
- helper:
- crates/minimald/src/env_min_helper.sh: the in-box min task run forwards its stdin over the minenv run request and closes it at EOF
- crates/minimald/src/env.rs: the minenv run protocol carries stdin from the helper to the task, then its EOF
test: cargo nextest run -p minimald minenv_run_forwards_stdin_to_the_task
- daemon:
- crates/minimald/src/exec/process.rs: the in-box task run feeds the forwarded stdin to the task's stdin pipe
test: cargo nextest run -p minimald task_run_pipes_stdin_through_the_in_box_helper
- e2e:
- scripts/session-e2e.sh: a task-run step pipes stdin and checks the task read it, and stdout is the task's alone
- crates/minimal/src/cli.rs: min task run --help says a piped or redirected stdin goes to the task
produces: none
consumes: none
proof: A piped or redirected stdin reaches the task, so cat q.sql | min task run query > out.csv works.
depends on:
- blocked by #2405

Split from T43 (#2405, PR #2999) by the maintainer (2026-11-05). T43 gives the task box's entrypoint three pipes, but the entrypoint is the in-box helper min task run <task>, and it sends a run request over /run/minenv_sock without forwarding its own stdin. So the task reads nothing. Repro: printf 'piped-in\n' | min task run t with t = "read line; echo got:$line" prints got:.

Proof

In a task box, a piped or redirected stdin now reaches the task. The in-box min task run forwards it to the task's stdin and closes it at EOF, and stdout carries only the task's output, so cat q.sql | min task run query > out.csv works. min task run --help says so.

Notes from the agent: Protocol: when its stdin is not a terminal, the helper adds a fourth group stdin to the run request. The daemon answers stdin: after it spawns the task, and only then does the helper stream its stdin on the same connection. The session listener (sandbox crate, outside the layers) reads the request line with a BufReader that it then drops, so this handshake keeps it from swallowing input bytes. After the task ends, the daemon reads and drops any input the task did not read until the helper closes, so the helper's socat never gets EPIPE and loses the exit: line. That wait has a 10 s limit. A forwarded run always takes the run_invocations_in path, because mctx's Env::run gives a task no stdin. Only the first invocation of a multi-invocation task gets the stdin. If reading the forwarded stdin fails while the task still reads it, the run fails with 'min task run could not pass its stdin to the task: ' and exits 125. Observability: the task_run span in process.rs now has a stdin field, and the channel logs stdin_forwarded for each in-box run. The daemon-layer test lives in env.rs, next to the helper harness. It drives the real helper through the host's real socat against a test socket served by ForwardedStdin and BoxChannel::end_task_run. It does not go through BoxChannel::run_task, because that needs a sandboxed mctx env. Both tests skip when the host has no socat. In the existing run_min_against harness, the fake socat now reads one line instead of reading to EOF, because a forwarding helper keeps its side open until the channel answers. I did not run scripts/session-e2e.sh (it needs a VM or KVM host). I only checked it with bash -n. Stale comment outside the …[truncated]

Tests

line exit tail
cargo nextest run -p minimald minenv_run_forwards_stdin_to_the_task 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-4145... 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_run_pipes_stdin_through_the_in_box_helper 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-dc0e... 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.
scripts/session-e2e.sh (CI (macOS) e2e job, head b9923ec, https://github.com/gominimal/minimal/actions/runs/42269268708/job/128082844416) 0 task run stdin: piped input reached the task OK (2026-11-06T18:53:17Z); ci-macos-success green. The CI (Linux KVM) test-kvm job on this head also printed it at 18:55:56Z. Added by the babysitter for arch C1 (arch_rulings 1025).

Verify

min task run agent-verify timed out after 1800s, so this PR is a draft.

tps://github.com/souk4711/hakoniwa.git?rev=0810ffa37620ef5c57de263c8eaa1f4d7633c14a#0810ffa3)
   Compiling tracing-appender v0.2.5
   Compiling opentelemetry-otlp v0.33.0
   Compiling json-subscriber v0.3.1
   Compiling ssh-cipher v0.3.0
   Compiling opentelemetry-appender-tracing v0.33.1
   Compiling hash32 v0.3.1
   Compiling ssh-key v0.7.0-rc.11
   Compiling mlog v0.0.1 (/workbench/crates/mlog)
   Compiling heapless v0.9.3
   Compiling russh-cryptovec v0.62.0
   Compiling yasna v0.6.0
   Compiling russh-util v0.52.0
   Compiling bitflags v1.3.2
   Compiling managed v0.8.0
   Compiling russh v0.65.0
   Compiling smoltcp v0.14.0
   Compiling moka v0.12.16
   Compiling rcgen v0.14.10
   Compiling dashmap v6.2.1
   Compiling async-compression v0.4.50
   Compiling async-tar v0.6.1
   Compiling is_executable v1.0.6
   Compiling russh-sftp v2.4.0
   Compiling clap_complete v4.6.11
   Compiling bep v0.0.1 (/workbench/crates/bep)
   Compiling switch v0.0.1 (/workbench/crates/switch)
   Compiling diagnostics v0.0.1 (/workbench/crates/diagnostics)
   Compiling vsock v0.5.4
   Compiling async-dialog v0.0.1 (/workbench/crates/async-dialog)
   Compiling tokio-vsock v0.7.2
   Compiling rusty-fork v0.3.1
   Compiling castaway v0.2.4
   Compiling strum v0.28.0
   Compiling proptest v1.12.0
   Compiling compact_str v0.9.1
   Compiling signal-hook v0.3.18
   Compiling kasuari v0.4.12
   Compiling unicode-truncate v2.0.1
   Compiling lru v0.18.2
   Compiling signal-hook-mio v0.2.5
   Compiling derive_more v2.1.1
   Compiling line-clipping v0.3.8
   Compiling ratatui-core v0.1.2
   Compiling crossterm v0.29.0
   Compiling nickel-lang-core v0.19.0
   Compiling minvmd v0.8.0 (/workbench/crates/minvmd)
   Compiling fuzzy-matcher v0.3.7
   Compiling similar v2.7.0
   Compiling ratatui-widgets v0.3.2
   Compiling ratatui-crossterm v0.1.2
   Compiling inquire v0.9.4
   Compiling insta v1.49.0
   Compiling ratatui-macros v0.7.2
   Compiling args v0.0.1 (/workbench/crates/args)
   Compiling ratatui v0.30.2
   Compiling serial_test v4.0.1
   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 decode v0.0.1 (/workbench/crates/decode)
   Compiling checkouts v0.0.1 (/workbench/crates/checkouts)
   Compiling minimal-client v0.8.0 (/workbench/crates/minimal-client)
   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)

Residual: #3094 (only the first invocation of a multi-invocation task gets the forwarded stdin; arch C1, arch_rulings 1013).

Closes #3055

The in-box min task run, a task box's entrypoint, now forwards a piped
or redirected stdin over the minenv run request. The daemon answers
stdin: when the task starts, feeds the task's stdin pipe until EOF, and
drops what the task leaves unread until the helper closes.
The help for min task run now says a piped or redirected stdin goes to
the task. The session e2e pipes a line into a task run and checks the
task read it and that stdout is the task's alone.
@coderabbitai

coderabbitai Bot commented Nov 6, 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: e145d325-d556-4d53-93b7-8dce4e176e51

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

Use the checkbox below for a quick retry:

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

@agent-137

Copy link
Copy Markdown
Member

/review

@agent-137
agent-137 requested a review from a team as a code owner November 6, 2026 16:58
@minimal-foundry

minimal-foundry Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor Author

Reviewed: 1 finding, none blocking at b9923ec19e47.

Address the comments on the diff.

Clobber: none seen.

@minimal-foundry minimal-foundry Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

minimal-review — approved

Verdict APPROVE — No findings.

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

@minimal-foundry minimal-foundry Bot added the review:approved minimal-review approved the current head label Nov 6, 2026

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

The change conforms to line 493 of the architecture. A piped stdin now reaches the task, and stdout stays the task's alone. A stdin failure exits 125, as line 371 requires. C1: file an issue for the multi-invocation task, where only the first invocation gets the stdin, and name the issue in the code and in the PR. C2: show a green run of the new session-e2e.sh step at this head. No other test proves the sandbox stdin pipe.

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

Comment thread crates/minimald/src/env.rs Resolved
Comment thread scripts/session-e2e.sh Resolved
@agent-137

Copy link
Copy Markdown
Member

/revise Arch condition C1 (arch_rulings 1013, head f836d06). Residual issue #3094 is filed. In crates/minimald/src/env.rs, in the run_invocations_in doc comment where it says "the first invocation gets a stdin pipe" (line 3376), say that only the first invocation of a multi-invocation task gets the forwarded stdin, and name #3094 as the issue that tracks it. In the PR body, list #3094 as a residual. Change nothing else: the code at line 3400 (filter(|_| idx == 0)) stays as it is in this PR.

@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_WITH_CONDITIONS · 1 condition · the full ruling

The change conforms to line 493. A piped stdin now reaches the task, stdout carries only the task's output, and a forwarding failure exits 125. The box still ends when its entrypoint returns (BOX-038, line 499). No test in the PR drives the daemon side into a real task's stdin pipe, and the e2e step did not run. C1 requires that step to pass on this head before merge. Issue #3094 tracks the multi-invocation gap as a residual.

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

Comment thread scripts/session-e2e.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 minimal-foundry Bot removed the review:approved minimal-review approved the current head label Nov 6, 2026
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

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

line exit tail
cargo nextest run -p minimald minenv_run_forwards_stdin_to_the_task 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-866e... 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_run_pipes_stdin_through_the_in_box_helper 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-b97b... 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.


                "span_id": "333982a131a6d151",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "rpc",
            fields: {
                "parent_span_id": "7e7590c446e7d064",
                "rpc": "minimald-v1-DestroySession",
                "span_id": "592643ad1293111c",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "GetRecord",
                "parent_span_id": "592643ad1293111c",
                "queued_behind": "0",
                "span_id": "9a4f2abb66bcdc21",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "DeleteSession",
                "parent_span_id": "592643ad1293111c",
                "queued_behind": "0",
                "span_id": "f75660f9cedaae62",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "session.message",
            fields: {
                "kind": "Destroy",
                "parent_span_id": "f75660f9cedaae62",
                "span_id": "c935633d36610522",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "HandOverName",
                "parent_span_id": "f75660f9cedaae62",
                "queued_behind": "0",
                "span_id": "4486d8545f67cba0",
                "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.511s] ( 972/2366) minimald box_actor::tests::a_box_re_registered_inside_the_landing_window_keeps_its_grant
        PASS [   2.591s] ( 973/2366) minimald box_actor::tests::a_box_nobody_handed_an_address_publishes_at_the_answerers_grant
        PASS [   2.580s] ( 974/2366) minimald box_actor::tests::a_contended_walk_never_replaces_a_present_verdict
────────────
     Summary [  73.001s] 974/2366 tests run: 973 passed, 1 failed, 27 skipped
        FAIL [   3.888s] ( 971/2366) minimal::otel_cli exec_run_attach_and_task_run_share_the_commands_trace
warning: 1392/2366 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

Review threads the coder judged:

  • 👍 valid — crates/minimald/src/env.rs:3403: The run_invocations_in doc comment now says only the first invocation of a multi-invocation task gets the forwarded stdin, and names issue fix(minimald): give every invocation of a multi-invocation task the forwarded stdin #3094. The code stays as it is, per the arch ruling.
  • 👍 valid — scripts/session-e2e.sh:6858: The finding holds: only the e2e step exercises the hakoniwa stdin pipe in run_invocations_in. This sandbox has no /dev/kvm, so I could not run scripts/session-e2e.sh. The linux-kvm or macos e2e lane must supply the green run at this head for the Tests table.

A piped or redirected stdin reaches the task, so cat q.sql | min task run query > out.csv works. The run_invocations_in doc comment now says that only the first invocation of a multi-invocation task gets the forwarded stdin, and names issue #3094 as the tracker.

Notes from the agent: This round changes only the run_invocations_in doc comment in crates/minimald/src/env.rs, as the /revise note asks. The code at filter(|_| idx == 0) is unchanged. Add #3094 to the PR body as a residual: the runner writes the body, so I cannot. I did not run scripts/session-e2e.sh: this box has no /dev/kvm, and the e2e needs a KVM host or the macOS runner. The C2 e2e evidence is still owed by the linux-kvm or macos lane at this head.

@agent-137

Copy link
Copy Markdown
Member

/revise Fix the finding on end_task_run (thread PRRT_kwDOPdfcxM60nXwl), confirmed at crates/minimald/src/env.rs:2349 on 0a0c893: if let Some(error) = forwarded.and_then(|f| f.failure()) { result = Err(forwarded_stdin_error(&error)); } overwrites result unconditionally. A task that already failed with its own exit code then exits 125 and its code is lost, which breaks principle 5 (exit codes are meaningful). A read error on the connection after the task has ended (for example a reset from a helper that died) also turns a successful run into a failure. Replace result with the forwarded-stdin error only while the task still read its stdin and result is Ok. Keep an Execution error, the task's own code, as it is. Add tests: (1) a task that exits 4 while the forwarded stdin fails still ends with 4; (2) a forwarded-stdin read error after the task ended with 0 leaves 0. Change nothing else, and keep #3094 and the Tests-table rows in the body.

A forwarded-stdin failure now replaces only a run that passed, so a task
that failed keeps its own code. A read of the connection that fails after
the task ended no longer fails 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_WITH_CONDITIONS · 1 condition · the full ruling

The new commit keeps a failed task's own exit code when its forwarded stdin also fails. Line 493 of the architecture requires that. A run that passed but lost its stdin still fails with 125. A reset after the task ends is not an error. BOX-038 conforms. One condition stays open: C1 asks for the session e2e stdin step to pass on this head, because the reported pass is on 0a0c893. Residual #3094 still covers the multi-invocation gap.

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

Comment thread scripts/session-e2e.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/minimal/src/cli.rs Resolved
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

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

line exit tail
cargo nextest run -p minimald minenv_run_forwards_stdin_to_the_task 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-c181... 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_run_pipes_stdin_through_the_in_box_helper 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-c32b... 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.


                "span_id": "90403abc4db4a468",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "rpc",
            fields: {
                "parent_span_id": "8aa4733c19e9ad73",
                "rpc": "minimald-v1-DestroySession",
                "span_id": "f7f2eb192604bfcf",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "GetRecord",
                "parent_span_id": "f7f2eb192604bfcf",
                "queued_behind": "0",
                "span_id": "50a7a6618c8998c9",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "DeleteSession",
                "parent_span_id": "f7f2eb192604bfcf",
                "queued_behind": "0",
                "span_id": "4d401721d9fcecf1",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "session.message",
            fields: {
                "kind": "Destroy",
                "parent_span_id": "4d401721d9fcecf1",
                "span_id": "047eb2cad3daea93",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "HandOverName",
                "parent_span_id": "4d401721d9fcecf1",
                "queued_behind": "0",
                "span_id": "2670775fe8981246",
                "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.437s] ( 972/2368) minimald box_actor::tests::a_box_nobody_handed_an_address_publishes_at_the_answerers_grant
        PASS [   2.500s] ( 973/2368) minimald box_actor::tests::a_box_re_registered_inside_the_landing_window_keeps_its_grant
        PASS [   2.429s] ( 974/2368) minimald box_actor::tests::a_contended_walk_never_replaces_a_present_verdict
────────────
     Summary [  63.143s] 974/2368 tests run: 973 passed, 1 failed, 27 skipped
        FAIL [   3.665s] ( 971/2368) minimal::otel_cli exec_run_attach_and_task_run_share_the_commands_trace
warning: 1394/2368 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

Review threads the coder judged:

  • 👍 valid — PRRT_kwDOPdfcxM60nXwl: end_task_run replaces only an Ok result with the stdin error, so an Execution error keeps the task's code. The copy thread ignores read errors once run_invocations_in marks the task ended. Two tests pin both cases. (not posted on the thread: not an open thread on the pull request)

A piped or redirected stdin reaches the task, so cat q.sql | min task run query > out.csv works. A task that fails with its own code keeps that code when its forwarded stdin also fails. A stdin read error after the task ended with 0 leaves the exit code 0.

Notes from the agent: Revise round 2. end_task_run now replaces the result with the forwarded-stdin error only when the result is Ok. An Execution error keeps the task's own code. ForwardedStdin gained task_ended(). run_invocations_in calls it after the task's wait, and the copy thread then treats a failed read as the end of the stdin, not as an error. A cfg(test) wait_for_copy_end() lets the tests wait for the copy to end without a race. Two new tests are in env.rs: task_run_pipes_stdin_through_the_in_box_helper_keeps_a_failed_task_code (exit 4 stays 4, and the same reset still fails a run that passed) and task_run_pipes_stdin_through_the_in_box_helper_keeps_a_pass_after_the_task_ended (exit 0 stays 0). Their names start with the task's test name, so the test: line runs them. A small window remains: a read error between the task's exit and the task_ended() call still fails the run. Nothing else changed. #3094 and the PR body are not affected.

@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 against T123's plan block (BOX-038). The in-box helper forwards a non-terminal stdin only after the daemon answers stdin: at task start, leaves a terminal with the shell, and closes the connection after the run. The daemon feeds the task's stdin pipe, a forward that fails fails the run naming why (exit 125, the plan's diagnostics line), and since the fix round a failed task keeps its own exit code (tests at env.rs:4937 and 4957). Both planned tests are present, the help text now states the real behaviour, and session-e2e's stdin step passed on this head on macOS and KVM. Residual #3094 (multi-invocation stdin, now including the help text) is linked.

@agent-137
agent-137 added this pull request to the merge queue Nov 6, 2026
Merged via the queue into main with commit 65e83ca Nov 7, 2026
42 of 46 checks passed
@agent-137
agent-137 deleted the agent/3055-a-piped-stdin-reaches-a-task-box-s-task branch November 7, 2026 00:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

T123 — A piped stdin reaches a task box's task

1 participant