Skip to content

Split relay dispatcher layers - #17174

Merged
nwparker merged 33 commits into
mainfrom
ra/max-lines-bottom-14-relay-dispatcher
Aug 30, 2026
Merged

nwparker merged 33 commits into
mainfrom
ra/max-lines-bottom-14-relay-dispatcher

Conversation

@nwparker

@nwparker nwparker commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 0
Prod 12 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1634 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1511 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​123

Summary

  • split RelayDispatcher into focused client-lifecycle, capacity, framing, RPC-routing, and publication layers while keeping the public facade and method names intact
  • preserve every method body/signature, state initializer, type contract, constant, and non-suppression comment from the original dispatcher
  • remove src/relay/dispatcher.ts from the max-lines baseline, reducing the grandfathered count from 73 to 72
  • update one E2E comment whose source reference moved with admitsPtyDataPublication

dispatcher.ts is now 17 lines; the largest extracted implementation module is 261 lines.

Stacked on #17165.

Validation

  • pnpm tc
  • pnpm test src/relay — 147 files, 1,520 passed, 2 skipped
  • pnpm run check:code-quality:changed
  • pnpm check:max-lines-ratchet
  • git diff --check
  • ORCA_CROSS_VERSION_BASELINE_REF=v1.4.190 pnpm exec vitest run --config config/vitest.config.ts tests/e2e/cross-version-wire/cross-version-terminal-wire.unit.test.ts
  • pnpm exec vitest run --config config/vitest.config.ts tests/e2e/cross-version-wire/cross-version-agent-session-wire.unit.test.ts

The unpinned terminal skew harness currently selects v1.4.192, which now publishes terminal-mode metadata while this stack's older harness still asserts its absence. That pre-existing release-selection drift is already fixed in #17159 (test(wire): pin pre-metadata release coverage); this pure refactor does not duplicate the unrelated patch.

@greptile-apps

greptile-apps Bot commented Aug 29, 2026 •

Copy link
Copy Markdown

Greptile Summary

The PR reorganizes the monolithic relay dispatcher into focused layers while retaining a small RelayDispatcher facade and updates the max-lines baseline and one moved source reference.

  • Separates client state and lifecycle, framing, RPC routing, capacity management, producer transport, and notification/PTY publication.
  • Preserves the dispatcher’s exported facade through an inheritance chain.
  • Removes the former dispatcher max-lines exemption.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
src/relay/dispatcher.ts Replaces the monolithic implementation with a small facade that re-exports the existing public types and extends the complete dispatcher layer chain.
src/relay/dispatcher-client-state.ts Centralizes dispatcher state, initialization, registration APIs, and abstract contracts consumed by the extracted layers.
src/relay/dispatcher-client-lifecycle.ts Extracts client attachment, replacement, invalidation, disposal, decoding, and keepalive behavior.
src/relay/dispatcher-rpc-routing.ts Extracts relay-to-client requests and inbound JSON-RPC request, response, and notification routing.
src/relay/dispatcher-notification-publication.ts Extracts notification publication, targeted control delivery, bulk serialization, and producer-drop diagnostics.
src/relay/dispatcher-producer-transport.ts Extracts producer admission, publication leases, projection behavior, and bulk-capacity retry handling.
src/relay/dispatcher-pty-publication.ts Extracts PTY data and exit publication methods without an established behavioral change.
config/max-lines-baseline.txt Removes the no-longer-needed exemption for the now-small dispatcher facade.

Class Diagram

%%{init: {'theme': 'neutral'}}%%
classDiagram
  RelayDispatcher --|> RelayDispatcherNotificationPublication
  RelayDispatcherNotificationPublication --|> RelayDispatcherPtyPublication
  RelayDispatcherPtyPublication --|> RelayDispatcherProducerCapacity
  RelayDispatcherProducerCapacity --|> RelayDispatcherProducerTransport
  RelayDispatcherProducerTransport --|> RelayDispatcherRpcRouting
  RelayDispatcherRpcRouting --|> RelayDispatcherFrameCodec
  RelayDispatcherFrameCodec --|> RelayDispatcherCapacitySignals
  RelayDispatcherCapacitySignals --|> RelayDispatcherClientLifecycle
  RelayDispatcherClientLifecycle --|> RelayDispatcherClientState
Loading

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

@nwparker
nwparker changed the base branch from ra/max-lines-bottom-13-gitlab-item-dialog to main August 30, 2026 03:15
@nwparker
nwparker merged commit c664115 into main Aug 30, 2026
4 of 20 checks passed
@coderabbitai

coderabbitai Bot commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

Next included review available in 16 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: f3558f90-e11b-400d-b2cf-8bb29e287bef

📥 Commits

Reviewing files that changed from the base of the PR and between 052710b and 92d92bc.

📒 Files selected for processing (13)
  • config/max-lines-baseline.txt
  • src/relay/dispatcher-capacity-signals.ts
  • src/relay/dispatcher-client-lifecycle.ts
  • src/relay/dispatcher-client-state.ts
  • src/relay/dispatcher-contract.ts
  • src/relay/dispatcher-frame-codec.ts
  • src/relay/dispatcher-notification-publication.ts
  • src/relay/dispatcher-producer-capacity.ts
  • src/relay/dispatcher-producer-transport.ts
  • src/relay/dispatcher-pty-publication.ts
  • src/relay/dispatcher-rpc-routing.ts
  • src/relay/dispatcher.ts
  • tests/e2e/ssh-docker-reconnect-pane-restore.spec.ts
ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 68407282-8821-40eb-a19c-054ba1355c6a

📥 Commits

Reviewing files that changed from the base of the PR and between 052710b and 92d92bc.

📒 Files selected for processing (13)
  • config/max-lines-baseline.txt
  • src/relay/dispatcher-capacity-signals.ts
  • src/relay/dispatcher-client-lifecycle.ts
  • src/relay/dispatcher-client-state.ts
  • src/relay/dispatcher-contract.ts
  • src/relay/dispatcher-frame-codec.ts
  • src/relay/dispatcher-notification-publication.ts
  • src/relay/dispatcher-producer-capacity.ts
  • src/relay/dispatcher-producer-transport.ts
  • src/relay/dispatcher-pty-publication.ts
  • src/relay/dispatcher-rpc-routing.ts
  • src/relay/dispatcher.ts
  • tests/e2e/ssh-docker-reconnect-pane-restore.spec.ts

📝 Walkthrough

Walkthrough

The relay dispatcher is decomposed into contract, state, lifecycle, capacity, frame, RPC, transport, PTY publication, and notification publication classes. The RelayDispatcher facade now extends the notification publication layer and re-exports shared types. Client lifecycle, request routing, frame encoding, capacity checks, leased publication, and overflow handling move into dedicated modules. The baseline and one test comment are updated for the new implementation locations.

✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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

* 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