Skip to content

refactor(rpc): delete host-side terminal source-range acks - #27546

Merged
OrcaWin merged 1 commit into
mainfrom
OrcaWin/p399-A6
Oct 11, 2026
Merged

OrcaWin merged 1 commit into
mainfrom
OrcaWin/p399-A6

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 11, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 11 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​82 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1344 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1262
Prod 27 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​46 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1222 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1176

ELI5

A paired Orca client can ask the host to confirm output in "source ranges" (exact spans of the remote terminal's byte stream) instead of plain byte counts. Only the old SSH relay ever produced those spans on the host, and #27515 deleted the last piece of it. Since then the host has always said "no" to that request, so the client falls back to plain byte counts. The machinery that would have tracked the spans is still compiled, wired into the terminal stream code, and tested. This PR deletes it. Nothing anyone sees changes.

What Changed

  • Deleted (no production caller):
    • rpc/terminal-source-range-{ledger,registry,validation}.ts: the per-stream span ledger and its per-connection budget.
    • runtime/remote-terminal-source-range-consumer.ts: the hook contract the relay intake used to install.
    • shared/terminal-output-source-range.ts: the span type, now used only by the deleted files.
    • The six runtime methods (attach/settle/cancel…SourceRanges, reserve/commit/rollback…Replacement), setRemoteTerminalSourceRangeConsumerHooks and the hook slot in RuntimeTerminalStreamConsumers.
    • TerminalMultiplexSourceRangeAckFrame (the range-ACK frame schema).
  • Stripped from the multiplex stream path (rpc/methods/terminal/): the per-stream ackOutputSourceRanges / streamGeneration / ledger / replacement fields, the range branch in ACK handling, credit checks, recovery snapshots, initial snapshot and detach, and the unused onRejected callback on sendFrame, whose only user was ledger rollback. Range slicing is removed from output chunking, batching and snapshot replay. The sourceRanges parameter is removed from onPtyData.
  • Rename: the runtime mixin orca-runtime-attach-remote-terminal-source-range-consumer.ts is renamed to orca-runtime-notify-remote-terminal-view-presence-changed.ts, after its first remaining method (the mixin naming rule). It still needs @ts-nocheck because of forward references (I tried removing it), so its baseline entry is renamed and the count is unchanged at 159.
  • Kept on purpose (mixed versions): stream-schemas.ts still accepts capabilities.ackOutputSourceRanges. The client's range-ACK support for older hosts is untouched. Opcode numbers are unchanged. The cross-version host stub keeps answering the six runtime methods, because the old released host code it runs still calls them.
  • Tests: the suites for the deleted modules and the six source-range cases in terminal-multiplex-ack-overflow-recovery.test.ts are removed. The byte-window overflow cases in that file stay. The source-range-only batcher test, the e2e contract fixture and its unit test are also removed. New golden test terminal-multiplex-source-range-request.test.ts: a subscribe offering ackOutputSourceRanges: 1 gets a pinned subscribed reply and byte-identical binary frames compared with a plain byte-ACK subscribe. It sends a 700 KiB flood past the ACK window, checks that a range-shaped ACK releases nothing, and checks that a byte ACK releases the rest. I ran the same test against the pre-change source (e7da462dbf, with the runtime's real attach… → false stubbed in) and it passes there too.
  • reliability-gates.jsonc and ci-shard-timings.json drop the deleted test files. The gate checker passes.

Net lines: prod +41 / −1,015 (−974) (after rebasing over A4 #27529, which removed the adjacent acceptPtyDataBounded), tests +82 / −1,514 (−1,432), config +5 / −37 (−32).

Why

Phase 3.99 (A6) removes the host half of a protocol whose only producer was the relay. Every change to terminal stream flow control had to keep the reservation, commit and rollback paths intact, even though they could never run. The alternative was to keep the ledger in case a future producer needs it. Any such producer would be a new design: the ledger's span identity (provider/client/owner generations, delivery tokens) is relay vocabulary.

Proof the deleted code is unreachable (base e7da462dbf):

  • setRemoteTerminalSourceRangeConsumerHooks had zero callers anywhere, so the hooks were always null and attachRemoteTerminalSourceRangeConsumer always returned false. Every stream was therefore created with ackOutputSourceRanges: false, and every branch deleted here was guarded by that flag or by a non-null ledger or reservation.
  • Nothing passed sourceRanges into onPtyData or acceptPtyDataBounded. The production callers (local-configure.ts, bind-listeners.ts) pass five arguments, so no output meta ever carried ranges.
  • rg -w over src config tests mobile .github for all 35 deleted or renamed symbols finds zero hits. The exceptions are the six method names in tests/e2e/cross-version-wire/host-terminal-runtime-stub.ts, kept for old released hosts as explained above. The same rg -w over all 159 @ts-nocheck files finds zero hits.
  • build:electron-vite, build:cli and build:orcad all succeed.

SSH boundary / folder workspaces / Windows / WSL: nothing here decides liveness or routes work. The one detachStream(…, 'unverifiable') site that was removed only fired on a ledger failure, which could not happen. The overflow-recovery failure path keeps its unverifiable verdict.

Linked Issue

N/A (maintainer, Phase 3.99 cleanup plan, PR A6)

Visual Proof

N/A. No UI or behaviour change: the reply to every subscribe and the frames on every stream are unchanged (golden test above).

Testing

  • Automated tests added/updated (see above)
  • Focused vitest: src/main/runtime/rpc/terminal-*, src/main/runtime/rpc/methods/terminal*, orca-runtime-tests, orca-runtime.test.ts, the dispatcher suites, the renderer remote-terminal stream and transport suites, tests/e2e/paired-runtime-rejected-input-remount.unit.test.ts, and tests/e2e/cross-version-wire/cross-version-terminal-wire.unit.test.ts. The last covers both skews: new client with old host, and old client with new host. 89 files and 1,866 tests passed.
  • pnpm tc, oxlint, pnpm run check:code-quality:changed (0 new findings), pnpm lint (all ratchets OK, ts-nocheck 159 unchanged), and build:electron-vite / build:cli / build:orcad.

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

Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

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)

@coderabbitai

coderabbitai Bot commented Oct 11, 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: fb448af5-8553-476e-9c33-d236659b5a71




📥 Commits

Reviewing files that changed from the base of the PR and between 7d20fa66937cdff63c30dffb93246f357527cac6 and 779fe459d49021b0d590d66931c1e44b49a76059.





📒 Files selected for processing (1)
  • src/main/runtime/orca-runtime-on-pty-data.ts




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






📝 Walkthrough
📝 Walkthrough
📝 Walkthrough
📝 Walkthrough

Walkthrough

The change removes source-range metadata, tracking APIs, ledger handling, and source-range acknowledgements from terminal output and multiplexing. Byte-based output acknowledgements remain. The tests and fixtures for source-range tracking are removed or updated. A new test checks that offering the source-range acknowledgement capability does not change subscription output and that byte acknowledgements permit additional frames. SSH multiplexer backpressure commands are added to the reliability gate.








Priority: ⬇️ Low

Merge Risk: 🟡 Moderate · up to 779fe

The source-range removal lacks recorded coverage for its broader ACK and backpressure behavior, so validation should be confirmed before merge.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 10.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 15 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check Passed The title clearly and concisely identifies the main change: removing host-side terminal source-range acknowledgments.
Description check Passed The description covers the required sections, explains the change and rationale, documents compatibility considerations, provides testing details, and completes the checklist. The maintainer-specific …

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9bd33d6f-578c-4c80-b923-ee293c329e96
📥 Commits

Reviewing files that changed from the base of the PR and between e969881 and 7d20fa66937cdff63c30dffb93246f357527cac6.

📒 Files selected for processing (39)
  • config/reliability-gates.jsonc
  • config/scripts/ci-shard-timings.json
  • config/ts-nocheck-baseline.txt
  • src/main/runtime/orca-runtime-notify-remote-terminal-view-presence-changed.ts
  • src/main/runtime/orca-runtime-on-pty-data.ts
  • src/main/runtime/orca-runtime-prepare-pty-execution-context.ts
  • src/main/runtime/orca-runtime-record-agent-prompt-lifecycle-state.ts
  • src/main/runtime/orca-runtime-serialize-main-terminal-buffer.ts
  • src/main/runtime/remote-terminal-source-range-consumer.ts
  • src/main/runtime/rpc/methods/terminal-manifest-characterization.test.ts
  • src/main/runtime/rpc/methods/terminal-stream-extraction-characterization.test.ts
  • src/main/runtime/rpc/methods/terminal/stream-schemas.ts
  • src/main/runtime/rpc/methods/terminal/terminal-multiplex-cleanup.ts
  • src/main/runtime/rpc/methods/terminal/terminal-multiplex-connection.ts
  • src/main/runtime/rpc/methods/terminal/terminal-multiplex-flow-control.ts
  • src/main/runtime/rpc/methods/terminal/terminal-multiplex-frame-delivery.ts
  • src/main/runtime/rpc/methods/terminal/terminal-multiplex-initial-snapshot.ts
  • src/main/runtime/rpc/methods/terminal/terminal-multiplex-method.ts
  • src/main/runtime/rpc/methods/terminal/terminal-multiplex-slot-frames.ts
  • src/main/runtime/rpc/methods/terminal/terminal-multiplex-stream-initialization.ts
  • src/main/runtime/rpc/methods/terminal/terminal-output-batcher.test.ts
  • src/main/runtime/rpc/methods/terminal/terminal-output-batcher.ts
  • src/main/runtime/rpc/methods/terminal/terminal-stream-replay.ts
  • src/main/runtime/rpc/methods/terminal/terminal-stream-types.ts
  • src/main/runtime/rpc/terminal-multiplex-ack-overflow-recovery.test.ts
  • src/main/runtime/rpc/terminal-multiplex-source-range-admission.test.ts
  • src/main/runtime/rpc/terminal-multiplex-source-range-fixtures.ts
  • src/main/runtime/rpc/terminal-multiplex-source-range-request.test.ts
  • src/main/runtime/rpc/terminal-output-frame-chunks.ts
  • src/main/runtime/rpc/terminal-output-frame-source-ranges.test.ts
  • src/main/runtime/rpc/terminal-source-range-ledger.test.ts
  • src/main/runtime/rpc/terminal-source-range-ledger.ts
  • src/main/runtime/rpc/terminal-source-range-registry.ts
  • src/main/runtime/rpc/terminal-source-range-validation.ts
  • src/main/runtime/runtime-terminal-stream-consumers.ts
  • src/shared/terminal-output-source-range.ts
  • tests/e2e/helpers/remote-terminal-source-range-contract-fixture.ts
  • tests/e2e/helpers/remote-terminal-source-range-contract-fixture.unit.test.ts
  • tests/e2e/paired-runtime-rejected-input-remount.unit.test.ts
💤 Files with no reviewable changes (22)
  • src/main/runtime/remote-terminal-source-range-consumer.ts
  • src/main/runtime/rpc/terminal-output-frame-source-ranges.test.ts
  • tests/e2e/helpers/remote-terminal-source-range-contract-fixture.unit.test.ts
  • src/main/runtime/rpc/methods/terminal/terminal-output-batcher.test.ts
  • src/main/runtime/rpc/terminal-source-range-ledger.test.ts
  • src/main/runtime/rpc/terminal-multiplex-ack-overflow-recovery.test.ts
  • tests/e2e/paired-runtime-rejected-input-remount.unit.test.ts
  • src/main/runtime/orca-runtime-record-agent-prompt-lifecycle-state.ts
  • src/shared/terminal-output-source-range.ts
  • src/main/runtime/rpc/terminal-source-range-registry.ts
  • src/main/runtime/rpc/methods/terminal/terminal-stream-types.ts
  • src/main/runtime/rpc/methods/terminal-manifest-characterization.test.ts
  • tests/e2e/helpers/remote-terminal-source-range-contract-fixture.ts
  • src/main/runtime/rpc/methods/terminal/terminal-multiplex-method.ts
  • src/main/runtime/rpc/terminal-multiplex-source-range-admission.test.ts
  • src/main/runtime/rpc/terminal-source-range-ledger.ts
  • src/main/runtime/rpc/terminal-source-range-validation.ts
  • src/main/runtime/rpc/terminal-multiplex-source-range-fixtures.ts
  • src/main/runtime/runtime-terminal-stream-consumers.ts
  • src/main/runtime/rpc/methods/terminal/terminal-multiplex-cleanup.ts
  • src/main/runtime/rpc/methods/terminal/stream-schemas.ts
  • config/scripts/ci-shard-timings.json

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

{
"date": "2026-07-29",
"runner": "local",
"platform": "macos",
"command": "pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/rpc/terminal-source-range-ledger.test.ts src/main/runtime/rpc/terminal-multiplex-source-range-admission.test.ts src/main/ssh/ssh-multiplexer-transport-writer.test.ts src/main/ssh/ssh-channel-multiplexer-backpressure.test.ts --reporter=dot",
"command": "pnpm exec vitest run --config config/vitest.config.ts src/main/ssh/ssh-multiplexer-transport-writer.test.ts src/main/ssh/ssh-channel-multiplexer-backpressure.test.ts --reporter=dot",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Align the evidence summary with the recorded command.

Line 12567 names only two test files, but the summary at Line 12570 claims 13 files and 150 tests, including broader recovery coverage. Update the command or summary so the evidence record matches the run.

The host side of the terminal source-range ACK protocol had one producer: the
relay-fed SSH output intake, deleted in #27515. Since then nothing installs the
runtime's source-range hooks and nothing passes source ranges into PTY output,
so every terminal.multiplex subscribe that offers ackOutputSourceRanges is
already answered without it and uses the byte-window ACK.

Delete the ledger, the per-connection registry, the consumer hook surface on
the runtime, the stream-level reservation/commit/rollback plumbing in flow
control, initial snapshot and cleanup, the source-range ACK frame schema, and
the range slicing in output chunks, batching and replay. The subscribe schema
still accepts the ackOutputSourceRanges capability, and the client keeps its
range-ACK support for older hosts. A new golden test pins that an offering
subscribe gets the same reply and frames as a byte-ACK one.
@OrcaWin
OrcaWin merged commit 8731ca9 into main Oct 11, 2026
31 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