Skip to content

Answer hidden terminal queries from the model - #5152

Closed
nwparker wants to merge 13 commits into
nwparker/term-speed-2-hidden-delivery-gatefrom
nwparker/term-speed-2-model-query-responder
Closed

nwparker wants to merge 13 commits into
nwparker/term-speed-2-hidden-delivery-gatefrom
nwparker/term-speed-2-model-query-responder

Conversation

@nwparker

@nwparker nwparker commented Jun 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Phase 5 slice 1 (design: docs/reference/terminal-query-authority.md, committed in the Phase 4 PR). Hidden-gated terminals get their query replies back: main's per-PTY headless emulator now auto-answers DA1/DA2, DSR 5n, CPR, DECRPM, DECRQSS, XTVERSION, and kitty ? u for queries embedded in chunks the delivery gate dropped — the class of replies that have been silently dropped for hidden panes since the skip-latch era.

  • the delivery decision is the reply decision: ownership is captured per-chunk at ingestion onto the emulator writeChain (async-safe), using the same predicate that drops the bytes — double replies are structurally impossible
  • replies flow from the emulator's own parser (same xterm core as the renderer — parity by construction) through a forward window scoped exactly to the flagged chunk's parse; seeds, hydration, and snapshot writes never forward (main-side replay guard)
  • suppressions: delivered chunks, the codex startup window, remote-runtime PTYs, delivery-interest holders, attached remote view subscribers (new ref-counted registry across all three RPC subscribe surfaces), and kill switches (terminalModelQueryAuthority default on, atop the Phase 4 switches)
  • ConPTY DA1 answers the Windows-correct ?61;4c via a main-side spawn-record mirror with idempotent retrofit (mark can race warm-reattach data)
  • kitty keyboard protocol enabled parse-only in the emulator; TerminalModes.kittyKeyboardFlags exposed for future re-seed parity (annotated; consumer lands in slice 3)
  • the daemon session emulator stays write-only forever — session.test.ts assertions unchanged

Review hardening (2-lens adversarial review, all findings fixed, 6 red-verified)

  • stale writeChain replies can no longer inject into a successor PTY reusing a session id (state-identity check in the sink + synchronous sink severing on dispose)
  • the async-write forwarding window is bracketed by parse-order sentinel callbacks, making the replay guard structural rather than dependent on writeSync availability
  • multiplex same-streamId overwrite no longer orphans view-subscriber registrations (which would permanently silence the responder); eviction can no longer detach the successor stream
  • renderer/main ConPTY classification parity (global Windows shell setting folded on both sides)

Validation

  • typecheck clean; oxlint clean
  • 2,300+ unit tests green across runtime/daemon/ipc/renderer suites, incl. 69 responder/ownership tests (reply parity pinned against the bundled headless build, ownership matrix, replay guard, writeChain races, ConPTY retrofit)
  • e2e: hidden TUI visual restore 4/4, parking 3/3, attention, 11-test sweep + golden 2/2 on fresh builds

Cut-off

Independently mergeable (unblocks hidden DA1/CPR-blocked TUIs immediately). Slice 2 adds the view-attribute bridge (OSC 4/10/11/12, ?996n); slice 3 aligns the contract docs and Phase 6 prerequisites.

Made with Orca 🐋

nwparker and others added 2 commits June 10, 2026 20:41
Co-authored-by: Orca <help@stably.ai>
…er/term-speed-2-model-query-responder

# Conflicts:
#	src/main/daemon/headless-emulator.ts
#	src/renderer/src/components/terminal-pane/pty-connection.ts
@ghost

ghost commented Jun 16, 2026 •

Copy link
Copy Markdown

@nwparker

Copy link
Copy Markdown
Contributor Author

Closing as superseded by merged PR #7214 (merge e84a8dd), which explicitly revived the complete term-speed-2 model/view chain into current main and then added newer scheduler, producer flow-control, snapshot, and reliability work. This old component/rollup branch no longer has an independent delta to rebase.

@nwparker nwparker closed this Jul 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant