You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Stdin secret flags (--bearer-token -, --api-key -, …) fail under Node when input arrives late #2747
The CLI waits for stdin to close, then uses the value, however long the producer takes.
Actual Behavior
Step 2 works.
Step 3 fails right away with could not read '--bearer-token' from stdin, and the producer gets a broken pipe. --debug doesn't show the underlying EAGAIN.
CLI Version
1.0.1
Operating System
macOS
Additional Context
Cause: when stdin is process.stdin, SourceResolver.readStdin (src/io/source.ts) reads fd 0 directly with createReadStream("", { fd: 0, autoClose: false }). That works around Ink draining process.stdin under Bun. Under Node, touching process.stdin for a pipe makes fd 0 non-blocking. The raw read on the empty pipe then returns EAGAIN, and fs.ReadStream doesn't retry.
Suggested fix (untested): apply the fd-0 workaround only under Bun.
Testing note:bun test runs under Bun, and the unit tests inject stdin, so they can't hit this. A regression test has to run the built bundle under Node with late stdin. Including cause.code in the error message would also make this easier to diagnose.
Environment: Node v22.17.0, built with Bun 1.4.4, on v1.x (796277b) plus #2742 (37ce966). #2742 doesn't touch source.ts.
@notgitika We reproduced the delayed-pipe failure mode on Node 22 with a small child-process test using synthetic input. After process.stdin has been initialized, a second fs.createReadStream on fd 0 fails with EAGAIN when the producer writes 350 ms later. Reading through the existing process.stdin stream succeeds with the same delayed input; the immediate-input control passes too.
We have a focused regression test for this boundary. So far this is a Node runtime test, not a run of the built AgentCore CLI or a Bun compatibility check.
Are you already covering delayed stdin in your fix? If not, we can contribute a targeted test without overlapping your implementation.
Activity
[-]text Stdin secret flags (--bearer-token -, --api-key -, …) fail under Node when input arrives late[/-][+]Stdin secret flags (--bearer-token -, --api-key -, …) fail under Node when input arrives late[/+]aetherxeg-source commentedon Nov 3, 2026
@notgitika We reproduced the delayed-pipe failure mode on Node 22 with a small child-process test using synthetic input. After
process.stdinhas been initialized, a secondfs.createReadStreamon fd 0 fails withEAGAINwhen the producer writes 350 ms later. Reading through the existingprocess.stdinstream succeeds with the same delayed input; the immediate-input control passes too.We have a focused regression test for this boundary. So far this is a Node runtime test, not a run of the built AgentCore CLI or a Bun compatibility check.
Are you already covering delayed stdin in your fix? If not, we can contribute a targeted test without overlapping your implementation.