mirror of
https://github.com/stablyai/orca.git
synced 2026-10-17 00:03:08 +00:00
Grafts the sleep/wake terminal-recovery rework (PR #7260) into the RC perf line. Resolution principle: this branch's structure wins; the rework's delivery-accounting semantics graft in. Kept from orca-performance: - Producer flow control v19: PRODUCER_FLOW_CONTROL_ENABLED kill switch, every updateProducerFlowControl call site where pendingData mutates (256KB/32KB watermarks, pause/resume daemon notifications), and producerFlowControl.releaseAll/release on destroy/exit. Flow control keys off pendingData only, so it composes with the new renderer delivery accounting untouched. - PTY_BATCH_INTERVAL_MS = 2 with its daemon-stream-data-batcher pairing comment; merged resync tests adapted to the 2ms window. - Chain structure: hidden-delivery gate (drop + restore markers), pending-output cap with droppedOutput sentinel, overflow marker set. Grafted from fix/terminal-wake-ack-recovery: - TCP-style cumulative delivery accounting (sentChars/ackedChars max-merge; legacy delta payloads still accepted) replacing the relative in-flight counter map — lost ACKs self-heal instead of becoming permanent gate debt. - Solicited delivery resync (probe on data-arrival-while-fully-gated, verified-state reconcile on reply, 5s hygiene-only timeout). - Renderer lifecycle reset zeroes the delivery gate; powerMonitor system:resumed wake IPC (merged cleanly, no conflicts). Both test suites pass composed: pty.test.ts 243 (flow-control + cumulative-ack/resync), full ipc/terminal-pane/daemon gates green with only the pre-existing WSL env-import failure. Co-authored-by: Orca <help@stably.ai>