8000 fix(minimald): minenv_run_forwards_stdin_to_the_task always ends, and a hang fails within seconds by minimal-foundry[bot] · Pull Request #3672 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

fix(minimald): minenv_run_forwards_stdin_to_the_task always ends, and a hang fails within seconds - #3672

Merged
mitodrummer merged 4 commits into
mainfrom
agent/3664-minenv-run-forwards-stdin-to-the-task-always-end
Nov 20, 2026
Merged

mitodrummer merged 4 commits into
mainfrom
agent/3664-minenv-run-forwards-stdin-to-the-task-always-end

Conversation

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

Follow-up

Fixes #3664

Task marker
### D3415 — minenv_run_forwards_stdin_to_the_task always ends, and a hang fails within seconds and does not use up the verify limit
  kind: task
  size: S
  est: 40 code, 60 tests
  executor: agent
  origin: bug
  epic: 2236
  layers:
    - helper:
      - crates/minimald/src/env_min_helper.sh: In __min_rpc forward path, find and close each copy of the socket write end (sock_in, coproc fds, the copy that the background cat inherits) so socat sees EOF when stdin ends
      test: cargo nextest run -p minimald minenv_run_forwards_stdin_to_the_task
    - test:
      - crates/minimald/src/env.rs: run_min_against_channel waits for the child on a separate watchdog thread, sets a read timeout on the server stream, kills bash and socat after a deadline, and panics with the collected stderr
      test: cargo nextest run -p minimald min_helper_run_against_channel_fails_fast_when_stdin_never_ends
      test: cargo nextest run -p minimald minenv_run_forwards_stdin_to_the_task
  proof: In the agent sandbox, cargo nextest run -p minimald minenv_run_forwards_stdin_to_the_task passes 200 times in a row, and a forced hang fails in seconds, not after 600 s.

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 run waits on open stdin when the daemon closes before exit:; older than this change).

Tests

line exit tail
cargo nextest run -p minimald minenv_run_forwards_stdin_to_the_task 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network help: do you need to update to a newer version of minimal? Running task runtime-implement-test-0 in bo
cargo nextest run -p minimald min_helper_run_against_channel_fails_fast_when_stdin_never_ends 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network help: do you need to update to a newer version of minimal? Running task runtime-implement-test-1 in bo
cargo nextest run -p minimald minenv_run_forwards_stdin_to_the_task 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network warning: unknown fields in task runtime-implement-test-2: network help: do you need to update to a newer version of minimal? Running task runtime-implement-test-2 in bo

Verify

min task run agent-verify passed ([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).

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.
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.
@coderabbitai
coderabbitai Bot commented Nov 20, 2026
Copy link
Copy Markdown
Contributor

Important

Review skipped

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

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: 8f426ad9-2587-45d1-8594-0bf4b39f86c1

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

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

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

Reviewed: no findings; approval withheld, 1 thread unresolved at b2be6894b032.

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 minimald-rpc crate is already a dependency of minimald, and OTEL_ENV exists in it. The helper change only closes inherited fds in a background cat. It adds no new fetch or execution. Not checked: a build or test 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 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}<&- &
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

C1 · This 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.

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.

Filed as #3675 and named in the PR body as a Residual: line, replacing the old "Known gap" sentence. No code change.

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

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.

@agent-137
Copy link
Copy Markdown
Member

/arch-review

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

Choose a reason for hiding this comment

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

arch-review: PASS · the full ruling

The change conforms to the 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.

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

Approved.

@mitodrummer
mitodrummer added this pull request to the merge queue Nov 20, 2026
Merged via the queue into main with commit 626761a Nov 20, 2026
41 checks passed
@mitodrummer
mitodrummer deleted the agent/3664-minenv-run-forwards-stdin-to-the-task-always-end branch November 20, 2026 03:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet
385B

2 participants

0