8000 fix(minimal): stop task run hanging on a held-open stdin pipe by gominimal-aw-bot[bot] · Pull Request #1741 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

fix(minimal): stop task run hanging on a held-open stdin pipe - #1741

Merged
norrietaylor merged 3 commits into
mainfrom
inbox-patch/fix/task-run-stdin-pipe-hang-02622f5d478ac19e
Sep 29, 2026
Merged

norrietaylor merged 3 commits into
mainfrom
inbox-patch/fix/task-run-stdin-pipe-hang-02622f5d478ac19e

Conversation

@gominimal-aw-bot
@gominimal-aw-bot gominimal-aw-bot Bot commented Sep 26, 2026 •
Copy link
Copy Markdown
Contributor

Routing-Key: inbox-route/I_kwDOSUhdos8AAAABTSyWRA

Problem

min task run hangs at exit when its stdin is a pipe whose writer stays
open. bridge_exec pumped piped stdin through tokio::io::stdin(), a
blocking read(0) parked on tokio's blocking pool. pump.abort() cannot
interrupt that read, so once the task's exit status arrived the runtime
drop waited on the blocking thread forever.

Change

Read stdin on a detached std::thread instead, feeding a
tokio::sync::mpsc channel that the async pump drains into the exec
channel. The thread is abandoned on exit rather than awaited, so a
held-open pipe can no longer keep the process alive.

Verification

  • cargo fmt --all -- --check
  • cargo clippy -p minimal --all-targets --no-deps --locked -- -D warnings
  • cargo build --workspace --locked
  • cargo test -p minimal --locked --test cli (38 passed, incl. new regression test)

Summary by CodeRabbit

  • Bug Fixes
    • Improved task execution with piped input, including cases where the input stream remains open while the task runs. Piped input is forwarded to the task, and its output is available on standard output.
  • Documentation
    • Clarified that task runs support piped input only; interactive input is not supported. This distinction helps set expectations when providing input to a task.

`min task run` pumped piped stdin through `tokio::io::stdin()`, a
blocking `read(0)` parked on tokio's blocking pool. `pump.abort()`
cannot interrupt that read, so when stdin was a pipe whose writer
stayed open, the runtime drop waited on the blocking thread forever
after the task's exit status had already arrived.

Read stdin on a detached `std::thread` instead, feeding an mpsc
channel that the async pump drains into the exec channel. The thread
is abandoned on exit rather than awaited, so a held-open pipe can no
longer keep the process alive.

Add a regression test that runs the compiled binary with the stdin
write end held open and asserts it exits within a timeout.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@gominimal-aw-bot
gominimal-aw-bot Bot requested a review from a team as a code owner September 26, 2026 09:54
@gominimal-aw-bot gominimal-aw-bot Bot added the agent:fix Agentic fix PR eligible for review iteration; min-aw's worker-iterate gates on it. label Sep 26, 2026
@coderabbitai
coderabbitai Bot commented Sep 26, 2026 •
Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Essentials

Run ID: b9f1022e-834a-4c71-a2e4-4ceac499a835

📥 Commits

Reviewing files that changed from the base of the PR and between 1d736b3 and e5c585f.

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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Essentials

Run ID: 693c94a1-6f18-47ba-ae8b-9d09f6eec393

📥 Commits

Reviewing files that changed from the base of the PR and between 6f3f8b9 and 1d736b3.

📒 Files selected for processing (1)
  • crates/minimal/tests/cli.rs

Included review availability: This review used your included allowance. 1 included review remains after this review. Your included PR review attempts over the past 7 days set your current allowanc 8000 e at 2 reviews per hour.


📝 Walkthrough

Walkthrough

The exec bridge forwards piped stdin through a detached reader thread and a bounded Tokio channel. A Linux-only CLI test checks task output while the subprocess stdin pipe remains open.

Changes

Piped stdin forwarding

Layer / File(s) Summary
Exec bridge input flow
crates/minimal/src/task.rs
The bridge documents piped input support and the lack of interactive task support. It reads piped stdin in chunks on a standard thread, forwards them through a bounded Tokio channel, and shuts down the SSH channel writer when forwarding ends.
CLI subprocess test
crates/minimal/tests/cli.rs
A Linux-only test keeps the subprocess stdin pipe open, waits up to 30 seconds, and checks for successful exit and expected task output.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant StandardInput
  participant ReaderThread
  participant BoundedTokioChannel
  participant AsyncPump
  participant SSHExecChannel
  StandardInput->>ReaderThread: Provide stdin bytes
  ReaderThread->>BoundedTokioChannel: Send chunks
  BoundedTokioChannel->>AsyncPump: Deliver chunks
  AsyncPump->>SSHExecChannel: Write chunks
  AsyncPump->>SSHExecChannel: Shut down writer when forwarding ends
Loading

Suggested reviewers: norrietaylor

Merge Risk: ⚪ Minimal · up to 1d736

The change stops min task run from hanging when stdin is a held-open pipe, and adds a regression test for it. No merge-blocking issue was found in the supplied context.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title uses the required Conventional Commit format and clearly describes the primary fix for held-open stdin pipes.
Description check ✅ Passed The description clearly explains the problem, the implementation, and the verification commands. The Problem and Change sections provide the required summary, and Verification provides the testing det…
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

A rabbit reads the piped-in stream,
Then sends each chunk along the seam.
The channel closes when reads are done,
The task prints output, test is won.
I twitch my nose and hop away,
While stdin stays open all the day.

Comment @coderabbitai help to get the list of available commands.

@gominimal-aw-bot gominimal-aw-bot Bot added the agent:resolve Consent gate: pr-conflict-resolver may rewrite this branch label Sep 26, 2026
@norrietaylor norrietaylor changed the title fix: fix(minimal): stop task run hanging on a held-open stdin pipe fix(minimal): stop task run hanging on a held-open stdin pipe Sep 28, 2026
@norrietaylor
norrietaylor enabled auto-merge (squash) September 29, 2026 19:51
@norrietaylor
norrietaylor merged commit 9d42580 into main Sep 29, 2026
32 checks passed
@norrietaylor
norrietaylor deleted the inbox-patch/fix/task-run-stdin-pipe-hang-02622f5d478ac19e branch September 29, 2026 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent:fix Agentic fix PR eligible for review iteration; min-aw's worker-iterate gates on it. agent:resolve Consent gate: pr-conflict-resolver may rewrite this branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0