Summary
claim_screen
enter 1049 → mouse on → hide → clear → home
normal quit / signal / panic / child handoff
delete images → pop keyboard → SCREEN_RESTORE
mouse off → reports off → sync end → cursor on → reset
clear (fallback) → home → leave 1049 (shell screen and scrollback)
launcher SIGINT / SIGTERM / SIGHUP
forward to child → 1 s grace → SIGKILL if needed
reap → restore pre-child termios → parent screen restore → child exit codeNormal cleanup is idempotent, so Keyboard::restore followed by restore_screen cannot clear the shell after the first restore. Signal transitions hold the terminal thread's guard across 1049 output; worker-delivered requests defer to that thread instead of racing another restore. Fatal requests are sticky, while suspend/resume uses latest-state coalescing. Cleanup no longer drains under the signal hold, and it works when only stdout is a tty. Panic reasons and requested backtraces print after restoration, including with RUST_BACKTRACE=0 behaving as disabled. Suspend/resume and child reclaim enter a fresh alternate screen. The no-write hang-up exception is unchanged. Widgets still construct no exit escapes, and widgets/tests/check.rs enforces the shared route.
Evidence
- Before: panic restored only termios/mouse,
2Jcould leave frames in scrollback, and a killed launcher could orphan its widget. After: all thirteen pty scenarios pass inwidgets/tests/exit.rs: requiredq/SIGINT/SIGTERM/panic/launcher routes, direct and interactive launchers, SIGHUP parent cleanup, stubborn-child SIGKILL after the grace period, enabled and disabled backtraces, redirected-stdin panic cleanup, normal menu child return, and suspend/resume. Launcher and resume tests also assert restored termios. - After: full
cargo testpasses, including 71check.rstests, the thirteen pty tests, hang-up, notices, npm, and doc tests. - After:
cargo build --releasepasses;ldd target/release/{matrix,opscope}still shows only the existing libc/libm/libgcc runtime set. - After: isolated tmux release-binary checks pass for
q, SIGTERM, forced panic and launcher SIGTERM. Pre-existing shell text remains, no widget footer enters scrollback, and the panic reason survives on the restored main screen. - Still to check by hand: Kitty and a plain xterm-compatible terminal; neither binary is available in this environment.
- Pre-existing, unchanged:
core/tests/terminal_protocol.pycurrently loses its first image inscroll_clears_previous_image_region. The same failure was reproduced against an untouchedorigin/mainarchive; its exploratory changes were not kept in this PR.
Merge Danger
Door: two-way — revert the PR to restore the previous terminal lifecycle.
Blast Radius: collection-wide terminal entry/exit and launcher child supervision. Widget drawing and data acquisition are unchanged. No dependencies were added.
Refs OPS-236 Closes #513
Activity
5- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
| Review | Status | Commit | Review trigger |
|---|---|---|---|
| 📝 Code Review | ✅ Completed 2026-11-18T08:44:00.184464Z | fe35176 | Draft marked ready |
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review" or "@codex security review".
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.