Repository navigation
fix(minimald): minenv_run_forwards_stdin_to_the_task always ends, and a hang fails within seconds - #3672
Conversation
The background cat that copies stdin to the task now closes the helper's copies of the socket write end, the reply pipe and the saved stdin, so its exit is the last close socat waits for.
run_min_against_channel runs the helper in its own process group, kills it after a deadline from a watchdog thread, sets a read timeout on the channel stream, and panics with the helper's stderr. It also drops MINIMAL_OTEL, which put otel%off% ahead of run% and made the channel side panic while the helper waited forever.
…-forwards-stdin-to-the-task-always-end
The verify sandbox exports MINIMAL_OTEL=off. The min helper then sends an otel%off% prefix, and tests that expect a bare run% request fail.
|
Important Review skippedBot user detected. Ask an organization administrator to verify that this bot has an active assigned CodeRabbit review seat. See the seat-assignment guide. After the seat is confirmed, request a review again.
|
|
Reviewed: no findings; approval withheld, 1 thread unresolved at APPROVE withheld: 1 unresolved thread — minimal-arch[bot] crates/minimald/src/env_min_helper.sh:241. Resolving the last thread releases the approval on this head. Resolve the open threads. Resolving the last one releases the approval on this head; no new review is required. Clobber: none seen. Supply chain No manifest, lockfile or CI file changed. The |
There was a problem hiding this comment.
arch-review: PASS_WITH_CONDITIONS · 1 condition · the full ruling
The change conforms to the design. The helper closes only the fds that the background cat inherits, and the env.rs changes are test-only. The PR body names a known gap with no issue: in-box min task run waits on an open stdin when the daemon closes before exit:. Lines 400 and 494 of architecture.md require the run to return the task's exit code. File that gap as an issue and link it in the PR body, as C1 says.
Ruled at b2be689 against gominimal/arch@8b824707cde6 by claude-opus-5-5.
| # its exit is the last close socat waits for. | ||
| if [[ "$forward" -eq 1 && -z "$feeder" ]]; then | ||
| cat <&"$stdin_fd" >&"$sock_in" & | ||
| cat <&"$stdin_fd" >&"$sock_in" {sock_in}>&- {sock_out}<&- {stdin_fd}<&- & |
There was a problem hiding this comment.
C1 · This line is correct. The known gap in the PR body starts at line 155 (socat -t 2000000000). When the daemon closes before exit: and stdin stays open, min task run waits for stdin to end. Lines 400 and 494 of architecture.md require the run to return. File an issue for the gap, and link it as a Residual: line in the PR body.
There was a problem hiding this comment.
Filed as #3675 and named in the PR body as a Residual: line, replacing the old "Known gap" sentence. No code change.
There was a problem hiding this comment.
APPROVE withheld: 1 unresolved thread — minimal-arch[bot] crates/minimald/src/env_min_helper.sh:241.
minimal-review — advisory review
Verdict COMMENT — No findings.
Panel: 2 of 3 personas ran (security, supply-chain); did not complete: correctness.
|
/arch-review |
There was a problem hiding this comment.
arch-review: PASS · the full ruling
The change conforms to the design. The helper closes the extra copies of the socket write end, so stdin reaches the task as it does outside a box (architecture.md line 400). The harness edits stay in the minimald test module. Removing MINIMAL_OTEL there does not weaken a gate, because the opt-out prefix keeps its own test. The hang when the daemon closes before exit: is older than this change and is filed as #3675.
Ruled at b2be689 against gominimal/arch@8b824707cde6 by claude-opus-5-5.
Follow-up
Fixes #3664
crates/minimald/src/env_min_helper.shcrates/minimald/src/env.rsTask marker
Proof
In this sandbox, cargo nextest run -p minimald minenv_run_forwards_stdin_to_the_task passes 200 times in a row. Before the change it hung until nextest killed it at 865 s. A forced hang (stdin that never ends, and a channel that waits for its EOF) now fails in 3 s with the helper's stderr in the panic, and does not use up the verify limit.
Notes from the agent: Root cause of this hang: the sandbox exports MINIMAL_OTEL=off. The helper then sends otel%off%run%... and the test channel panics on strip_prefix("run%") and drops the stream. socat runs with -t 2000000000, so it keeps its stdout open while it waits for a stdin EOF that never comes, and the harness blocked in wait_with_output. The harness now removes MINIMAL_OTEL as it already removed TRACEPARENT. That is the change that makes the test pass, and it is in env.rs, inside the test layer. Helper layer: the leaked copy of the socket write end that the task note describes did not reproduce in this tree. The background cat exits at stdin EOF and closes every fd it holds. I still made the change from the note: the cat now closes its inherited sock_in, sock_out and stdin_fd. It is hygiene, and it is not the fix. Residual: #3675 (in-box
min task runwaits on open stdin when the daemon closes beforeexit:; older than this change).Tests
cargo nextest run -p minimald minenv_run_forwards_stdin_to_the_taskcargo nextest run -p minimald min_helper_run_against_channel_fails_fast_when_stdin_never_endscargo nextest run -p minimald minenv_run_forwards_stdin_to_the_taskVerify
min task run agent-verifypassed ([tasks.verify]).Base
The base branch moved while the coder worked; it was merged in before the tests ran.
Closes #3415 (the original issue this task was triaged from).