Skip to content

refactor(orchestration): delete the unreachable pre-mailbox terminal delivery path - #30576

Merged
Jinwoo-H merged 1 commit into
mainfrom
jinwoo/delete-dead-orchestration-delivery
Oct 19, 2026
Merged

Jinwoo-H merged 1 commit into
mainfrom
jinwoo/delete-dead-orchestration-delivery

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 0 0 0 0
Prod 8 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​3 $\color{#cf222e}{\Huge{\mathbf{−}}}$​265 $\color{#cf222e}{\Huge{\mathbf{−}}}$​262

ELI5

Orca had two copies of the code that types "you have new mail" into an agent's terminal. Only the newer copy was ever called. This deletes the old copy and the bookkeeping that only it used.

What Changed

Before / after for users: nothing changes. The deleted code could not run.

Mechanism: when an orchestration message arrives for an agent running in a terminal, Orca types a short pointer ("check your mail") into that terminal and presses Enter. That job is done by OrchestrationMailboxPointerDelivery (mailbox-pointer-delivery.ts, mailbox-pointer-stage.ts, mailbox-pointer-submit.ts). It records each step in the orchestration database so delivery survives a restart.

An older version of the same job, deliverPendingMessages in orchestration/mail/terminal-message-delivery.ts, was still part of the runtime class chain. Its only callers were itself (after a liveness probe) and settlePendingMessageDelivery, and that method's only caller was deliverPendingMessages. Nothing outside that pair, including tests, reached either of them.

Removed:

  • the old delivery class, plus its link in the runtime class chain. OrcaRuntimeWithResolveWaiter now extends the next class, OrcaRuntimeWithResolveExitWaiters, directly;
  • settlePendingMessageDelivery and the abstract deliverPendingMessages declaration;
  • state that only the old path read or wrote: in-flight deliveries, parked redeliveries, probe dedupe, and the per-mailbox "already pointed" watermark and id set;
  • isCursorAgentOrchestrationTarget and RuntimeMessageWaiters.typeHasLiveWaiter, whose only caller was the old path;
  • a code comment that named the old function now points at mailbox pointer delivery.

Why

Dead code that looks live misleads readers. We found this while planning a shared "submit text to an agent terminal" helper: the old file looked like the obvious place to extract from, but it never runs. Deleting it removes about 265 lines and a link in the runtime class chain, with no behaviour to preserve. The alternative, leaving it and documenting it as unused, keeps the trap in place.

Linked Issue

None. Internal cleanup.

Visual Proof

N/A. No UI or behaviour change; the removed code could not run.

Testing

  • pnpm tc:node: no type errors.

  • oxlint and oxfmt --check on the changed files, plus pnpm run check:code-quality:changed: clean.

  • pnpm test --maxWorkers=2 over the orchestration mailbox and mailbox-pointer tests, the main runtime test file (orca-runtime.test.ts) and the runtime terminal-wait, liveness, delivery and message-waiter tests: 18 files, 1769 passed, 1 skipped.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below. No new tests: deleting unreachable code; the existing delivery tests cover the live path.

AI Disclosure

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Security, cross-platform, SSH/remote, mobile, backwards compatibility, performance: no impact. Only unreachable main-process code is removed; no wire, schema or stored-data change.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

…delivery path

OrcaRuntimeWithDeliverPendingMessages.deliverPendingMessages was only
reachable from itself and settlePendingMessageDelivery, which was only
reachable from it. Live terminal mail delivery goes through
OrchestrationMailboxPointerDelivery (stage/submit), so this removes the
dead mixin link, its settle method, its state fields (flights, parked
redeliveries, probe dedupe, pointer watermarks), and the now-unused
isCursorAgentOrchestrationTarget and RuntimeMessageWaiters.typeHasLiveWaiter.
No behaviour change.
@coderabbitai

coderabbitai Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d1415810-3a48-400a-b176-36bf8abf4e4d
📥 Commits

Reviewing files that changed from the base of the PR and between 3051b7b and 4050ffe.

📒 Files selected for processing: 8
  • src/main/runtime/construction/runtime-file-command-state.ts
  • src/main/runtime/construction/runtime-identity-state.ts
  • src/main/runtime/orca-runtime-core.ts
  • src/main/runtime/orca-runtime-resolve-waiter.ts
  • src/main/runtime/orchestration/mail/terminal-message-delivery.ts
  • src/main/runtime/runtime-message-waiters.ts
  • src/main/runtime/terminal/output/headless-terminal-hydration.ts
  • src/main/runtime/terminal/wait/terminal-wait-settlements.ts
💤 Files with no reviewable changes: 6
  • src/main/runtime/construction/runtime-file-command-state.ts
  • src/main/runtime/terminal/wait/terminal-wait-settlements.ts
  • src/main/runtime/construction/runtime-identity-state.ts
  • src/main/runtime/runtime-message-waiters.ts
  • src/main/runtime/orca-runtime-core.ts
  • src/main/runtime/orchestration/mail/terminal-message-delivery.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

📝 Walkthrough

The runtime no longer includes the pending-mail delivery class, its PTY delivery-flight and pointed-message tracking state, or its waiter settlement path. The resolve-waiter class now extends OrcaRuntimeWithResolveExitWaiters. The changes also remove related waiter and orchestration-target helpers. One comment now refers to mailbox pointer delivery.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 4050f

The refactor removes unreachable delivery machinery without disrupting live mailbox delivery or terminal waiter behavior.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: removing the unreachable pre-mailbox terminal delivery path.
Description check Passed The description is complete and focused. It explains the user impact, mechanism, rationale, removed components, testing, and compatibility considerations. The absence of a linked issue is explained as…
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description is complete and focused. It explains the user impact, mechanism, rationale, removed components, testing, and compatibility considerations. The absence of a linked issue is explained as internal cleanup, and the remaining unchecked full-project commands do not prevent the description from being mostly complete.

Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2 files.

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@Jinwoo-H
Jinwoo-H merged commit e7b60c1 into main Oct 19, 2026
34 checks passed
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