Skip to content

Split remote terminal multiplexer responsibilities - #17248

Merged
nwparker merged 57 commits into
mainfrom
ra/max-lines-bottom-25-remote-terminal-multiplexer
Aug 30, 2026
Merged

nwparker merged 57 commits into
mainfrom
ra/max-lines-bottom-25-remote-terminal-multiplexer

Conversation

@nwparker

@nwparker nwparker commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 0 0 0 0
Prod 12 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1828 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1640 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​188

Summary

  • split the 1,679-line paired-runtime terminal multiplexer into focused facade, type/state, E2E control, connection, snapshot/recovery, flow-control, response, binary-frame, and implementation modules
  • preserve the single shared multiplexer/stream state identity, async and callback ordering, ACK/credit behavior, watchdog recovery, snapshot interlocks, negotiated capabilities, opcodes, payloads, and host/client wire content
  • reduce the max-lines baseline from 62 entries to 61; every new TypeScript module is at most 274 lines

Stacked on #17244.

Validation

  • pnpm tc
  • pnpm tc:web
  • focused transport/consumer/config suite: 19 files, 169 tests
  • pinned real-release cross-version terminal wire suite (v1.4.176): 5 tests / all client-host skew journeys passed
  • direct Oxlint across all 11 split modules
  • pnpm run check:code-quality:changed
  • pnpm check:max-lines-ratchet — 61 grandfathered suppressions
  • pnpm run check:runtime-electron-ratchet
  • changed-file formatting and git diff --check
  • exact facade export kinds, 349 runtime literals, 72 comments, 31 opcode references, original calls, and acyclic module-graph reconciliation
  • two independent final refactor audits: clean
  • real-commit normalized move-check: 82 adjudicated vanished lines, 262 module-boundary/import/helper-dispatch appearances

Known inherited harness drift

The unpinned cross-version test now selects newly available stable tag v1.4.192 and fails only its assertion that an old host omits terminalOwner. That release already contains the host publication commit and explicitly emits terminalOwner / alternateScreen; this renderer-only diff changes no host, shared-protocol, harness, package, or lock input. The full suite passes when pinned to the intended pre-field release v1.4.176.

Visual proof is N/A because this is internal terminal transport decomposition with no intended rendered UI change.

@greptile-apps

greptile-apps Bot commented Aug 29, 2026 •

Copy link
Copy Markdown

Greptile Summary

The PR decomposes the remote terminal multiplexer into focused modules while retaining a facade for existing consumers.

  • Separates connection lifecycle, response dispatch, binary-frame handling, flow control, snapshots, recovery, E2E controls, and shared state/types.
  • Preserves one inheritance chain and shared stream map for multiplexer behavior.
  • Removes the original multiplexer from the maximum-lines baseline.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
src/renderer/src/runtime/remote-runtime-terminal-multiplexer.ts Replaces the monolithic implementation with a compatibility facade, registry, exports, and test helpers.
src/renderer/src/runtime/remote-runtime-terminal-multiplexer-base.ts Owns the shared stream and connection state plus transport connection, closure, and frame-sending lifecycle.
src/renderer/src/runtime/remote-runtime-terminal-multiplexer-implementation.ts Defines terminal stream creation, capabilities, public stream operations, and subscription setup.
src/renderer/src/runtime/remote-runtime-terminal-binary-controller.ts Handles binary frame validation, output delivery, sequence accounting, and deferred credits.
src/renderer/src/runtime/remote-runtime-terminal-binary-snapshots.ts Handles snapshot assembly, application, request completion, recovery transitions, and stream errors.
src/renderer/src/runtime/remote-runtime-terminal-snapshot-controller.ts Encapsulates snapshot requests, output-gap detection, resynchronization retries, and watchdog recovery.
src/renderer/src/runtime/remote-runtime-terminal-flow-controller.ts Encapsulates input, pause negotiation, ACK batching, cumulative source acknowledgements, and E2E accessors.
src/renderer/src/runtime/remote-runtime-terminal-response-controller.ts Dispatches control responses and stream lifecycle events.
src/renderer/src/runtime/remote-runtime-terminal-multiplexer-types.ts Centralizes public contracts and shared mutable stream-state types.
src/renderer/src/runtime/remote-runtime-terminal-snapshot-state.ts Centralizes snapshot constants, parsing, classification, and cleanup helpers.
src/renderer/src/runtime/remote-runtime-terminal-e2e-control.ts Isolates E2E-only ACK gating, output dropping, counters, and test control APIs.

Class Diagram

%%{init: {'theme': 'neutral'}}%%
classDiagram
  RemoteRuntimeTerminalMultiplexerBase <|-- RemoteRuntimeTerminalResponseController
  RemoteRuntimeTerminalResponseController <|-- RemoteRuntimeTerminalSnapshotController
  RemoteRuntimeTerminalSnapshotController <|-- RemoteRuntimeTerminalFlowController
  RemoteRuntimeTerminalFlowController <|-- RemoteRuntimeTerminalBinarySnapshots
  RemoteRuntimeTerminalBinarySnapshots <|-- RemoteRuntimeTerminalBinaryController
  RemoteRuntimeTerminalBinaryController <|-- RemoteRuntimeTerminalMultiplexer
  class RemoteRuntimeTerminalMultiplexerBase {
    streams
    ensureConnected()
    sendFrame()
    handleClose()
  }
  class RemoteRuntimeTerminalResponseController {
    handleResponse()
  }
  class RemoteRuntimeTerminalSnapshotController {
    requestSnapshot()
    recoverStalledStream()
  }
  class RemoteRuntimeTerminalFlowController {
    sendInput()
    queueOutputAcknowledgement()
  }
  class RemoteRuntimeTerminalBinarySnapshots {
    handleSnapshotOrErrorFrame()
  }
  class RemoteRuntimeTerminalBinaryController {
    handleBinary()
    handleOutputFrame()
  }
  class RemoteRuntimeTerminalMultiplexer {
    subscribeTerminal()
  }
Loading

Reviews (3): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile

…ax-lines-bottom-10-automation-dispatch-events
…lines-bottom-20-cdp-bridge

# Conflicts:
#	src/main/browser/cdp-bridge.ts
…ax-lines-bottom-25-remote-terminal-multiplexer
…5-remote-terminal-multiplexer

# Conflicts:
#	config/max-lines-baseline.txt
#	src/renderer/src/hooks/automation-dispatch-completion.ts
@nwparker
nwparker changed the base branch from ra/max-lines-bottom-24-resource-usage-status to main August 30, 2026 03:20
@nwparker
nwparker merged commit b5d0e51 into main Aug 30, 2026
4 of 20 checks passed
@coderabbitai

coderabbitai Bot commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 13 minutes.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4376c3ab-2788-4c21-bb50-5548d81e1b4c

📥 Commits

Reviewing files that changed from the base of the PR and between 80a6bd6 and ca85da6.

📒 Files selected for processing (12)
  • config/max-lines-baseline.txt
  • src/renderer/src/runtime/remote-runtime-terminal-binary-controller.ts
  • src/renderer/src/runtime/remote-runtime-terminal-binary-snapshots.ts
  • src/renderer/src/runtime/remote-runtime-terminal-e2e-control.ts
  • src/renderer/src/runtime/remote-runtime-terminal-flow-controller.ts
  • src/renderer/src/runtime/remote-runtime-terminal-multiplexer-base.ts
  • src/renderer/src/runtime/remote-runtime-terminal-multiplexer-implementation.ts
  • src/renderer/src/runtime/remote-runtime-terminal-multiplexer-types.ts
  • src/renderer/src/runtime/remote-runtime-terminal-multiplexer.ts
  • src/renderer/src/runtime/remote-runtime-terminal-response-controller.ts
  • src/renderer/src/runtime/remote-runtime-terminal-snapshot-controller.ts
  • src/renderer/src/runtime/remote-runtime-terminal-snapshot-state.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* Split speech session lifecycle

* Split terminal output scheduler pipeline

* Split mobile browser pane modules

* Prune resolved max-lines suppressions

* Split pane tree equalization logic

* Extract mobile troubleshoot screen styles

* Split external automation manager

* Split main window service attachments

* Split hosted review creation checks

* Split automation dispatch event handling

* Split settings navigation metadata

* Split daemon initialization lifecycle

* Split GitLab item dialog

* Split relay dispatcher layers

* Split mobile host screen

* Retarget mobile view settings source test

* Split runtime file client layers

* Split ports panel layers

* Split runtime environments pane layers

* Split local PTY provider responsibilities

* Split CDP bridge responsibilities

* Split relay Git handler responsibilities

* Track moved relay Git fetch audit

* Split Linear item drawer responsibilities

* Split telemetry event schema responsibilities

* Split resource usage status responsibilities

* Split remote terminal multiplexer responsibilities

* Fix F3-speech for stablyai#17123

* Fix F1-cycle for stablyai#17131

* Fix F4-navtest for stablyai#17157

* Fix F2-allowlist for stablyai#17161
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