Skip to content

ax ssh: allocate a PTY when stdin is a terminal #790

Backlog

Description

@rakyll

ax ssh <task> runs the remote command on pipes, so full-screen programs such as Claude Code, vim or top do not work: tty prints "not a tty" and TERM is empty. The guest protocol's StartProcessRequest has no PTY or window-size field.

It does work today by allocating the PTY inside the sandbox by hand: stty raw -echo; ax ssh <task> -- sh -c 'export TERM=xterm-256color; exec script -qfc "stty rows 40 cols 120; exec claude" /dev/null'; stty sane. With that, the Claude Code TUI renders, and arrow keys, Enter and Ctrl-C reach it.

Proposal: make this the default when stdin is a terminal.

  • Add a PTY mode to ax-runner (for example ax-runner pty -- <cmd>) that opens a PTY and relays bytes, and have ax ssh call it through the existing StartProcess. This needs no Substrate protocol change and does not depend on the image shipping script.
  • ax ssh puts the local terminal in raw mode, sets TERM and the initial rows and columns, and restores the terminal on exit.
  • Forward window resizes (SIGWINCH) to the remote PTY.
  • Keep plain pipes when stdin is not a terminal, and add a flag to turn the PTY off.
  • Check the guest's default process timeout so that a long interactive session is not killed.

Longer term, a tty field and a resize RPC in the guest protocol (agent-substrate/env) would replace the runner-side helper.

Activity

  1. added this to the v0.5.0 milestone on Nov 26, 2026
  2. Abhaysiri commented on Nov 26, 2026

    @Abhaysiri

    Hello, I can take on this issue , could you assign it to me?

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions