Skip to content

[feature] Linux terminal: add PTY input, resize and clean console handoff #246

Description

@AetherAI3

Gap

The current shell runner ignores stdin and pipes stdout/stderr. It cannot support an interactive CLI asking for input, terminal-aware programs, or a live shell handoff. Existing process-tree cancellation should be retained.

Deliverable

  • Add an explicit interactive PTY session path for Linux, with visible terminal ownership and a clear detach/return-to-chat action. Transfer raw mode/input safely; pause competing composer/status repaint while the child owns the terminal.
  • Forward input, Ctrl+C and terminal resize to the correct foreground child. Distinguish cancelling a command, detaching from it and exiting the Agent.
  • Stream output while the command runs. Restore terminal modes, cursor, composer draft and prompt after normal exit, cancellation, launch failure or child crash.
  • Keep noninteractive model tools on bounded capture unless an interactive session is explicitly approved. Show an actionable unsupported message on non-TTY input; provide a documented platform fallback.
  • Surface running session IDs and an explicit stop action; restarting the console must not silently replay a command.

Acceptance

A controlled interactive fixture reads input and reports terminal dimensions; a long-running fixture streams progress. Test resize, Ctrl+C, detach/reattach if supported, crash and return to normal chat. Verify no orphan child, duplicate stdin consumer, damaged raw mode or lost draft. Include a real Linux PTY integration test.

Priority: P2. Build on local shell routing/session ownership; do not attach Online DMs to a local terminal implicitly.

Related: #244, #245.

Activity

  1. AetherAI3 commented on Oct 1, 2026

    @AetherAI3
    OwnerAuthor

    Reviewed against current main and the open PRs after #251 landed. This issue is not ready to close: the coding console still uses noninteractive pipes and gives shell commands no console stdin; no Linux PTY input/resize/handoff path or real PTY integration fixture has landed. #244 is closed by #251. #245 is adding persistent noninteractive state separately. Keeping #246 open until interactive input, resize/foreground Ctrl+C, terminal ownership/restoration and the real Linux PTY acceptance test are implemented and reviewed.

  2. added a commit that references this issue on Oct 1, 2026
    e17ff4c
  3. AetherAI3 commented on Oct 1, 2026

    @AetherAI3
    OwnerAuthor

    Completed and landed in #254, squash commit e17ff4c.

    Use /terminal <command> in the Linux coding console. Ctrl+C interrupts the foreground command; Ctrl+] detaches and returns to chat. /terminal-attach, /terminal-status and /terminal-stop manage the visible session. Input/resize/output stream through a real controlling PTY. Console input/repaint pause while attached; terminal modes and composer restore on return, including preservation of a draft after a detached child crash. Console shutdown stops the session; restarting never replays it.

    Acceptance reviewed and tested: eight Linux PTY integration tests exercise input and dimensions, progress, resize, Ctrl+C, stop/process cleanup, failed helper launch, crash/restart, detach/reattach and raw-mode restoration, normal model chat, preserved draft and conservative user-edit attribution. The final complete suite passed: 2,927 passed, 11 skipped, 0 failed. Build/typecheck, docs check, production package verification and release truth passed. Published/merged source tree matches the tested tree: 097cfdf917a8e494a687dbb34c59d8597b163f66. Hosted CI failed before allocating runners/executing steps; no hosted or Windows pass is claimed.

    Documented limits: Linux + Python 3 + real TTY required; use !command for noninteractive/platform fallback. One active PTY reserves local tools until exit/stop, starts in the selected shell cwd with a filtered environment, and does not inherit persistent Bash exports/functions. It is an explicit local user terminal, with no implicit Online DM/ATS authority. Closing as completed.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions