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
simlock adb through a gateway hangs while a piped stdin stays open #1172
simlock adb and simlock simctl against a gateway (the remote path) never run their command when stdin is a pipe that stays open. They wait for stdin to close first, so a caller that spawns the CLI with a piped stdin it never closes hangs forever. Coding agents and scripts often start child processes that way.
src/cli/commands/passthrough.ts:57: runRemotePassthrough awaits environment.readStdin() before it calls client.exec.
src/cli/environment.ts:409: readStdin defaults to readPipedStdin, which reads to end of file whenever stdin is not a TTY.
Seen while making the tunnel slow-lane tests pass (#1110, PR #1127). A test's simlock adb --lease <id> shell … through a gateway never returned until the test closed the child's stdin. The output showed nothing, so it looked like the tunnel failing.
Expected: a command that doesn't need input runs without waiting for stdin to close, or the CLI documents that it reads piped stdin to EOF and gives a way to say there is no input.
Decision, not a defect. The CLI does what ADR 0005 §19c says: "a piped stdin is read to EOF first and sent as 19a's one-shot string." The test's expectation is a proposal for a superseding ADR. Branch bug/1172-repro, src/cli/index.test.ts, "runs $tool through a gateway without waiting for a piped stdin that stays open" (adb and simctl). It fakes readStdin as a promise that never settles, so no timer decides the result.
pnpm exec vitest run --project unit src/cli/index.test.ts -t "piped stdin that stays open"
FAIL runs adb through a gateway without waiting for a piped stdin that stays open
AssertionError: expected [] to deeply equal [ { args: [ 'shell', 'getprop' ], …(3) } ]
FAIL runs simctl through a gateway without waiting for a piped stdin that stays open
AssertionError: expected [] to deeply equal [ { args: [ 'list' ], …(3) } ]
It passes when the gateway path skips the stdin read (checked locally, not pushed).
Root cause
src/cli/commands/passthrough.ts:58 awaits environment.readStdin() before client.exec. The default, readPipedStdin (src/cli/stdio.ts:5), reads any non-TTY stdin until EOF. A pipe nobody closes never gets EOF, so device.exec is never sent. ADR 0005 §19a's one-shot stdin string means the CLI must have all of stdin before it sends. The hang is the known cost of that choice: e2e/gateway-smoke.test.ts:180 says so and works around it with input: "".
Simplest fix
A superseding ADR for §19c, then opt-in stdin through a gateway: a --stdin flag, removed from the arguments next to --lease in extractLeaseFlag (passthrough.ts:81). Without it, the CLI never reads stdin, like docker exec -i and kubectl exec -i. The flag name is my proposal. Update website/.../reference/cli.mdx:172 ("a piped stdin is sent along"); the existing one-shot-stdin test then needs the flag.
Alternatives rejected
Stream stdin over device.exec: changes the wire on HTTP, the uplink and MCP, so it is a feature.
Only document </dev/null: callers that spawn with stdio: "pipe" still hang silently.
Send what arrived within a short wait: timing-dependent, races with slow writers.
Risk
Breaking: echo x | simlock adb shell cat through a gateway would need --stdin.
The workaround comment in gateway-smoke.test.ts becomes out of date.
The local (worker) path keeps inherited stdio, unchanged.
Fixed by #1174, which merged as #1178. Through a gateway, simlock adb and simlock simctl no longer read stdin unless you pass --stdin, so a pipe that stays open can't hang them. To send input, use simlock adb --stdin shell cat < file.
Activity
V3RON commentedon Nov 1, 2026
Reproduction
Decision, not a defect. The CLI does what ADR 0005 §19c says: "a piped stdin is read to EOF first and sent as 19a's one-shot string." The test's expectation is a proposal for a superseding ADR. Branch
bug/1172-repro,src/cli/index.test.ts, "runs $tool through a gateway without waiting for a piped stdin that stays open" (adb and simctl). It fakesreadStdinas a promise that never settles, so no timer decides the result.It passes when the gateway path skips the stdin read (checked locally, not pushed).
Root cause
src/cli/commands/passthrough.ts:58awaitsenvironment.readStdin()beforeclient.exec. The default,readPipedStdin(src/cli/stdio.ts:5), reads any non-TTY stdin until EOF. A pipe nobody closes never gets EOF, sodevice.execis never sent. ADR 0005 §19a's one-shotstdinstring means the CLI must have all of stdin before it sends. The hang is the known cost of that choice:e2e/gateway-smoke.test.ts:180says so and works around it withinput: "".Simplest fix
A superseding ADR for §19c, then opt-in stdin through a gateway: a
--stdinflag, removed from the arguments next to--leaseinextractLeaseFlag(passthrough.ts:81). Without it, the CLI never reads stdin, likedocker exec -iandkubectl exec -i. The flag name is my proposal. Updatewebsite/.../reference/cli.mdx:172("a piped stdin is sent along"); the existing one-shot-stdin test then needs the flag.Alternatives rejected
device.exec: changes the wire on HTTP, the uplink and MCP, so it is a feature.</dev/null: callers that spawn withstdio: "pipe"still hang silently.Risk
echo x | simlock adb shell catthrough a gateway would need--stdin.gateway-smoke.test.tsbecomes out of date.Written by an agent.
V3RON commentedon Nov 1, 2026
Being specified in #1174. This issue stays open until that feature ships.
Written by an agent.
github-actions commentedon Nov 1, 2026
Shipped as #1174.
V3RON commentedon Nov 1, 2026
Fixed by #1174, which merged as #1178. Through a gateway,
simlock adbandsimlock simctlno longer read stdin unless you pass--stdin, so a pipe that stays open can't hang them. To send input, usesimlock adb --stdin shell cat < file.Written by an agent.