Skip to content

refactor(daemon,runtime): split daemon, pty and rpc modules under the max-lines budget - #14834

Merged
nwparker merged 1 commit into
mainfrom
nwparker/downsize-05b-daemon-runtime
Aug 16, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/downsize-05b-daemon-runtime

Conversation

@nwparker

@nwparker nwparker commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 62 +219 −83 +136
Prod 70 +4368 −3746 +622

Splits the nine oversized modules in the daemon / provider / runtime domain so they fit the oxlint max-lines budget, and removes their config/max-lines-baseline.txt entries (9 removed, 0 added).

Supersedes #14717, which was rebuilt from scratch after main restructured the same files (#14655, #14728).

What moved

daemon

  • Session decomposes into SessionOutputPlane (emulator, pending-output buffer, client fan-out), SessionProducerPause, SessionShellReadyBarrier and SessionTerminationController, plus SessionOptions / SubprocessHandle type modules and the PowerShell prompt-repaint nudge.
  • DaemonClient sheds socket connect, hello handshake, ndjson readers, pending-request settlement, the listener registry and notify settlement.
  • daemon-health splits into pid-file parsing, process start time, process identity query, pid identity, stale-kill, TCC attribution and bundle staleness.
  • shell-ready splits into the marker constant and the bash / zsh rcfile generators.

providers

  • local-pty-shell-ready splits into wrapper generation, wrapper root, startup command and the bash rcfile.

runtime

  • Coordinator sheds DAG convergence, decision gates, escalation triage, the runtime contract, the stale-base spec flag and task dispatch.
  • The files / git / github RPC modules split into per-domain method groups; github.ts is now just the composition of five method arrays.

No barrel files. The one export … from in the diff (src/main/ipc/pty.ts:14) already exists on main — only its source path changed.

Verification

  • oxlint clean; native + type-aware code-quality audits clean
  • max-lines ratchet: no new bypasses
  • pnpm typecheck (node + cli + web): clean
  • full unit suite: 5642 files passed, 22 skipped, 0 failed
  • changed-code-quality and react-doctor changed gates: clean
  • no new runtime import cycles (708 modules scanned)
  • net lint suppressions: -9

Behavior-preserving by construction: the extracted units keep their original construction order, null guards and timer lifetimes; every RPC method name is still registered (verified by diffing the pre/post method-name sets); and each test's vi.mock surface was re-partitioned to follow the symbols that moved.

… max-lines budget

Splits the nine oversized modules in the daemon/provider/runtime domain into
focused per-concern files and drops their max-lines baseline entries.

- daemon: `Session` decomposes into an output plane (emulator, pending-output
  buffer, client fan-out), a producer-pause controller, a shell-ready barrier and
  a termination controller; `DaemonClient` into socket connect, hello handshake,
  ndjson readers, pending-request settlement, listener registry and notify
  settlement; `daemon-health` into pid-file parsing, process identity,
  stale-kill, TCC attribution and bundle staleness; `shell-ready` into the marker
  constant and the bash/zsh rcfile generators.
- providers: local-pty shell-ready wrapper generation, wrapper root, startup
  command and bash rcfile split out of local-pty-shell-ready.
- runtime: `Coordinator` sheds DAG convergence, decision gates, escalation
  triage, the runtime contract, the stale-base flag and task dispatch; the
  files/git/github rpc modules split into per-domain method groups.

Behavior-preserving: the extracted units keep their original construction order,
guards and timer lifetimes, and every RPC method name is still registered.
Test `vi.mock` surfaces were re-partitioned to follow the moved symbols.
@greptile-apps

greptile-apps Bot commented Aug 16, 2026

Copy link
Copy Markdown

Too many files changed for review (132 files, 100 file limit).

Bypass the limit by tagging @greptile-apps to review.

@nwparker
nwparker merged commit 73aa5d0 into main Aug 16, 2026
52 checks passed
@coderabbitai

coderabbitai Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: fa4ceaff-954a-4379-a4d4-0d95a591010a

📥 Commits

Reviewing files that changed from the base of the PR and between 6854cce and d8d0022.

📒 Files selected for processing (132)
  • config/max-lines-baseline.txt
  • src/main/daemon/client.test.ts
  • src/main/daemon/client.ts
  • src/main/daemon/daemon-authenticated-client-activity.test.ts
  • src/main/daemon/daemon-bash-shell-ready-rcfile.ts
  • src/main/daemon/daemon-bundle-staleness.test.ts
  • src/main/daemon/daemon-bundle-staleness.ts
  • src/main/daemon/daemon-client-hello-handshake.ts
  • src/main/daemon/daemon-client-listener-registry.ts
  • src/main/daemon/daemon-client-ndjson-readers.ts
  • src/main/daemon/daemon-client-notify-settlement.ts
  • src/main/daemon/daemon-client-pending-requests.ts
  • src/main/daemon/daemon-client-socket-connect.ts
  • src/main/daemon/daemon-endpoint-ownership.test.ts
  • src/main/daemon/daemon-health-endpoint-entry.test.ts
  • src/main/daemon/daemon-health-socket-cleanup.test.ts
  • src/main/daemon/daemon-health.test.ts
  • src/main/daemon/daemon-health.ts
  • src/main/daemon/daemon-host-relocation.ts
  • src/main/daemon/daemon-idle-shutdown.test.ts
  • src/main/daemon/daemon-incarnation-evidence.ts
  • src/main/daemon/daemon-init-child-readiness.test.ts
  • src/main/daemon/daemon-init-child-startup-failure.test.ts
  • src/main/daemon/daemon-init-dependency-mocks.ts
  • src/main/daemon/daemon-init-endpoint-adoption.test.ts
  • src/main/daemon/daemon-init-live-session-preservation.test.ts
  • src/main/daemon/daemon-init-packaged-bundle-staleness.test.ts
  • src/main/daemon/daemon-init-provider-installation.test.ts
  • src/main/daemon/daemon-init-replacement-reporting.test.ts
  • src/main/daemon/daemon-init-restart-sequence.test.ts
  • src/main/daemon/daemon-init-wedged-daemon-grace.test.ts
  • src/main/daemon/daemon-init.ts
  • src/main/daemon/daemon-pid-file-parse.ts
  • src/main/daemon/daemon-pid-identity.ts
  • src/main/daemon/daemon-preflight-client-replacement.test.ts
  • src/main/daemon/daemon-process-identity-query.ts
  • src/main/daemon/daemon-process-inspection.ts
  • src/main/daemon/daemon-process-start-time.ts
  • src/main/daemon/daemon-pty-adapter-cold-restore-reanchor.test.ts
  • src/main/daemon/daemon-pty-adapter-cold-restore-seed.test.ts
  • src/main/daemon/daemon-pty-adapter-daemon-recovery.test.ts
  • src/main/daemon/daemon-pty-adapter-history-checkpoints.test.ts
  • src/main/daemon/daemon-pty-adapter-history-recovery.test.ts
  • src/main/daemon/daemon-pty-adapter-protocol-compatibility.test.ts
  • src/main/daemon/daemon-pty-adapter-session-adoption.test.ts
  • src/main/daemon/daemon-pty-adapter-test-harness.ts
  • src/main/daemon/daemon-pty-adapter.test.ts
  • src/main/daemon/daemon-pty-adapter.ts
  • src/main/daemon/daemon-pty-router-history-handoff.test.ts
  • src/main/daemon/daemon-pty-upgrade-adoption.test.ts
  • src/main/daemon/daemon-reattach-checkpoint-isolation.test.ts
  • src/main/daemon/daemon-restore-scrollback-depth.test.ts
  • src/main/daemon/daemon-self-retirement-respawn.test.ts
  • src/main/daemon/daemon-server-attach-only.test.ts
  • src/main/daemon/daemon-server-attachment-lifecycle.test.ts
  • src/main/daemon/daemon-server-error-handling.test.ts
  • src/main/daemon/daemon-server.test.ts
  • src/main/daemon/daemon-server.ts
  • src/main/daemon/daemon-session-scrollback-window.test.ts
  • src/main/daemon/daemon-shell-ready-marker.ts
  • src/main/daemon/daemon-shutdown-final-checkpoint-caller-deadline.test.ts
  • src/main/daemon/daemon-spawner.test.ts
  • src/main/daemon/daemon-stale-kill.ts
  • src/main/daemon/daemon-stream-droppability-lifecycle.test.ts
  • src/main/daemon/daemon-tcc-attribution-main-thread.test.ts
  • src/main/daemon/daemon-tcc-attribution.test.ts
  • src/main/daemon/daemon-tcc-attribution.ts
  • src/main/daemon/daemon-transport-attachment-release.test.ts
  • src/main/daemon/daemon-zsh-shell-ready-rcfile.ts
  • src/main/daemon/issue-6814-daemon-failure-classification.test.ts
  • src/main/daemon/pty-subprocess.ts
  • src/main/daemon/reattach-snapshot.test.ts
  • src/main/daemon/session-ingest-throughput.bench.test.ts
  • src/main/daemon/session-options.ts
  • src/main/daemon/session-output-plane.ts
  • src/main/daemon/session-powershell-prompt-repaint.ts
  • src/main/daemon/session-producer-pause.ts
  • src/main/daemon/session-shell-ready-barrier.ts
  • src/main/daemon/session-subprocess-handle.ts
  • src/main/daemon/session-terminal-control.test.ts
  • src/main/daemon/session-termination-controller.ts
  • src/main/daemon/session.test.ts
  • src/main/daemon/session.ts
  • src/main/daemon/shell-ready.test.ts
  • src/main/daemon/shell-ready.ts
  • src/main/daemon/slow-daemon-session-verification.test.ts
  • src/main/daemon/terminal-host-agent-session.test.ts
  • src/main/daemon/terminal-host-attach-only.test.ts
  • src/main/daemon/terminal-host-options.ts
  • src/main/daemon/terminal-host-pty-owner-backend.test.ts
  • src/main/daemon/terminal-host-session-reaping-leak.test.ts
  • src/main/daemon/terminal-host-startup.test.ts
  • src/main/daemon/terminal-host-wsl-context.test.ts
  • src/main/daemon/terminal-host.test.ts
  • src/main/ipc/pty-management.ts
  • src/main/ipc/pty.ts
  • src/main/providers/local-pty-provider.ts
  • src/main/providers/local-pty-shell-ready-bash-rcfile.ts
  • src/main/providers/local-pty-shell-ready-startup-command.test.ts
  • src/main/providers/local-pty-shell-ready-startup-command.ts
  • src/main/providers/local-pty-shell-ready-wrapper-generation.test.ts
  • src/main/providers/local-pty-shell-ready-wrapper-generation.ts
  • src/main/providers/local-pty-shell-ready-wrapper-root.ts
  • src/main/providers/local-pty-shell-ready.ts
  • src/main/providers/windows-shell-args.ts
  • src/main/pty/codex-preflight-profile-path-rewrite.test.ts
  • src/main/runtime/orchestration/coordinator-dag-convergence.ts
  • src/main/runtime/orchestration/coordinator-decision-gates.ts
  • src/main/runtime/orchestration/coordinator-drift-probe-coalescing.test.ts
  • src/main/runtime/orchestration/coordinator-escalation-triage.ts
  • src/main/runtime/orchestration/coordinator-runtime-contract.ts
  • src/main/runtime/orchestration/coordinator-stale-base-flag.ts
  • src/main/runtime/orchestration/coordinator-task-dispatch.ts
  • src/main/runtime/orchestration/coordinator.test.ts
  • src/main/runtime/orchestration/coordinator.ts
  • src/main/runtime/remote-agent-session-host-authority.integration.test.ts
  • src/main/runtime/rpc/methods/files-mutation-methods.ts
  • src/main/runtime/rpc/methods/files-remote-content-budget.ts
  • src/main/runtime/rpc/methods/files-target-schemas.ts
  • src/main/runtime/rpc/methods/files-terminal-artifact-methods.ts
  • src/main/runtime/rpc/methods/files.ts
  • src/main/runtime/rpc/methods/git-commit-message-generation-methods.ts
  • src/main/runtime/rpc/methods/git-diff-methods.ts
  • src/main/runtime/rpc/methods/git.ts
  • src/main/runtime/rpc/methods/github-issue-methods.ts
  • src/main/runtime/rpc/methods/github-issue-update-schema.ts
  • src/main/runtime/rpc/methods/github-project-methods.ts
  • src/main/runtime/rpc/methods/github-pull-request-methods.ts
  • src/main/runtime/rpc/methods/github-pull-request-update-methods.ts
  • src/main/runtime/rpc/methods/github-repo-target-schemas.ts
  • src/main/runtime/rpc/methods/github-repo-work-item-methods.ts
  • src/main/runtime/rpc/methods/github.ts

📝 Walkthrough

Walkthrough

The pull request extracts daemon networking, process identity, session lifecycle, and shell-readiness logic into dedicated modules. It adds daemon staleness and termination checks, shell wrapper generators, readiness barriers, output management, and termination controllers. Coordinator orchestration is split into contracts, dispatch, gate, escalation, and convergence modules. File, Git, and GitHub RPC handlers are split into domain-specific registries with shared validation schemas and content-budget handling. Test imports, mocks, and max-lines baselines are updated.

✨ Finishing Touches
📝 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.

AmethystLiang pushed a commit that referenced this pull request Aug 17, 2026
… max-lines budget (#14834)

Splits the nine oversized modules in the daemon/provider/runtime domain into
focused per-concern files and drops their max-lines baseline entries.

- daemon: `Session` decomposes into an output plane (emulator, pending-output
  buffer, client fan-out), a producer-pause controller, a shell-ready barrier and
  a termination controller; `DaemonClient` into socket connect, hello handshake,
  ndjson readers, pending-request settlement, listener registry and notify
  settlement; `daemon-health` into pid-file parsing, process identity,
  stale-kill, TCC attribution and bundle staleness; `shell-ready` into the marker
  constant and the bash/zsh rcfile generators.
- providers: local-pty shell-ready wrapper generation, wrapper root, startup
  command and bash rcfile split out of local-pty-shell-ready.
- runtime: `Coordinator` sheds DAG convergence, decision gates, escalation
  triage, the runtime contract, the stale-base flag and task dispatch; the
  files/git/github rpc modules split into per-domain method groups.

Behavior-preserving: the extracted units keep their original construction order,
guards and timer lifetimes, and every RPC method name is still registered.
Test `vi.mock` surfaces were re-partitioned to follow the moved symbols.
bluehansl added a commit to bluehansl/orca that referenced this pull request Aug 21, 2026
- Re-apply the pane-key remint wiring over three weeks of upstream drift:
  tmux dispatcher call sites, runtime resolver injection, leader paneKey
  plumbing in pty.ts / orca-runtime.ts
- Adopt upstream's pty.test.ts split (stablyai#14834); paneKey expectations now
  live in pty-spawn-runtime-handle-binding.test.ts
- Extract resolvePane/resolvePaneOrWindow into
  claude-agent-teams-pane-resolution.ts to keep the dispatcher under the
  max-lines budget

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016gHoNRQpffLLRjf6aSDDWc
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
… max-lines budget (stablyai#14834)

Splits the nine oversized modules in the daemon/provider/runtime domain into
focused per-concern files and drops their max-lines baseline entries.

- daemon: `Session` decomposes into an output plane (emulator, pending-output
  buffer, client fan-out), a producer-pause controller, a shell-ready barrier and
  a termination controller; `DaemonClient` into socket connect, hello handshake,
  ndjson readers, pending-request settlement, listener registry and notify
  settlement; `daemon-health` into pid-file parsing, process identity,
  stale-kill, TCC attribution and bundle staleness; `shell-ready` into the marker
  constant and the bash/zsh rcfile generators.
- providers: local-pty shell-ready wrapper generation, wrapper root, startup
  command and bash rcfile split out of local-pty-shell-ready.
- runtime: `Coordinator` sheds DAG convergence, decision gates, escalation
  triage, the runtime contract, the stale-base flag and task dispatch; the
  files/git/github rpc modules split into per-domain method groups.

Behavior-preserving: the extracted units keep their original construction order,
guards and timer lifetimes, and every RPC method name is still registered.
Test `vi.mock` surfaces were re-partitioned to follow the moved symbols.
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