Repository navigation
refactor(terminals): terminal input and inspection route by the PTY's owner - #27279
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to The reviewed ownerless remote-ID paths do not affect a local PTY, and the ratchet concern predates this change. No actionable merge risk from these concerns remains. Pre-merge checks |
|
There was a problem hiding this comment.
Actionable comments posted: 1
🔇 Additional comments (63)
config/focus-setting-read-baseline.txt (1)
1-6: LGTM!config/scripts/check-owner-routing-ratchet.test.mjs (1)
45-201: LGTM!src/renderer/src/components/native-chat/NativeChatComposer.test.tsx (1)
470-470: LGTM!Also applies to: 487-487, 504-504
src/renderer/src/components/native-chat/NativeChatComposer.tsx (1)
145-151: LGTM!src/renderer/src/components/native-chat/NativeChatResolvedView.prompt-card-composer.test.tsx (1)
22-23: LGTM!Also applies to: 71-71, 188-188, 200-202
src/renderer/src/components/native-chat/NativeChatResolvedView.tsx (1)
125-125: LGTM!src/renderer/src/components/native-chat/claude-model-switch-confirmation.ts (1)
64-68: LGTM!Also applies to: 72-79, 83-89, 146-146, 159-163
src/renderer/src/components/native-chat/native-chat-input-clear.ts (1)
38-42: LGTM!Also applies to: 59-59, 73-73
src/renderer/src/components/native-chat/native-chat-observed-send.test.ts (1)
25-33: LGTM!Also applies to: 44-63, 80-84, 100-100
src/renderer/src/components/native-chat/native-chat-observed-send.ts (1)
49-49: LGTM!Also applies to: 87-89
src/renderer/src/components/native-chat/native-chat-runtime-image-send.ts (1)
43-43: LGTM!Also applies to: 59-59, 72-72, 83-102
src/renderer/src/components/native-chat/native-chat-runtime-send-launch-draft.test.ts (1)
35-35: LGTM!Also applies to: 51-63, 78-86, 108-108, 121-121, 133-133, 144-148, 165-173, 182-186
src/renderer/src/components/native-chat/native-chat-runtime-send.test.ts (1)
34-34: LGTM!Also applies to: 50-50, 59-59, 67-67, 77-77, 90-98, 108-108, 117-118, 136-143, 158-167, 185-185, 198-245, 263-263, 280-280, 298-300, 325-325, 335-335, 344-360, 373-381, 397-401, 410-410, 420-420, 432-432, 444-446, 464-471, 481-487, 496-496, 507-514, 529-532
src/renderer/src/components/native-chat/native-chat-runtime-send.ts (1)
77-91: LGTM!Also applies to: 148-148, 163-163, 169-169, 177-177, 188-188, 197-197, 205-206
src/renderer/src/components/native-chat/use-native-chat-composer-attachments.test.tsx (1)
29-29: LGTM!src/renderer/src/components/native-chat/use-native-chat-composer-interrupt.ts (1)
33-33: LGTM!src/renderer/src/components/native-chat/use-native-chat-interactive-send.test.tsx (1)
69-76: LGTM!Also applies to: 81-81, 96-96, 111-111, 116-116, 123-123, 137-137, 149-149, 160-160, 166-166, 173-180, 189-189, 204-204, 211-211, 223-223, 233-233, 238-238, 254-254, 271-271, 287-287, 295-295
src/renderer/src/components/native-chat/use-native-chat-interactive-send.ts (1)
73-73: LGTM!Also applies to: 80-82, 88-92, 146-146, 158-158, 170-170, 174-174
src/renderer/src/components/native-chat/use-native-chat-picker-command-dispatch.test.tsx (1)
63-63: LGTM!Also applies to: 72-72
src/renderer/src/components/native-chat/use-native-chat-picker-command-dispatch.ts (1)
82-83: LGTM!src/renderer/src/components/native-chat/use-native-chat-pty-composer-send.test.tsx (1)
65-65: LGTM!Also applies to: 74-74, 83-83
src/renderer/src/components/native-chat/use-native-chat-pty-composer-send.ts (1)
97-98: LGTM!Also applies to: 108-108, 110-110
src/renderer/src/components/native-chat/use-native-chat-session-option-command.test.tsx (1)
45-45: LGTM!src/renderer/src/components/native-chat/use-native-chat-session-option-command.ts (1)
90-91: LGTM!src/renderer/src/components/terminal-pane/agent-completion-process-monitor.ts (1)
121-122: LGTM!src/renderer/src/components/terminal-pane/agent-completion-steady-state-opt-in.test.ts (1)
15-15: LGTM!src/renderer/src/components/terminal-pane/pending-pane-close-confirmation.test.ts (1)
105-105: LGTM!src/renderer/src/components/terminal-pane/pty-connection/pane-agent-identity.ts (1)
185-185: LGTM!Also applies to: 189-189
src/renderer/src/components/terminal-pane/pty-connection/pane-serializer-settle.ts (1)
120-129: LGTM!Also applies to: 144-144
src/renderer/src/components/terminal-pane/use-terminal-pane-close-actions.ts (1)
150-150: LGTM!src/renderer/src/components/terminal/pty-running-work-probe-child-evidence.test.ts (1)
29-31: LGTM!Also applies to: 43-43, 59-59, 71-71, 86-87
src/renderer/src/components/terminal/pty-running-work-probe.ts (1)
18-18: LGTM!src/renderer/src/components/terminal/running-terminal-close-guard.test.ts (1)
114-114: LGTM!Also applies to: 223-223, 245-245
src/renderer/src/components/terminal/running-terminal-close-guard.ts (1)
114-114: LGTM!src/renderer/src/components/terminal/window-close-running-work.test.ts (1)
52-52: LGTM!src/renderer/src/components/terminal/window-close-running-work.ts (1)
60-60: LGTM!src/renderer/src/lib/agent-draft-paste-content.ts (1)
35-35: LGTM!Also applies to: 74-74, 77-77, 83-83, 202-202, 213-213
src/renderer/src/lib/agent-draft-readiness.test.ts (1)
48-48: LGTM!Also applies to: 64-64, 81-81, 97-97
src/renderer/src/lib/agent-draft-readiness.ts (1)
23-23: LGTM!Also applies to: 76-76
src/renderer/src/lib/agent-followup-delivery.test.ts (1)
47-47: LGTM!Also applies to: 54-54, 68-68, 87-87, 109-109, 113-113
src/renderer/src/lib/agent-followup-delivery.ts (1)
16-17: LGTM!Also applies to: 21-21, 29-29, 35-35
src/renderer/src/lib/agent-paste-draft-readiness-budget.test.ts (1)
65-65: LGTM!Also applies to: 85-85, 105-105, 126-126, 169-169
src/renderer/src/lib/agent-paste-draft-submit-retry.test.ts (1)
108-108: LGTM!Also applies to: 133-133, 175-175
src/renderer/src/lib/agent-paste-draft.test.ts (1)
60-61: LGTM!Also applies to: 137-137, 166-166, 169-169, 192-192, 210-210, 234-234, 290-290, 314-314, 345-345, 350-350, 416-416, 440-440, 494-494, 544-544, 562-562, 565-565, 575-575, 607-607, 615-615, 621-621, 673-673, 688-689, 693-693, 697-697, 703-703, 737-739, 794-794, 802-802, 808-808
src/renderer/src/lib/agent-paste-draft.ts (2)
94-94: LGTM!Also applies to: 147-148, 157-157, 161-161, 207-207, 214-214, 223-223, 230-230, 247-247, 277-279, 297-297, 303-303
180-191: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value
⚠️ Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.Remove the unused
tabIdparameter fromsubmitPromptToAgentPty.
tabIdis no longer read after this change. Callers must still supply it. Remove it from the argument type, and update callers, so the contract matches the PTY-owner routing. The same applies to the_tabIdparameter thatdeliverAgentStartupToTerminalkeeps insrc/renderer/src/lib/new-workspace.ts.src/renderer/src/lib/agent-ready-wait.ts (1)
94-94: LGTM!src/renderer/src/lib/codex-session-restart-shell-flap.test.ts (1)
186-186: LGTM!src/renderer/src/lib/codex-session-restart.test.ts (1)
391-391: LGTM!Also applies to: 398-398, 409-409, 437-437
src/renderer/src/lib/codex-session-restart.ts (1)
107-107: LGTM!Also applies to: 161-161, 169-169
src/renderer/src/lib/default-creation-host.test.ts (1)
1-13: LGTM!src/renderer/src/lib/default-creation-host.ts (1)
1-13: LGTM!src/renderer/src/lib/launch-agent-new-tab-host-route-readiness.test.ts (1)
51-51: LGTM!src/renderer/src/lib/new-workspace.ts (1)
2-2: LGTM!Also applies to: 245-245, 257-257
src/renderer/src/lib/resolve-owner.test.ts (1)
10-10: LGTM!Also applies to: 245-274
src/renderer/src/lib/resolve-owner.ts (1)
29-29: LGTM!Also applies to: 109-117
src/renderer/src/runtime/runtime-client-target.test.ts (1)
3-8: LGTM!Also applies to: 43-64
src/renderer/src/runtime/runtime-client-target.ts (1)
2-2: LGTM!Also applies to: 18-41
src/renderer/src/runtime/runtime-terminal-inspection.test.ts (1)
112-112: LGTM!Also applies to: 130-133, 150-150, 161-164, 179-179, 198-198, 213-213, 228-228, 244-244, 256-256, 266-266, 289-291, 312-312, 341-341, 384-384, 399-399, 411-411, 429-429, 438-438, 447-447, 458-458, 475-475, 489-489, 500-500, 518-518, 549-549, 576-576, 742-742
src/renderer/src/runtime/runtime-terminal-stream.test.ts (1)
274-274: LGTM!src/renderer/src/runtime/runtime-terminal-stream.ts (1)
29-43: LGTM!Also applies to: 58-62
src/renderer/src/runtime/runtime-terminal-verified-input.test.ts (1)
48-48: LGTM!Also applies to: 70-70, 82-84, 93-93, 97-97, 101-101, 107-125
src/renderer/src/runtime/runtime-terminal-verified-input.ts (1)
26-27: LGTM!Also applies to: 48-48
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
c96eb210-48fc-478b-a90f-f30972d1f7da
📥 Commits
Reviewing files that changed from the base of the PR and between 5c7c493 and 84de43c461c9db50dbc4081f1a680372412836b8.
📒 Files selected for processing (94)
config/focus-setting-read-baseline.txtconfig/owner-routing-baseline.txtconfig/scripts/check-owner-routing-ratchet.mjsconfig/scripts/check-owner-routing-ratchet.test.mjssrc/renderer/src/components/native-chat/NativeChatComposer.paste-remount.test.tsxsrc/renderer/src/components/native-chat/NativeChatComposer.test.tsxsrc/renderer/src/components/native-chat/NativeChatComposer.tsxsrc/renderer/src/components/native-chat/NativeChatResolvedView.prompt-card-composer.test.tsxsrc/renderer/src/components/native-chat/NativeChatResolvedView.tsxsrc/renderer/src/components/native-chat/claude-model-switch-confirmation.test.tssrc/renderer/src/components/native-chat/claude-model-switch-confirmation.tssrc/renderer/src/components/native-chat/native-chat-composer-prompt-recall.test.tsxsrc/renderer/src/components/native-chat/native-chat-composer-target.tssrc/renderer/src/components/native-chat/native-chat-input-clear.tssrc/renderer/src/components/native-chat/native-chat-observed-send.test.tssrc/renderer/src/components/native-chat/native-chat-observed-send.tssrc/renderer/src/components/native-chat/native-chat-queue-send-confirm.test.tsxsrc/renderer/src/components/native-chat/native-chat-runtime-image-send.tssrc/renderer/src/components/native-chat/native-chat-runtime-send-launch-draft.test.tssrc/renderer/src/components/native-chat/native-chat-runtime-send.test.tssrc/renderer/src/components/native-chat/native-chat-runtime-send.tssrc/renderer/src/components/native-chat/native-chat-structured-send-composition-clear.test.tsxsrc/renderer/src/components/native-chat/use-native-chat-composer-attachments.test.tsxsrc/renderer/src/components/native-chat/use-native-chat-composer-interrupt.tssrc/renderer/src/components/native-chat/use-native-chat-interactive-send.test.tsxsrc/renderer/src/components/native-chat/use-native-chat-interactive-send.tssrc/renderer/src/components/native-chat/use-native-chat-picker-command-dispatch.test.tsxsrc/renderer/src/components/native-chat/use-native-chat-picker-command-dispatch.tssrc/renderer/src/components/native-chat/use-native-chat-pty-composer-send.test.tsxsrc/renderer/src/components/native-chat/use-native-chat-pty-composer-send.tssrc/renderer/src/components/native-chat/use-native-chat-session-option-command.test.tsxsrc/renderer/src/components/native-chat/use-native-chat-session-option-command.tssrc/renderer/src/components/terminal-pane/agent-completion-coordinator-attention-dispatch.test.tssrc/renderer/src/components/terminal-pane/agent-completion-coordinator-completion-replay-guard.test.tssrc/renderer/src/components/terminal-pane/agent-completion-coordinator-dispose-leak.test.tssrc/renderer/src/components/terminal-pane/agent-completion-coordinator-hook-done-quiet-window.test.tssrc/renderer/src/components/terminal-pane/agent-completion-coordinator-hook-title-precedence.test.tssrc/renderer/src/components/terminal-pane/agent-completion-coordinator-monitoring-turn-end.test.tssrc/renderer/src/components/terminal-pane/agent-completion-coordinator-pending-title-inspection.test.tssrc/renderer/src/components/terminal-pane/agent-completion-coordinator-process-cadence.test.tssrc/renderer/src/components/terminal-pane/agent-completion-coordinator-process-exit-turn-boundary.test.tssrc/renderer/src/components/terminal-pane/agent-completion-coordinator-queued-inspection-disposal.test.tssrc/renderer/src/components/terminal-pane/agent-completion-coordinator-stamped-turn-boundary.test.tssrc/renderer/src/components/terminal-pane/agent-completion-coordinator-stamped-turn-replay.test.tssrc/renderer/src/components/terminal-pane/agent-completion-coordinator-types.tssrc/renderer/src/components/terminal-pane/agent-completion-no-evidence-cadence.test.tssrc/renderer/src/components/terminal-pane/agent-completion-process-monitor.tssrc/renderer/src/components/terminal-pane/agent-completion-stale-evidence-backoff.test.tssrc/renderer/src/components/terminal-pane/agent-completion-steady-state-opt-in.test.tssrc/renderer/src/components/terminal-pane/pane-foreground-process-exit-retire.test.tssrc/renderer/src/components/terminal-pane/pending-pane-close-confirmation.test.tssrc/renderer/src/components/terminal-pane/pty-connection/pane-agent-identity.tssrc/renderer/src/components/terminal-pane/pty-connection/pane-serializer-settle.tssrc/renderer/src/components/terminal-pane/pty-connection/terminal-keydown-fit.tssrc/renderer/src/components/terminal-pane/terminal-paste-operation-order.test.tssrc/renderer/src/components/terminal-pane/use-terminal-pane-close-actions.tssrc/renderer/src/components/terminal/pty-running-work-probe-child-evidence.test.tssrc/renderer/src/components/terminal/pty-running-work-probe.tssrc/renderer/src/components/terminal/running-terminal-close-guard.test.tssrc/renderer/src/components/terminal/running-terminal-close-guard.tssrc/renderer/src/components/terminal/window-close-running-work.test.tssrc/renderer/src/components/terminal/window-close-running-work.tssrc/renderer/src/hooks/agent-hook-completion-notifications.tssrc/renderer/src/lib/agent-draft-paste-content.tssrc/renderer/src/lib/agent-draft-readiness.test.tssrc/renderer/src/lib/agent-draft-readiness.tssrc/renderer/src/lib/agent-followup-delivery.test.tssrc/renderer/src/lib/agent-followup-delivery.tssrc/renderer/src/lib/agent-paste-draft-readiness-budget.test.tssrc/renderer/src/lib/agent-paste-draft-submit-retry.test.tssrc/renderer/src/lib/agent-paste-draft.test.tssrc/renderer/src/lib/agent-paste-draft.tssrc/renderer/src/lib/agent-ready-wait.tssrc/renderer/src/lib/codex-session-restart-shell-flap.test.tssrc/renderer/src/lib/codex-session-restart.test.tssrc/renderer/src/lib/codex-session-restart.tssrc/renderer/src/lib/default-creation-host.test.tssrc/renderer/src/lib/default-creation-host.tssrc/renderer/src/lib/launch-agent-background-session.tssrc/renderer/src/lib/launch-agent-new-tab-host-route-readiness.test.tssrc/renderer/src/lib/new-workspace.test.tssrc/renderer/src/lib/new-workspace.tssrc/renderer/src/lib/resolve-owner.test.tssrc/renderer/src/lib/resolve-owner.tssrc/renderer/src/lib/startup-draft-input-kind.test.tssrc/renderer/src/runtime/runtime-client-target.test.tssrc/renderer/src/runtime/runtime-client-target.tssrc/renderer/src/runtime/runtime-terminal-inspection.test.tssrc/renderer/src/runtime/runtime-terminal-inspection.tssrc/renderer/src/runtime/runtime-terminal-stream.test.tssrc/renderer/src/runtime/runtime-terminal-stream.tssrc/renderer/src/runtime/runtime-terminal-verified-input.test.tssrc/renderer/src/runtime/runtime-terminal-verified-input.tssrc/renderer/src/runtime/web-session-tabs-agent-completion-notifications.test.ts
💤 Files with no reviewable changes (30)
- src/renderer/src/hooks/agent-hook-completion-notifications.ts
- src/renderer/src/components/terminal-pane/agent-completion-no-evidence-cadence.test.ts
- src/renderer/src/lib/launch-agent-background-session.ts
- config/owner-routing-baseline.txt
- src/renderer/src/components/native-chat/native-chat-queue-send-confirm.test.tsx
- src/renderer/src/components/terminal-pane/agent-completion-coordinator-dispose-leak.test.ts
- src/renderer/src/lib/startup-draft-input-kind.test.ts
- src/renderer/src/components/native-chat/native-chat-structured-send-composition-clear.test.tsx
- src/renderer/src/components/native-chat/NativeChatComposer.paste-remount.test.tsx
- src/renderer/src/components/native-chat/native-chat-composer-prompt-recall.test.tsx
- src/renderer/src/components/terminal-pane/agent-completion-coordinator-types.ts
- src/renderer/src/components/terminal-pane/agent-completion-coordinator-pending-title-inspection.test.ts
- src/renderer/src/components/terminal-pane/pty-connection/terminal-keydown-fit.ts
- src/renderer/src/components/terminal-pane/agent-completion-stale-evidence-backoff.test.ts
- src/renderer/src/components/terminal-pane/terminal-paste-operation-order.test.ts
- src/renderer/src/components/terminal-pane/pane-foreground-process-exit-retire.test.ts
- src/renderer/src/components/terminal-pane/agent-completion-coordinator-hook-done-quiet-window.test.ts
- src/renderer/src/components/terminal-pane/agent-completion-coordinator-queued-inspection-disposal.test.ts
- src/renderer/src/components/native-chat/claude-model-switch-confirmation.test.ts
- src/renderer/src/components/terminal-pane/agent-completion-coordinator-monitoring-turn-end.test.ts
- src/renderer/src/components/terminal-pane/agent-completion-coordinator-attention-dispatch.test.ts
- src/renderer/src/components/terminal-pane/agent-completion-coordinator-process-exit-turn-boundary.test.ts
- src/renderer/src/components/native-chat/native-chat-composer-target.ts
- src/renderer/src/lib/new-workspace.test.ts
- src/renderer/src/components/terminal-pane/agent-completion-coordinator-hook-title-precedence.test.ts
- src/renderer/src/components/terminal-pane/agent-completion-coordinator-stamped-turn-replay.test.ts
- src/renderer/src/components/terminal-pane/agent-completion-coordinator-process-cadence.test.ts
- src/renderer/src/components/terminal-pane/agent-completion-coordinator-completion-replay-guard.test.ts
- src/renderer/src/runtime/web-session-tabs-agent-completion-notifications.test.ts
- src/renderer/src/components/terminal-pane/agent-completion-coordinator-stamped-turn-boundary.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.
| const owner = getRemoteRuntimePtyOwner(ptyId) | ||
| const remote = isRemoteInspectionPtyId(ptyId) | ||
| if (target.kind !== 'environment' || !terminal) { | ||
| if (!owner) { |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
#!/bin/bash
rg -nP -C3 'isRemoteRuntimePtyId|getRemoteRuntimePtyOwner' src/renderer/src/runtime/runtime-terminal-inspection.ts src/renderer/src/runtime/runtime-terminal-verified-input.ts
rg -nP -C5 'export function parseRemoteRuntimePtyId' srcRepository: stablyai/orca
Length of output: 6493
🏁 Script executed:
#!/bin/bash
set -e
nl -ba src/renderer/src/runtime/runtime-terminal-inspection.ts | sed -n '1,205p'
printf '\n--- verified input ---\n'
nl -ba src/renderer/src/runtime/runtime-terminal-verified-input.ts | sed -n '1,125p'
printf '\n--- remote ID helpers ---\n'
nl -ba src/shared/remote-runtime-pty-id.ts | sed -n '1,100p'
printf '\n--- owner helper ---\n'
rg -n -F --glob '*.ts' -- 'function getRemoteRuntimePtyOwner' src
rg -n -F --glob '*.ts' -- 'getRemoteRuntimePtyOwner' src/renderer/src/runtime/runtime-terminal-stream.ts
nl -ba src/renderer/src/runtime/runtime-terminal-stream.ts | sed -n '1,150p'Repository: stablyai/orca
Length of output: 19406
Block ownerless remote: PTY IDs before local PTY operations.
inspectRuntimeTerminalProcess, sendRuntimePtyInputWithinLimit, and sendRuntimePtyInputVerified use the local PTY APIs when getRemoteRuntimePtyOwner(ptyId) returns null. An ownerless remote: ID can therefore reach local inspection or writing. Return clientOnlyUnverifiableInspection('terminal_gone') for inspection and reject the input before the local fallback.
confirmRuntimeTerminalForegroundProcess already rejects every remote: ID, including ownerless IDs.
Suggested fix
diff --git a/src/renderer/src/runtime/runtime-terminal-inspection.ts b/src/renderer/src/runtime/runtime-terminal-inspection.ts
--- a/src/renderer/src/runtime/runtime-terminal-inspection.ts
+++ b/src/renderer/src/runtime/runtime-terminal-inspection.ts
@@ -71,6 +71,9 @@ export async function inspectRuntimeTerminalProcess(
): Promise<RuntimeTerminalProcessInspection> {
const owner = getRemoteRuntimePtyOwner(ptyId)
const remote = isRemoteInspectionPtyId(ptyId)
+ if (isRemoteRuntimePtyId(ptyId) && !owner) {
+ return clientOnlyUnverifiableInspection('terminal_gone')
+ }
if (!owner) {
try {
const result = await (options
@@ -167,6 +170,9 @@ function sendRuntimePtyInputWithinLimit(
): boolean {
const owner = getRemoteRuntimePtyOwner(ptyId)
if (!owner) {
+ if (isRemoteRuntimePtyId(ptyId)) {
+ return false
+ }
window.api.pty.write(ptyId, data, inputKind)
recordRuntimeTerminalInputForPtyId(ptyId)
return true
diff --git a/src/renderer/src/runtime/runtime-terminal-verified-input.ts b/src/renderer/src/runtime/runtime-terminal-verified-input.ts
--- a/src/renderer/src/runtime/runtime-terminal-verified-input.ts
+++ b/src/renderer/src/runtime/runtime-terminal-verified-input.ts
@@ -5,6 +5,7 @@ import { classifyTerminalProcessInspectionFailure } from '../../../shared/terminal-process-inspection'
import { callRuntimeRpc } from './runtime-rpc-client'
import { getRemoteRuntimePtyOwner } from './runtime-terminal-stream'
import { recordRuntimeTerminalInputForPtyId } from './runtime-terminal-input-recording'
+import { isRemoteRuntimePtyId } from '../../../shared/remote-runtime-pty-id'
const DESKTOP_RUNTIME_CLIENT = { id: 'orca-desktop', type: 'desktop' } as const
@@ -25,6 +26,9 @@ export async function sendRuntimePtyInputVerified(
}
const owner = getRemoteRuntimePtyOwner(ptyId)
if (!owner) {
+ if (isRemoteRuntimePtyId(ptyId)) {
+ return false
+ }
if (options?.requireWriteSettlement) {📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const owner = getRemoteRuntimePtyOwner(ptyId) | |
| const remote = isRemoteInspectionPtyId(ptyId) | |
| if (target.kind !== 'environment' || !terminal) { | |
| if (!owner) { | |
| const owner = getRemoteRuntimePtyOwner(ptyId) | |
| const remote = isRemoteInspectionPtyId(ptyId) | |
| if (isRemoteRuntimePtyId(ptyId) && !owner) { | |
| return clientOnlyUnverifiableInspection('terminal_gone') | |
| } | |
| if (!owner) { |
84de43c to
86422cd
Compare
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
🟡 Minor · Do not let --prune wipe the focus-setting-read… · check-owner-routing-ratchet.mjs:499-511
config/scripts/check-owner-routing-ratchet.mjs:499-511
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winDo not let
--prunewipe the focus-setting-read baseline when it is missing.When the baseline file is missing,
prunereads an empty map. It then writes back a file that contains only the header. A first run of--prunebefore the baseline file exists therefore creates an empty baseline. After that, every existing read counts as growth, and the check fails. This loop now runs over a second ratchet, which makes the missing-file case more likely during rollout.Do one of the following when the baseline file does not exist: skip that ratchet, or seed the file from the current counts.
Proposed fix
- const text = fs.existsSync(baselineFile) ? fs.readFileSync(baselineFile, 'utf8') : '' + if (!fs.existsSync(baselineFile)) { + console.log(`Skipped ${ratchet.baselinePath}: no baseline to prune.`) + continue + } + const text = fs.readFileSync(baselineFile, 'utf8')
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
7a6551e5-dc38-4e3e-b1ae-ec8d5956f3cb
📥 Commits
Reviewing files that changed from the base of the PR and between 84de43c461c9db50dbc4081f1a680372412836b8 and 86422cd7edc754da608b9f5bbc4a605c87ad23ae.
📒 Files selected for processing (3)
config/focus-setting-read-baseline.txtconfig/scripts/check-owner-routing-ratchet.mjsconfig/scripts/check-owner-routing-ratchet.test.mjs
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
40b2ad4 to
1726360
Compare
… owner A remote PTY id already names the server that owns it. inspect, confirm, send, verified send and the data subscription took settings only to fall back to the focused server for an id without an owner segment, so an old ownerless id could reach a server that does not own it. They now route by the id alone: an ownerless remote id is never dialed and never confirmed locally. Dropping the parameter removes the settings plumbing the native chat, agent draft paste and follow-up paths carried only for this, including the raw focused-settings default in sendBracketedPasteToAgent, and deletes getSettingsForAgentTabRuntimeOwner.
…narrower terminal signatures
1726360 to
9a2f707
Compare
- native-chat observed send: sendRuntimePtyInputVerified no longer takes settings (stablyai#27279); the dropped-Enter retry and its tests follow. - account select test: DATA_ACCOUNT_RUNTIME_CAPABILITY moved to shared/account-runtime-capabilities. - composer toggle: carry its own TooltipProvider so the composer field renders without the app-level one (as the field's tests do). Co-Authored-By: Claude Opus 5.5 <[email protected]>
- native-chat observed send: sendRuntimePtyInputVerified no longer takes settings (stablyai#27279); the dropped-Enter retry and its tests follow. - account select test: DATA_ACCOUNT_RUNTIME_CAPABILITY moved to shared/account-runtime-capabilities. - composer toggle: carry its own TooltipProvider so the composer field renders without the app-level one (as the field's tests do). Co-Authored-By: Claude Opus 5.5 <[email protected]>
- native-chat observed send: sendRuntimePtyInputVerified no longer takes settings (stablyai#27279); the dropped-Enter retry and its tests follow. - account select test: DATA_ACCOUNT_RUNTIME_CAPABILITY moved to shared/account-runtime-capabilities. - composer toggle: carry its own TooltipProvider so the composer field renders without the app-level one (as the field's tests do). Co-Authored-By: Claude Opus 5.5 <[email protected]>
- native-chat observed send: sendRuntimePtyInputVerified no longer takes settings (stablyai#27279); the dropped-Enter retry and its tests follow. - account select test: DATA_ACCOUNT_RUNTIME_CAPABILITY moved to shared/account-runtime-capabilities. - composer toggle: carry its own TooltipProvider so the composer field renders without the app-level one (as the field's tests do). Co-Authored-By: Claude Opus 5.5 <[email protected]>
- native-chat observed send: sendRuntimePtyInputVerified no longer takes settings (stablyai#27279); the dropped-Enter retry and its tests follow. - account select test: DATA_ACCOUNT_RUNTIME_CAPABILITY moved to shared/account-runtime-capabilities. - composer toggle: carry its own TooltipProvider so the composer field renders without the app-level one (as the field's tests do). Co-Authored-By: Claude Opus 5.5 <[email protected]>
- native-chat observed send: sendRuntimePtyInputVerified no longer takes settings (stablyai#27279); the dropped-Enter retry and its tests follow. - account select test: DATA_ACCOUNT_RUNTIME_CAPABILITY moved to shared/account-runtime-capabilities. - composer toggle: carry its own TooltipProvider so the composer field renders without the app-level one (as the field's tests do). Co-Authored-By: Claude Opus 5.5 <[email protected]>
- native-chat observed send: sendRuntimePtyInputVerified no longer takes settings (stablyai#27279); the dropped-Enter retry and its tests follow. - account select test: DATA_ACCOUNT_RUNTIME_CAPABILITY moved to shared/account-runtime-capabilities. - composer toggle: carry its own TooltipProvider so the composer field renders without the app-level one (as the field's tests do). Co-Authored-By: Claude Opus 5.5 <[email protected]>
- native-chat observed send: sendRuntimePtyInputVerified no longer takes settings (stablyai#27279); the dropped-Enter retry and its tests follow. - account select test: DATA_ACCOUNT_RUNTIME_CAPABILITY moved to shared/account-runtime-capabilities. - composer toggle: carry its own TooltipProvider so the composer field renders without the app-level one (as the field's tests do). Co-Authored-By: Claude Opus 5.5 <[email protected]>
- native-chat observed send: sendRuntimePtyInputVerified no longer takes settings (stablyai#27279); the dropped-Enter retry and its tests follow. - account select test: DATA_ACCOUNT_RUNTIME_CAPABILITY moved to shared/account-runtime-capabilities. - composer toggle: carry its own TooltipProvider so the composer field renders without the app-level one (as the field's tests do). Co-Authored-By: Claude Opus 5.5 <[email protected]>
- native-chat observed send: sendRuntimePtyInputVerified no longer takes settings (stablyai#27279); the dropped-Enter retry and its tests follow. - account select test: DATA_ACCOUNT_RUNTIME_CAPABILITY moved to shared/account-runtime-capabilities. - composer toggle: carry its own TooltipProvider so the composer field renders without the app-level one (as the field's tests do). Co-Authored-By: Claude Opus 5.5 <[email protected]>
- native-chat observed send: sendRuntimePtyInputVerified no longer takes settings (stablyai#27279); the dropped-Enter retry and its tests follow. - account select test: DATA_ACCOUNT_RUNTIME_CAPABILITY moved to shared/account-runtime-capabilities. - composer toggle: carry its own TooltipProvider so the composer field renders without the app-level one (as the field's tests do). Co-Authored-By: Claude Opus 5.5 <[email protected]>
- native-chat observed send: sendRuntimePtyInputVerified no longer takes settings (stablyai#27279); the dropped-Enter retry and its tests follow. - account select test: DATA_ACCOUNT_RUNTIME_CAPABILITY moved to shared/account-runtime-capabilities. - composer toggle: carry its own TooltipProvider so the composer field renders without the app-level one (as the field's tests do). Co-Authored-By: Claude Opus 5.5 <[email protected]>
- native-chat observed send: sendRuntimePtyInputVerified no longer takes settings (stablyai#27279); the dropped-Enter retry and its tests follow. - account select test: DATA_ACCOUNT_RUNTIME_CAPABILITY moved to shared/account-runtime-capabilities. - composer toggle: carry its own TooltipProvider so the composer field renders without the app-level one (as the field's tests do). Co-Authored-By: Claude Opus 5.5 <[email protected]>
- native-chat observed send: sendRuntimePtyInputVerified no longer takes settings (stablyai#27279); the dropped-Enter retry and its tests follow. - account select test: DATA_ACCOUNT_RUNTIME_CAPABILITY moved to shared/account-runtime-capabilities. - composer toggle: carry its own TooltipProvider so the composer field renders without the app-level one (as the field's tests do). Co-Authored-By: Claude Opus 5.5 <[email protected]>
- native-chat observed send: sendRuntimePtyInputVerified no longer takes settings (stablyai#27279); the dropped-Enter retry and its tests follow. - account select test: DATA_ACCOUNT_RUNTIME_CAPABILITY moved to shared/account-runtime-capabilities. - composer toggle: carry its own TooltipProvider so the composer field renders without the app-level one (as the field's tests do). Co-Authored-By: Claude Opus 5.5 <[email protected]>
- native-chat observed send: sendRuntimePtyInputVerified no longer takes settings (stablyai#27279); the dropped-Enter retry and its tests follow. - account select test: DATA_ACCOUNT_RUNTIME_CAPABILITY moved to shared/account-runtime-capabilities. - composer toggle: carry its own TooltipProvider so the composer field renders without the app-level one (as the field's tests do). Co-Authored-By: Claude Opus 5.5 <[email protected]>
- native-chat observed send: sendRuntimePtyInputVerified no longer takes settings (stablyai#27279); the dropped-Enter retry and its tests follow. - account select test: DATA_ACCOUNT_RUNTIME_CAPABILITY moved to shared/account-runtime-capabilities. - composer toggle: carry its own TooltipProvider so the composer field renders without the app-level one (as the field's tests do). Co-Authored-By: Claude Opus 5.5 <[email protected]>
- native-chat observed send: sendRuntimePtyInputVerified no longer takes settings (stablyai#27279); the dropped-Enter retry and its tests follow. - account select test: DATA_ACCOUNT_RUNTIME_CAPABILITY moved to shared/account-runtime-capabilities. - composer toggle: carry its own TooltipProvider so the composer field renders without the app-level one (as the field's tests do). Co-Authored-By: Claude Opus 5.5 <[email protected]>
- native-chat observed send: sendRuntimePtyInputVerified no longer takes settings (stablyai#27279); the dropped-Enter retry and its tests follow. - account select test: DATA_ACCOUNT_RUNTIME_CAPABILITY moved to shared/account-runtime-capabilities. - composer toggle: carry its own TooltipProvider so the composer field renders without the app-level one (as the field's tests do). Co-Authored-By: Claude Opus 5.5 <[email protected]>
- native-chat observed send: sendRuntimePtyInputVerified no longer takes settings (stablyai#27279); the dropped-Enter retry and its tests follow. - account select test: DATA_ACCOUNT_RUNTIME_CAPABILITY moved to shared/account-runtime-capabilities. - composer toggle: carry its own TooltipProvider so the composer field renders without the app-level one (as the field's tests do). Co-Authored-By: Claude Opus 5.5 <[email protected]>
- native-chat observed send: sendRuntimePtyInputVerified no longer takes settings (stablyai#27279); the dropped-Enter retry and its tests follow. - account select test: DATA_ACCOUNT_RUNTIME_CAPABILITY moved to shared/account-runtime-capabilities. - composer toggle: carry its own TooltipProvider so the composer field renders without the app-level one (as the field's tests do). Co-Authored-By: Claude Opus 5.5 <[email protected]>
- native-chat observed send: sendRuntimePtyInputVerified no longer takes settings (stablyai#27279); the dropped-Enter retry and its tests follow. - account select test: DATA_ACCOUNT_RUNTIME_CAPABILITY moved to shared/account-runtime-capabilities. - composer toggle: carry its own TooltipProvider so the composer field renders without the app-level one (as the field's tests do). Co-Authored-By: Claude Opus 5.5 <[email protected]>
- native-chat observed send: sendRuntimePtyInputVerified no longer takes settings (stablyai#27279); the dropped-Enter retry and its tests follow. - account select test: DATA_ACCOUNT_RUNTIME_CAPABILITY moved to shared/account-runtime-capabilities. - composer toggle: carry its own TooltipProvider so the composer field renders without the app-level one (as the field's tests do). Co-Authored-By: Claude Opus 5.5 <[email protected]>
ELI5
A terminal on a paired server has an id that already says which server it lives on. Some code still needed "which server is selected in the Active Server setting" before it would type into a terminal or check what's running in it. For an older id that didn't include the server, it would use the selected server, even if a different server owned that terminal. Now Orca only uses the server named in the id.
Builds on #27275 (merged).
What Changed
getRemoteRuntimePtyOwner(ptyId)(runtime-terminal-stream.ts) returns the owning server and handle from the id, ornull.inspectRuntimeTerminalProcess,confirmRuntimeTerminalForegroundProcess,sendRuntimePtyInput,sendRuntimePtyInputVerifiedandsubscribeToRuntimeTerminalDatano longer takesettings; they route by the id alone. The confirm check returns "no new evidence" for anyremote:id.getSettings. It also removes a raw focused-settings default insendBracketedPasteToAgent.getSettingsForAgentTabRuntimeOwner, which built settings from a tab's workspace only to feed these calls.Why
The terminal id is the owner record for a PTY. Every id minted today includes its server, so the settings fallback only served old ownerless ids, and for those it guessed using focus. That guess is the wrong-host bug this stack removes.
Alternative considered: keep a "tab's workspace owner" fallback for ownerless ids. We rejected it. It would keep a parallel owner source alive for ids the transport already re-mints with their server on attach, and it would keep the settings parameter threaded through ~50 call sites.
Linked Issue
None. This is part of the host-ownership routing stack (D4 G1).
Visual Proof
N/A. There is no UI change; only which host receives terminal input and inspection requests changes, and only for ownerless ids.
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
runtime-terminal-verified-input.test.ts: an ownerlessremote:id is never sent to a server, and an owned id goes to the server it names.codex-session-restart*.test.ts: remote panes are inspected on the server their id names and never go through the local confirm bridge.Updated the native-chat, agent-paste, close-guard and completion-coordinator tests for the narrower signatures.
Ran:
pnpm tc:web, focusedpnpm test(native-chat, terminal-pane, terminal, lib, hooks and every other test file that mocks these functions),oxlint,oxfmt,pnpm run check:code-quality:changed, andpnpm check:owner-routing-ratchet.Review
Agent skill upstream boundary
Notes
No wire change: the
terminal.*RPC params are unchanged. SSH:ssh:PTY ids keep using this app's IPC as before. Windows: no path or shell logic changed.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)