Repository navigation
refactor(rpc): delete host-side terminal source-range acks - #27546
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: 🟡 Moderate · up to The source-range removal lacks recorded coverage for its broader ACK and backpressure behavior, so validation should be confirmed before merge. Pre-merge checks |
|
There was a problem hiding this comment.
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.jsoncconfig/scripts/ci-shard-timings.jsonconfig/ts-nocheck-baseline.txtsrc/main/runtime/orca-runtime-notify-remote-terminal-view-presence-changed.tssrc/main/runtime/orca-runtime-on-pty-data.tssrc/main/runtime/orca-runtime-prepare-pty-execution-context.tssrc/main/runtime/orca-runtime-record-agent-prompt-lifecycle-state.tssrc/main/runtime/orca-runtime-serialize-main-terminal-buffer.tssrc/main/runtime/remote-terminal-source-range-consumer.tssrc/main/runtime/rpc/methods/terminal-manifest-characterization.test.tssrc/main/runtime/rpc/methods/terminal-stream-extraction-characterization.test.tssrc/main/runtime/rpc/methods/terminal/stream-schemas.tssrc/main/runtime/rpc/methods/terminal/terminal-multiplex-cleanup.tssrc/main/runtime/rpc/methods/terminal/terminal-multiplex-connection.tssrc/main/runtime/rpc/methods/terminal/terminal-multiplex-flow-control.tssrc/main/runtime/rpc/methods/terminal/terminal-multiplex-frame-delivery.tssrc/main/runtime/rpc/methods/terminal/terminal-multiplex-initial-snapshot.tssrc/main/runtime/rpc/methods/terminal/terminal-multiplex-method.tssrc/main/runtime/rpc/methods/terminal/terminal-multiplex-slot-frames.tssrc/main/runtime/rpc/methods/terminal/terminal-multiplex-stream-initialization.tssrc/main/runtime/rpc/methods/terminal/terminal-output-batcher.test.tssrc/main/runtime/rpc/methods/terminal/terminal-output-batcher.tssrc/main/runtime/rpc/methods/terminal/terminal-stream-replay.tssrc/main/runtime/rpc/methods/terminal/terminal-stream-types.tssrc/main/runtime/rpc/terminal-multiplex-ack-overflow-recovery.test.tssrc/main/runtime/rpc/terminal-multiplex-source-range-admission.test.tssrc/main/runtime/rpc/terminal-multiplex-source-range-fixtures.tssrc/main/runtime/rpc/terminal-multiplex-source-range-request.test.tssrc/main/runtime/rpc/terminal-output-frame-chunks.tssrc/main/runtime/rpc/terminal-output-frame-source-ranges.test.tssrc/main/runtime/rpc/terminal-source-range-ledger.test.tssrc/main/runtime/rpc/terminal-source-range-ledger.tssrc/main/runtime/rpc/terminal-source-range-registry.tssrc/main/runtime/rpc/terminal-source-range-validation.tssrc/main/runtime/runtime-terminal-stream-consumers.tssrc/shared/terminal-output-source-range.tstests/e2e/helpers/remote-terminal-source-range-contract-fixture.tstests/e2e/helpers/remote-terminal-source-range-contract-fixture.unit.test.tstests/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", |
There was a problem hiding this comment.
📐 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.
7d20fa6 to
779fe45
Compare
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.
779fe45 to
f863c47
Compare
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
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.attach/settle/cancel…SourceRanges,reserve/commit/rollback…Replacement),setRemoteTerminalSourceRangeConsumerHooksand the hook slot inRuntimeTerminalStreamConsumers.TerminalMultiplexSourceRangeAckFrame(the range-ACK frame schema).rpc/methods/terminal/): the per-streamackOutputSourceRanges/streamGeneration/ ledger / replacement fields, the range branch in ACK handling, credit checks, recovery snapshots, initial snapshot and detach, and the unusedonRejectedcallback onsendFrame, whose only user was ledger rollback. Range slicing is removed from output chunking, batching and snapshot replay. ThesourceRangesparameter is removed fromonPtyData.orca-runtime-attach-remote-terminal-source-range-consumer.tsis renamed toorca-runtime-notify-remote-terminal-view-presence-changed.ts, after its first remaining method (the mixin naming rule). It still needs@ts-nocheckbecause of forward references (I tried removing it), so its baseline entry is renamed and the count is unchanged at 159.stream-schemas.tsstill acceptscapabilities.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.terminal-multiplex-ack-overflow-recovery.test.tsare 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 testterminal-multiplex-source-range-request.test.ts: a subscribe offeringackOutputSourceRanges: 1gets a pinnedsubscribedreply 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 realattach… → falsestubbed in) and it passes there too.reliability-gates.jsoncandci-shard-timings.jsondrop 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):setRemoteTerminalSourceRangeConsumerHookshad zero callers anywhere, so the hooks were alwaysnullandattachRemoteTerminalSourceRangeConsumeralways returnedfalse. Every stream was therefore created withackOutputSourceRanges: false, and every branch deleted here was guarded by that flag or by a non-null ledger or reservation.sourceRangesintoonPtyDataoracceptPtyDataBounded. The production callers (local-configure.ts,bind-listeners.ts) pass five arguments, so no output meta ever carried ranges.rg -woversrc config tests mobile .githubfor all 35 deleted or renamed symbols finds zero hits. The exceptions are the six method names intests/e2e/cross-version-wire/host-terminal-runtime-stub.ts, kept for old released hosts as explained above. The samerg -wover all 159@ts-nocheckfiles finds zero hits.build:electron-vite,build:cliandbuild:orcadall 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 itsunverifiableverdict.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
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, andtests/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), andbuild:electron-vite/build:cli/build:orcad.Review
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)