Skip to content

Move terminal side-effect authority to a main facts channel - #5098

Closed
nwparker wants to merge 9 commits into
nwparker/term-speed-2-main-title-trackerfrom
nwparker/term-speed-2-side-effect-channel
Closed

nwparker wants to merge 9 commits into
nwparker/term-speed-2-main-title-trackerfrom
nwparker/term-speed-2-side-effect-channel

Conversation

@nwparker

@nwparker nwparker commented Jun 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Phase 3 slice 2 (design: docs/reference/terminal-side-effect-authority.md). Terminal side effects for PTYs whose bytes transit main (local-daemon + SSH) are now derived once in the main process and delivered to the renderer as facts, replacing renderer byte parsing for those PTYs.

  • new batched pty:sideEffect channel: per-chunk facts (title / bell / agent-working / agent-idle / agent-exited) in byte order with attribution + output seq; bell detector lifted to src/shared/terminal-bell-detector.ts
  • one renderer subscriber (terminal-side-effect-facts-handler.ts) with exactly-one-consumer-per-PTY semantics, title-only replay snapshots (no historical-bell attention), and a seq guard against snapshot/live races
  • authority is structural per PTY kind: remote-runtime PTYs keep renderer parsing permanently; local/SSH flip behind settings.terminalMainSideEffectAuthority (default on, read synchronously pre-hydration so the kill switch holds at app-restart bindings)
  • the parked byte watcher uses fact mode for covered PTYs (no double-fire); mounted panes register the same policy callbacks as fact consumers at all binding sites
  • synthetic agent title/permission frames now ingest into main's tracker via a stateless frame parser (fresh detector instance — zero shared state with real chunk parsing); the legacy pty:data copy remains until slice 3

Review hardening (3-lens adversarial review, all findings fixed with tests)

  • main's tracker is seeded from PTY records/daemon snapshots so app relaunch cannot lose parked working→idle completions or strand stale 'working' titles (red-verified)
  • spinner ticks no longer fan out mobile session snapshots at ~12.5 Hz per pane (decorative gate on braille-stripped normalized title + status)
  • per-chunk cross-channel order fixed to agent-status → side-effect facts per the design contract
  • stale-title-derived idle clears titles/cache-timer but never schedules a completion OS notification (tag threaded through BOTH title and idle facts — the pane path classifies titles independently)
  • hot-path scan merge, finally-flush seq integrity, headless-serve allocation skip, snapshot cursor-literal drop

Validation

  • typecheck clean (including web-preload parity stubs); oxlint clean
  • 1,032 unit tests across 23 suites green, including the byte-vs-channel store-outcome parity harness and bell-ordering parity cases
  • e2e with the flip default-ON: terminal-attention, droid-notification, parking 3/3, parked-memory 2/2, hidden TUI restore 4/4, sleep/wake, golden 2/2 — all green (17-test sweep pre-fix, 14-test sweep post-fix)

Cut-off

Independently mergeable. Slice 3 removes the synthetic pty:data legacy copy and adds OSC 133;D + PR-link facts; slice 4 retires the watcher's byte sidecar.

Made with Orca 🐋

nwparker and others added 5 commits June 10, 2026 02:20
…/term-speed-2-side-effect-channel

# Conflicts:
#	src/main/index.ts
#	src/main/ipc/settings.test.ts
#	src/main/runtime/orca-runtime.ts
…/term-speed-2-side-effect-channel

# Conflicts:
#	src/shared/agent-detection.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