Repository navigation
T123 — A piped stdin reaches a task box's task - #3086
Conversation
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.
|
Important Review skippedBot user detected. To trigger a single review, invoke the
|
|
/review |
|
Reviewed: 1 finding, none blocking at Address the comments on the diff. Clobber: none seen. |
There was a problem hiding this comment.
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.
|
/revise Arch condition C1 (arch_rulings 1013, head f836d06). Residual issue #3094 is filed. In |
…din-reaches-a-task-box-s-task
Names issue #3094 as the tracker for the later invocations.
There was a problem hiding this comment.
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.
|
Round 1 of 10 on a /revise note, pushed as
Verify Review threads the coder judged:
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. |
|
/revise Fix the finding on |
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.
…din-reaches-a-task-box-s-task
There was a problem hiding this comment.
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.
|
Round 2 of 10 on a /revise note, pushed as
Verify Review threads the coder judged:
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
left a comment
There was a problem hiding this comment.
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.
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 arunrequest over/run/minenv_sockwithout forwarding its own stdin. So the task reads nothing. Repro:printf 'piped-in\n' | min task run twitht = "read line; echo got:$line"printsgot:.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
stdinto the run request. The daemon answersstdin: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 astdinfield, and the channel logsstdin_forwardedfor 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
cargo nextest run -p minimald minenv_run_forwards_stdin_to_the_taskcargo nextest run -p minimald task_run_pipes_stdin_through_the_in_box_helperscripts/session-e2e.sh(CI (macOS)e2ejob, head b9923ec, https://github.com/gominimal/minimal/actions/runs/42269268708/job/128082844416)task run stdin: piped input reached the task OK(2026-11-06T18:53:17Z);ci-macos-successgreen. The CI (Linux KVM)test-kvmjob 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-verifytimed out after 1800s, so this PR is a draft.Residual: #3094 (only the first invocation of a multi-invocation task gets the forwarded stdin; arch C1, arch_rulings 1013).
Closes #3055