Skip to content

Guest protocol: tty and window resize for StartProcess #104

Open

Description

ax ssh (soon ax exec, google/ax#492) runs commands through the env guest ProcessService, which has no pty today: -i gives a prompt but no job control or full-screen tools (google/ax#374). Proposal, all additive:

  • StartProcessRequest gets an optional tty with rows/cols. When set, the tracker allocates a pty (Setsid + Setctty), puts merged output on stdout, and treats EIO on the master as EOF.
  • A unary ResizeProcess(process_id, rows, cols) RPC (SIGNAL_WINCH carries no size).
  • tty processes exempt from the 10 MB output cap, or use a ring buffer, so long top/vim sessions don't go silent.

Old clients and servers keep working. Happy to send the PR if this shape works for you.

Activity

  1. tomergee commented on Oct 18, 2026

    @tomergee
    Collaborator

    Confirmed and implemented in #107.

    Summary of Changes

    • Proto (proto/ateenv/v1alpha/guest.proto): Added message TTY { uint32 rows = 1; uint32 cols = 2; }, TTY tty = 6 on StartProcessRequest, and rpc ResizeProcess(ResizeProcessRequest) returns (ResizeProcessResponse) on ProcessService (regenerated Go and Python stubs).
    • Guest PTY lifecycle (guest/process/pty_linux.go, guest/process/tracker.go, guest/process/service.go):
      • Opens a pty pair (/dev/ptmx + TIOCGPTPEER), applies initial window dimensions via TIOCSWINSZ, and launches the child with Setsid: true, Setctty: true, Ctty: 0 with Stdin/Stdout/Stderr bound to the slave fd.
      • Streams the master fd into the stdout spool (stderr remains empty), exempts tty processes from the 10 MB MaxLogBytes truncation cap, and treats EIO when the last slave closes as clean EOF.
      • Implements ResizeProcess via TIOCSWINSZ on the master fd (delivering SIGWINCH to the foreground process group) and returns FailedPrecondition if the process was started without tty or has already exited.
    • API Proxy & Go SDK (internal/apiservice/server.go, clients/go/process.go): Added Server.ResizeProcess proxy forwarding and (*Process).Resize(ctx, rows, cols).
  2. anzal1 commented on Oct 18, 2026

    @anzal1
    Author

    Thanks for picking this up so fast! I'll do the ax client side (raw mode, SIGWINCH resize, ~. escape) on top of #107 and google/ax#492 once they land.

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

    enhancementNew feature or requestgoPull requests that update go code

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions