Skip to content

Through a gateway, simlock adb and simctl send stdin only when asked with --stdin #1174

Closed
1 of 1 issue completed

Description

@V3RON

Request: #1172

Problem

simlock adb and simlock simctl against a gateway 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 with no output. Coding agents and scripts often start child processes that way.

Who it is for

A coding agent, CI job or script that runs simlock adb or simlock simctl through a gateway, from a harness that hands the CLI a piped stdin and never closes it.

Outcome

  • Through a gateway, simlock adb and simlock simctl run their command at once, whatever stdin is: an open pipe, a closed pipe, a file or a terminal.
  • A caller that wants to send input passes --stdin. The CLI then reads stdin to its end (Ctrl-D at a terminal) and sends it to the command.
  • Without --stdin, the command gets empty input and sees end of input at once.
  • On a worker nothing changes: the command runs here with the caller's own stdin, and --stdin is accepted and ignored.

How it works for the user

flowchart TD
  A[agent runs simlock adb ... through a gateway] --> B{--stdin given?}
  B -->|no| C[command runs at once, empty input]
  B -->|yes| D[CLI reads stdin to its end]
  D -->|stdin ends| E[command runs with that input]
  D -->|stdin never ends| F[waits, as the caller asked]
  C --> G[output streams back, CLI exits with the tool's code]
  E --> G
Loading

Before, through a gateway, from a harness whose stdin pipe stays open:

$ simlock adb shell getprop ro.build.version.sdk
(nothing; never returns)
$ echo hello | simlock adb shell cat
hello

After:

$ simlock adb shell getprop ro.build.version.sdk
36
$ echo hello | simlock adb shell cat
(prints nothing: cat gets empty input)
$ echo hello | simlock adb --stdin shell cat
hello
$ simlock adb --lease w1.3f9c --stdin shell cat < notes.txt
(the contents of notes.txt)

Examples

Command through a gateway stdin Today After
simlock adb shell getprop pipe left open hangs forever runs at once
simlock adb shell getprop terminal runs runs
simlock adb shell getprop < /dev/null runs runs
echo x | simlock adb shell cat closed pipe prints x prints nothing
echo x | simlock adb --stdin shell cat closed pipe --stdin goes to adb as an argument prints x
simlock adb --stdin shell cat terminal --stdin goes to adb as an argument reads until Ctrl-D, then prints it
simlock adb --stdin --lease L shell cat < f file --stdin goes to adb as an argument prints f
simlock adb --lease L --stdin shell cat < f file --stdin goes to adb as an argument prints f
simlock adb shell cat terminal waits until the exec timeout prints nothing, exits at once
simlock adb shell --stdin any --stdin goes to adb --stdin still goes to adb (after the tool's first argument)

What could go wrong

  • A script that pipes input into a remote adb shell without the new flag sends nothing, and its command sees empty input. Likely now and then until scripts add --stdin; the release notes say so.
  • A caller passes --stdin from a harness whose pipe never closes, and the command waits. That is what it asked for.

Words used

  • stdin: the input a command reads, e.g. the text in echo x | simlock adb shell cat.
  • through a gateway: the CLI talks to a gateway, and the command runs on the worker that holds the lease.
  • one-shot input: the whole input is read first, then sent once; nothing is sent while the command runs.

Non-goals

  • Sending input while the command runs, or a real interactive adb shell (no live keystrokes, no terminal on the far side). A separate request.
  • Any change on a worker, over HTTP, in MCP or on the gateway uplink.
  • A deprecation period or a warning release.

Completion conditions

  • Through a gateway, simlock adb with a piped stdin left open runs its command and exits with the tool's code (fast e2e, fake devices).
  • Through a gateway, --stdin sends what stdin carried, and without it the command gets empty input.
  • On a worker, --stdin is accepted and ignored.
  • The CLI reference and the CLI's manual describe --stdin, and the known gap about the hang is gone.

Open questions

none

Decisions

Shared values

none

Behaviours

Behaviour (invoker, action, what it sees) Seam Cases Task
A user runs simlock adb or simlock simctl through a gateway, and device.exec carries stdin only when --stdin was given runCli in src/cli/index.test.ts, fake gateway client adb and simctl; no flag with a stdin that never ends → sent with stdin: "", stdin never read; --stdin → stdin's contents sent; --stdin before --lease and after it; --stdin after the tool's first argument → passed to the tool #1176
A user runs simlock adb --stdin on a worker, and the flag is accepted and ignored runCli in src/cli/index.test.ts, fake worker client --stdin alone; with --lease #1176
A user passes --stdin at a terminal, and the CLI reads what they type until it ends readPipedStdin tests in src/cli/index.test.ts terminal stdin → its chunks joined; piped stdin as today #1176
An agent runs simlock adb through a real gateway with a piped stdin left open, and the command runs, gets empty input and exits with the tool's code e2e/gateway-smoke.test.ts, fake devices the existing exec step without input: "", with --fake-exec-echo-stdin showing "" #1176

Tasks

Completion conditions: all four are #1176's Done when.

Open work in the same area:

Written by an agent.

Sub-issues

Sub-issues

1 of 1 Issues completed
Loading 1 sub-issues

Activity

  1. added
    feature:spec
    on Nov 1, 2026
  2. V3RON commented on Nov 1, 2026

    @V3RON
    ContributorAuthor

    Spec updated: Problem through Behaviours written, with ADR 0058 (PR #1175) and task #1176.

    Written by an agent.

  3. added
    feature:planned
    and removed
    feature:spec
    on Nov 1, 2026
  4. github-actions commented on Nov 1, 2026

    @github-actions
    Contributor

    Closing: all 1 sub-issues are closed. The PR that closed the last one walks the completion conditions (delivery rule 9); reopen this if one does not hold on main. Flip its ADRs to Accepted if delivery has not.

  5. V3RON commented on Nov 1, 2026

    @V3RON
    ContributorAuthor

    Delivery run

    Merged: #1175 (ADR 0058, now Accepted), #1178 (#1176)

    Written by an agent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature:planned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions