Embed shared terminal interaction in the TUI - #73
Conversation
Initial high-risk review: GPT-5.6 LunaPinned exact head BLOCKING: bracketed paste delimiters are dropped
BLOCKING: application cursor mode is not honoredThe encoder always emits normal cursor sequences and does not track DECCKM. An app requesting Residual gap: no real Bubble Tea TTY/full-screen app walkthrough yet. Mouse, Kitty keyboard, and unknown CSI remain stated limitations. NEEDS ATTENTION |
Initial high-risk review: Grok 4.6Pinned exact head BLOCKING: superseded live attachment leaksA later FOLLOW-UP: clamp emulator heightMidterm VPA/IL handling can grow FOLLOW-UP: test device responses
No other blockers. PTY resize argument order, Ctrl-G interception, stale generation handling, backpressure, and unchanged browser controls were verified. NEEDS ATTENTION |
Review-wave dispositionAll findings are accepted and will be remediated together before a new review head:
The blockers and follow-ups will be batched into one remediation commit. Both original reviewer contexts will verify their findings and the complete remediation delta after the new exact head is green. |
Remediation pushedNew head:
Remediation verification:
Each remediation gate was deliberately broken alone and restored:
Both original reviewer contexts will verify this exact head only after CI is green. |
Exact-head remediation approval: GPT-5.6 LunaVerified exact target Bracketed-paste and DECCKM tracking, superseded-client detachment/generation filtering, active/alternate emulator clamping, and serialized device responses are fixed and covered by reachable mutation tests. No remediation-caused or newly exposed material defects were found. Residual risk is limited to the documented absence of a real-TTY/full-screen integration walkthrough; fake-attachment and mutation coverage directly exercise the remediated paths. APPROVE |
Exact-head remediation approval: Grok 4.6Pinned and verified All prior findings are fixed: superseded live clients detach; hostile VPA/IL growth clamps to 80x27 while preserving 30-line chrome; DSR/DA writes remain behind in-flight user input; DECCKM emits SS3 arrows; bracketed paste wraps only while enabled. Each assertion was proven reachable through a deliberate failing mutation. No findings and no remediation-caused or newly exposed material defects. Residual limitations remain the documented fake-attachment test surface, unrecoverable Kitty/unknown CSI, and wide-cell rendering. APPROVE |
Closes nicodes/ormos-be#507
Summary
tea.Exechandoff with a terminal screen owned by the existing Bubble Tea programgithub.com/vito/midterm@v0.2.5, so PTY cursor, erase, SGR, and alternate-screen sequences cannot escape into Bubble TeaTerminalClientand exact persistedprojectID:sessionIDkey; shared PTY registry, browser transport, replay, scheduler, and expiry code are unchangedWindowSizeMsg, and intercept Ctrl-G before PTY inputCtrl-G: dashboardfooterRisk
Risk: high. This changes terminal input/output ownership, VT rendering, resize, and multi-client interaction. It does not change authentication, authorization, shared-session identity, browser wire behavior, or PTY registry ownership. Two independent reviewers are required on one unchanged exact green head.
Versioned references
1.25.13: https://go.dev/doc/go1.25v1.3.10: https://pkg.go.dev/github.com/charmbracelet/bubbletea@v1.3.10v0.2.5: https://pkg.go.dev/github.com/vito/midterm@v0.2.5Bubble Tea documents
tea.Execas pausing the Program. Its renderer rewrites a line-orientedView, so raw PTY control bytes cannot safely be painted directly. Midterm is an in-memory terminal emulator intended for terminals embedded in TUIs;Renderemits screen cells and SGR rather than PTY cursor/OSC/erase commands.Verification
go test ./... -count=1go test -race -count=1 ./...go vet ./...govulncheck ./...: zero reachable vulnerabilities; one required-module vulnerability is not on a called pathgo mod verify: all modules verifiedgofmt -l .: no outputgit diff --check: no outputCGO_ENABLED=0internal/systemtest binaries: amd64 and arm64GOOS=windows GOARCH=amd64andGOOS=js GOARCH=wasmselect onlygithub.com/nicodes/ormos/relayTestLocalTerminalClientSharesBrowserSessionremains unchanged and passes in the full/race suitesMutation evidence
Each mutation was applied alone, its focused test was run with
-count=1, and the production implementation was restored before final verification:TestTerminalScreenRendersOutputAndSerializesInputfailed withCtrl-G left mode 3terminal view missing chrome or outputand showed an empty 27-row screensecond input started before the first completedrows+1to the shared PTY on resize:TestTerminalScreenResizesSharedPTYfailed withresizes = [][2]int{[2]int{100, 38}}TestTerminalScreenIgnoresStaleAttachAfterDetachfailed withstale attach mode=0 terminal=false detach=0TestTerminalScreenAttachFailureReturnsSafelyfailed while exposing the injected OSC sequence inm.errTestTerminalScreenRetriesBackpressureAndReturnsErrorsSafelyfailed withwrite attempts = 1Known limitations
KeyMsgvalues rather than arbitrary stdin bytes. Common xterm keys, modifiers, function keys, controls, Unicode, and paste are encoded explicitly; unknown CSI and Kitty keyboard sequences cannot be recovered from the public API.