Skip to content

openshell sandbox exec --tty hangs on interactive commands #1330

@benoitf

Description

@benoitf

Agent Diagnostic

  • Loaded openshell-cli skill and inspected crates/openshell-cli/src/run.rs
  • Traced the sandbox_exec_grpc function: the existing unary ExecSandbox RPC sends all stdin upfront in the request body and streams stdout/stderr back. When --tty is used, the terminal is in raw mode but stdin is still buffered into a single blob before the exec call, so interactive programs (bash, top, vim, claude, opencode) never receive live keystrokes.
  • Confirmed the proto definition (proto/openshell.proto) has no bidirectional streaming RPC for exec — only the unary ExecSandbox(ExecSandboxRequest) returns (stream ExecSandboxEvent).
  • Checked crates/openshell-server/src/grpc/sandbox.rs — the server handler reads ExecSandboxRequest.stdin once and pipes it into the SSH channel, then only streams output back. No mechanism exists to forward ongoing client input.
  • The non-interactive path (-- ls, -- cat file) works fine because stdin is consumed before the call. Only interactive TTY sessions are broken.

Description

Running openshell sandbox exec --tty <sandbox> -- <interactive-command> hangs immediately. The command starts on the remote side but the user cannot interact with it — keystrokes are not forwarded, and the session never exits cleanly.

What happens:

  1. openshell sandbox exec --tty my-sandbox -- bash — hangs, no prompt appears (or appears but does not accept input)
  2. openshell sandbox exec --tty my-sandbox -- top — UI renders once but q does not quit
  3. TUI apps (opencode, claude) render initial UI but freeze

What should happen:
Interactive TTY sessions should behave like ssh — live keystroke forwarding, terminal resize propagation, and clean exit on Ctrl+D or process termination.

Root cause: The ExecSandbox RPC is unary request / server-stream response. There is no client-to-server stream to carry ongoing stdin, resize events, or EOF signals during execution.

Reproduction Steps

  1. Create a sandbox: openshell sandbox create --provider docker -- bash
  2. Run an interactive command: openshell sandbox exec --tty <sandbox-name> -- bash
  3. Observe: the session hangs; keystrokes are not forwarded
  4. Try with top: openshell sandbox exec --tty <sandbox-name> -- topq does not quit

Environment

  • OS: macOS 26 / Linux
  • OpenShell: built from main branch
  • Terminal: iTerm2, Terminal.app, any terminal emulator

Logs

# No error output — the CLI simply hangs after establishing the connection.
# With --tty, stdin bytes are sent in the initial request but no further
# input can reach the remote process.

Agent-First Checklist

  • I pointed my agent at the repo and had it investigate this issue
  • I loaded relevant skills (e.g., debug-openshell-cluster, debug-inference, openshell-cli)
  • My agent could not resolve this — the diagnostic above explains why

Metadata

Metadata

Assignees

No one assigned

    Labels

    state:triage-neededOpened without agent diagnostics and needs triage

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions