Repository navigation
feat(interpreter): stream pipeline stages concurrently with SIGPIPE - #2541
Merged
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | 007395e | Commit Preview URL Branch Preview URL |
Oct 07 2026, 06:22 AM |
chaliy
force-pushed
the
claude/fidelity-pipelines
branch
from
October 7, 2026 05:51
a5ef256 to
9a406b9
Compare
From the first stage that runs shell code, pipeline stages run on forked shells over 4 KiB pipes with backpressure. A writer whose reader is gone ends with 141, so 'while :; do echo x; done | head -n 2' stops the loop. head and read pull only what they need. Nested streaming counts as a subshell level and falls back to sequential stages past 4 levels (TM-DOS-124). L-PIPE-001 narrowed. Claude-Session: https://claude.ai/code/session_019aFikmptPc91Fj4N2iDXQA
chaliy
force-pushed
the
claude/fidelity-pipelines-stream
branch
from
October 7, 2026 06:21
20b5dc5 to
007395e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Михайло · project thread
Stacked on #2538.
What changed
eval). Each such stage runs on a forked shell and writes into a 4 KiB pipe with backpressure. The last stage stays in the caller's shell, so its output still streams toexec_streamingcallers.headgot its lines, awhile readloop broke, or the stage never reads stdin), the writer's next write fails and it ends with 141.while :; do echo x; done | head -n 2prints two lines and setsPIPESTATUSto141 0, as in bash. Before, the loop ran until the command limit and the wholeexecfailed.readpulls one line andhead -n/-cpulls only what it needs from a streaming pipe. Commands that never read stdin (echo,true,sleep, ...) do not wait for the producer.echo x | grep x) still run in sequence without forking, so the common case costs nothing extra.concurrent_jobs(false)also turns this off.f() { f | f; }). A streaming group counts as a subshell level, and past 4 nested levels stages run in sequence, which keeps native stack near plain function recursion.yes | head) still produce their whole output before the next stage reads.cat/grepdownstream of a streaming stage read all input first.Why
This is step 2 of the bash-fidelity roadmap.
producer | headandproducer | while read ...; breakare everyday idioms. They either ran away into limits or produced the wrongPIPESTATUS. The pipe design (a shared buffer polled on the caller's task, with no threads) is also the building block for wiring a reader-backed stdin intoTerminal(L-TERM-002).Before / After
Before:
xprinted thousands of times, thenresource limit exceeded: maximum command count exceeded (10000).After:
x,x,141 0. This is identical to GNU bash 5.2.The new spec cases in
pipes-redirects.test.sh(endless producer intohead, into tworeads, through a middlewhile readstage (141 141 0), and into a loop thatbreaks) all match real bash locally.Risk
f() { f | f; }in debug builds: 1.99 MB sequential (main 1.90), 2.19 MB with streaming. The 4-level cap keeps it bounded. The existing nested$(...)canary is unchanged (1994531 bytes).Checklist
pipeunit tests,pipeline_tests, 4 bash-compared spec cases, TM-DOS-124 regressions)concurrent_jobs(false)keeps sequential stages)https://claude.ai/code/session_019aFikmptPc91Fj4N2iDXQA
Generated by Claude Code