feat(console): Linux PTY input, resize and clean chat handoff - #254
Conversation
Add stdin, resize, interrupt, detach/reattach, stop, process cleanup and terminal restoration with conservative user edit attribution. Closes #246.
AetherAI3
left a comment
There was a problem hiding this comment.
Implementation self-review against #246: explicit user PTY authority and visible session ID; one input owner and paused composer/status paints; forwarded input/Ctrl+C/resize; distinct detach/stop/console-exit; normal, failed-launch and crash restoration; preserved draft after detached crash; no automatic replay; one active PTY reserves tool execution and attributes changes to the user. Linux/Python 3/TTY requirements and !command fallback documented. Noninteractive bounded capture and latest #247 changes preserved.
Exact reviewed/tested tree 097cfdf917a8e494a687dbb34c59d8597b163f66 matches the GitHub commit. Eight real PTY tests and final full suite pass: 2,927 passed, 11 skipped, 0 failed. Build/typecheck, docs check, production package and release truth pass. Hosted CI jobs failed before runner allocation (runner_id=0, steps=[]); clean-install skipped. This is a self-review, not an independent approval.
Closes #246.
The coding console can now hand its terminal to an explicit
/terminal <command>and return to chat after exit or Ctrl+]./terminal-attach,/terminal-statusand/terminal-stopexpose the one active session. Input, Ctrl+C and resize reach the child PTY; output streams live. Console repaint/input pause while attached, terminal modes restore on return, and a detached exit preserves the composer draft.A Python 3 standard-library bridge creates the Linux controlling terminal, cleans up owned process groups and reports launch/crash failures without replay. Detached terminals reserve local execution authority: model/user tools refuse until stop/exit, and interactive edits remain user-owned for automatic commits. Noninteractive
!commandand model tools retain existing bounded capture. This is a local user console command; it grants no Online/ATS authority.Requirements and limits: Linux, Python 3 and TTY stdin/stdout; other platforms/pipes use
!command. The PTY starts in the selected shell cwd with a filtered environment, without inheriting persistent shell exports/functions. Reattachment replays only the latest 8 KiB; sessions do not survive console exit.Validation on latest main (including #247): eight real Linux PTY tests cover input/dimensions/progress, resize, foreground Ctrl+C, stop cleanup, missing helper, crash/restart, ownership blocking, detach/reattach/raw-mode restoration, normal model chat and draft preservation after detached crash. TypeScript build, generated docs, production package verification and release truth pass. The final isolated full suite passes: 2,927 passed, 11 skipped, 0 failed (2,938 total, 167.9 seconds). Earlier runs exposed intermittent spawn-fixture failures; the final run used no concurrent builds. Hosted CI did not execute: failing jobs have no runner or steps, and clean install is skipped. No Windows or hosted CodeQL pass is claimed. Exact published source tree:
097cfdf917a8e494a687dbb34c59d8597b163f66.