writeonce/docs/stories/runtime-v2/04-termios.md
shoney.arickathil 3190b609af docs(rt2): track-wide brainstorm — all five iterations ready, graph remapped
- spec 2026-09-01-runtime-v2-design.md: the one principle (PULL — a
  child is fds, the net verbs drive them; runtime-v2 adds acquisition
  verbs, never transport), the full surface (ids 97+: spawn/spawn_pty/
  wait_dl/signal/resize, signal.on delivering the sig number, term.raw/
  restore with runtime-guaranteed restore, send_fd/recv_fd/connect_unix),
  actor-owned lifecycle, mechanics notes, refusals by name
- push transport rejected with reasons recorded (mailbox-cap collision,
  new delivery machinery); death-notice verb refused (a two-line fiber
  composes wait_dl)
- five stories flip readiness: ready; fork sections rewritten as settled
- graph section 6 remapped: pull broke the 1->2->3 chain — only 1->2
  remains; 3, 4, 5 and the VTE grid startable alone today
- board section + registry follow; linkcheck 0 broken

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
(cherry picked from commit d313cdeebbe53c83b83f31f4480631568d9d0743)
2026-09-15 01:15:30 +02:00

1.8 KiB

track iteration status readiness
runtime-v2 4 pending ready

runtime-v2 4 — termios adoption: raw mode on a terminal we were given

Part of Story — runtime-v2: the runtime beyond sockets. No incoming edges — startable alone, any time.

The problem. 2 creates terminals for children; this adopts the one the PROCESS was given. A wmux client must put its own stdin into raw mode (no echo, no line buffering, keys arrive as they are typed) and — non-negotiably — restore it on every exit path, including a trap. A terminal left raw is the classic way a program makes a user's shell unusable.

Info — the forks, settled (brainstorm 2026-09-01; spec:

2026-09-01-runtime-v2-design.md)

  1. Exactly two verbs: term.raw(fd) and term.restore(fd). Saved termios live in a per-shard table keyed by fd (one thread — no locks); double-raw on one fd refuses by name; no flag knobs.
  2. Restore is a RUNTIME OBLIGATION. Fiber unwind, engine stop and wo_vm_destroy restore every saved tty, newest first — "no orphan" has its terminal-state sibling: no wrecked tty, ever, trap paths included.
  3. fd-taking from day one — a tty received via 5 works without the verb growing an argument later.

Acceptance sketch

  • Raw on, keystroke arrives unbuffered and unechoed (driven under a 2 PTY in the test — the two iterations prove each other).
  • Restore: tcgetattr before equals after, on the normal path AND after a deliberate trap while raw.
  • The stop path restores too — SIGTERM while raw leaves a sane terminal.

Consumers

wmux 1's client half. The alacritty stage-A harness benefits but does not require it.