Repository navigation
fix(terminal): make remote agent sessions host-authoritative - #9687
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:
📝 WalkthroughWalkthroughThis change introduces remote agent-session host authority with explicit resume and fresh-create RPCs, signed claims, ownership reconciliation, operation replay fencing, and legacy compatibility paths. PTY incarnation identifiers now flow through local, daemon, relay, SSH, runtime, persistence, and renderer layers to reject stale exits and prevent resurrection. Terminal retirement and topology revision state is persisted and reconciled across workspace transfers, host partitions, and restarts. Renderer launch flows now support structured host creation, provisional handoffs, session options, localized outcomes, and legacy fallback. A deterministic Electron-based reproduction harness and extensive regression coverage are added. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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. Comment |
64196d9 to
af2e0a7
Compare
There was a problem hiding this comment.
Actionable comments posted: 6
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/main/daemon/daemon-server.ts (1)
758-772: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick winGuard the post-await
streamClientIdBySessionId.set(...). If the PTY exits beforecreateOrAttachreturns, the exit handler removes the entry and this write adds it back for a dead session, leaving a stale map entry until restart.Source: Linters/SAST tools
🧹 Nitpick comments (7)
config/scripts/remote-agent-session-repro-client.mjs (1)
20-29: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueUnhandled request rejection yields opaque harness errors.
If
connection.requestrejects (timeout/transport error), nothing is written to stdout, so the parent script'sJSON.parse(stdout.trim())fails with a generic "invalid JSON" message instead of surfacing the actual RPC error.🔧 Optional: surface the underlying error
try { - const response = await connection.request(method, JSON.parse(rawParams), 20_000) - process.stdout.write(`${JSON.stringify(response)}\n`) - if (!response.ok) { - process.exitCode = 1 - } + const response = await connection + .request(method, JSON.parse(rawParams), 20_000) + .catch((error) => ({ ok: false, error: String(error?.message ?? error) })) + process.stdout.write(`${JSON.stringify(response)}\n`) + if (!response.ok) { + process.exitCode = 1 + } } finally { connection.close() }src/main/daemon/pty-session-id.test.ts (1)
31-56: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winMissing collision coverage for realistic
clientOperationIdshapes.These tests only use synthetic operationIds (
'a'.repeat(43), etc.), never the real${timestamp}-${hex}shape used elsewhere in the RPC layer (agent-session.test.ts). See the consolidated comment onsrc/main/daemon/pty-session-id.tsfor the root-cause collision risk this masks.src/main/daemon/session.ts (1)
99-101: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider a "why" comment on the new
incarnationIdfield.Its purpose (letting clients distinguish exits from a superseded PTY incarnation for stale-exit rejection) isn't obvious from the field alone, and the rest of the file consistently documents non-obvious state with "Why:" comments.
As per path instructions,
**/*.{ts,tsx}: "For non-obvious TypeScript code, add a concise comment explaining why the constraint exists, not how the code works."Source: Path instructions
src/main/daemon/types.ts (1)
82-86: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueAdd a "why" comment for
agentSessionEnsure, matching sibling fields.Every other optional field in this payload (
shellOverride,terminalWindowsWslDistro,terminalWindowsPowerShellImplementation) carries a comment explaining why it exists.agentSessionEnsure— arguably the most non-obvious addition here, gating structured host-authority negotiation — has none.As per coding guidelines, "`**/*.{ts,tsx}`: For non-obvious TypeScript code, add a concise comment explaining why the constraint exists, not how the code works."📝 Suggested comment
+ /** Why: presence signals a structured host-authority resume/create request; + * claim + surface let the daemon verify ownership before admitting the session. */ agentSessionEnsure?: { claim: AgentSessionExecutionClaim surface: AgentSessionSurfaceBinding }Source: Coding guidelines
src/main/providers/ssh-agent-session-claim-validation.ts (1)
80-85: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick winUndocumented asymmetry: surface binding isn't validated for
adopteddispositions.
surfacesEqualis only enforced whendisposition === 'created'; an'adopted'owner's surface is never compared againstexpected.surface. This file otherwise documents non-obvious constraints with "Why:" comments (Lines 69-71), but this asymmetric check has none. Please confirm this is intentional (e.g., resumed/adopted sessions may legitimately reconnect from a different tab/leaf, so only claim identity matters) and add a short comment explaining the rationale, so a future refactor doesn't silently add or remove the check.📝 Suggested clarifying comment
if ( claimed.disposition === 'created' && !surfacesEqual(claimed.owner.surface, expected.surface) ) { + // Why: only newly created owners must bind exactly to the requested + // surface; adopted owners may legitimately resume under a different + // tab/leaf, so surface binding is not re-verified here. return { valid: false, cleanup, error: 'agent_session_ownership_unknown' } }Based on coding guidelines: "For non-obvious TypeScript code, add a concise comment explaining why the constraint exists, not how the code works."
Source: Coding guidelines
src/main/providers/ssh-pty-session-reattach.ts (1)
46-72: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider demoting the happy-path
console.warndebug logging.The three
console.warncalls (including the success-pathpty.attach succeededlog at Line 61-62) fire on every reattach and read as leftover debug instrumentation. Consider routing them through the project debug logger or removing the success log. Static analysis also flags these as sensitive-data logging (CWE-532);sessionIdhere is a PTY id rather than a credential, so that specific concern is largely a false positive.Source: Linters/SAST tools
src/main/runtime/orca-runtime.test.ts (1)
10586-10612: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDocument the shared canonical-owner fixture invariant.
canonicalOwnerintentionally persists across mock spawns to prove retry adoption retains the original execution surface; add a brief why-comment so this state is not simplified away later.Proposed clarification
+ // Preserve the first host owner so retries must adopt its canonical surface. let canonicalOwner:Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: eb8048ce-dd43-48fc-a880-1128ac4f7c89
📥 Commits
Reviewing files that changed from the base of the PR and between 903112a and 64196d977a8a60e414c1f3045a68c3d5b35d25c4.
📒 Files selected for processing (150)
config/localization-coverage-allowlist.jsonconfig/scripts/remote-agent-session-authority-repro.mjsconfig/scripts/remote-agent-session-repro-client.mjsconfig/scripts/remote-agent-session-repro-fixture.mjsdocs/reference/remote-agent-session-host-authority.mdpackage.jsonsrc/main/daemon/daemon-create-or-attach-result.tssrc/main/daemon/daemon-foreground-confirmation-protocol.test.tssrc/main/daemon/daemon-protocol-version.test.tssrc/main/daemon/daemon-protocol-version.tssrc/main/daemon/daemon-pty-adapter.test.tssrc/main/daemon/daemon-pty-adapter.tssrc/main/daemon/daemon-pty-provider.test.tssrc/main/daemon/daemon-pty-provider.tssrc/main/daemon/daemon-pty-router.test.tssrc/main/daemon/daemon-pty-router.tssrc/main/daemon/daemon-server.tssrc/main/daemon/daemon-stream-events.tssrc/main/daemon/degraded-daemon-pty-provider.test.tssrc/main/daemon/degraded-daemon-pty-provider.tssrc/main/daemon/pty-session-id.test.tssrc/main/daemon/pty-session-id.tssrc/main/daemon/session.test.tssrc/main/daemon/session.tssrc/main/daemon/terminal-host-agent-session-claim.tssrc/main/daemon/terminal-host-agent-session-generations.tssrc/main/daemon/terminal-host-agent-session.test.tssrc/main/daemon/terminal-host-create-contract.tssrc/main/daemon/terminal-host-options.tssrc/main/daemon/terminal-host-session-create.tssrc/main/daemon/terminal-host-session-cwd.tssrc/main/daemon/terminal-host-session-listing.tssrc/main/daemon/terminal-host-tombstones.tssrc/main/daemon/terminal-host.tssrc/main/daemon/types.tssrc/main/index.tssrc/main/ipc/pty.test.tssrc/main/ipc/pty.tssrc/main/ipc/ssh.test.tssrc/main/ipc/ssh.tssrc/main/orca-profiles/profile-project-session-state.test.tssrc/main/orca-profiles/profile-project-session-state.tssrc/main/orca-profiles/profile-project-session-transfer.tssrc/main/orca-profiles/profile-project-transfer-payload.tssrc/main/persistence.test.tssrc/main/persistence.tssrc/main/providers/local-pty-provider.test.tssrc/main/providers/local-pty-provider.tssrc/main/providers/pty-spawn-result.tssrc/main/providers/ssh-agent-session-claim-validation.tssrc/main/providers/ssh-agent-session-create-operation.tssrc/main/providers/ssh-agent-session-process-list.tssrc/main/providers/ssh-capability-probe-waiter.tssrc/main/providers/ssh-pty-errors.tssrc/main/providers/ssh-pty-provider-agent-session-create-operation.test.tssrc/main/providers/ssh-pty-provider-claim-incarnation.test.tssrc/main/providers/ssh-pty-provider-contract.tssrc/main/providers/ssh-pty-provider-exit-race.test.tssrc/main/providers/ssh-pty-provider.test.tssrc/main/providers/ssh-pty-provider.tssrc/main/providers/ssh-pty-session-reattach.tssrc/main/providers/ssh-pty-spawn-env.tssrc/main/providers/ssh-pty-spawn-exit-race.tssrc/main/providers/ssh-pty-spawn-request.tssrc/main/providers/types.tssrc/main/runtime/agent-session-claim-identity.test.tssrc/main/runtime/agent-session-claim-identity.tssrc/main/runtime/mobile-rpc-allowlist.test.tssrc/main/runtime/mobile-session-terminal-persistence-retirement.test.tssrc/main/runtime/mobile-session-terminal-persistence-retirement.tssrc/main/runtime/mobile-session-terminal-retirement.test.tssrc/main/runtime/mobile-session-terminal-retirement.tssrc/main/runtime/orca-runtime-agent-session-operation.test.tssrc/main/runtime/orca-runtime-terminal-retirement.test.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/remote-agent-session-host-authority.integration.test.tssrc/main/runtime/rpc/errors.tssrc/main/runtime/rpc/methods/agent-session.test.tssrc/main/runtime/rpc/methods/agent-session.tssrc/main/runtime/rpc/methods/index.tssrc/main/runtime/rpc/methods/session-tabs.test.tssrc/main/runtime/runtime-rpc.tssrc/main/runtime/workspace-session-terminal-membership-authority.tssrc/main/ssh/ssh-relay-session-incarnation.test.tssrc/main/ssh/ssh-relay-session-reconnect-incarnation.test.tssrc/main/ssh/ssh-relay-session-test-fixtures.tssrc/main/ssh/ssh-relay-session.test.tssrc/main/ssh/ssh-relay-session.tssrc/relay/pty-handler.test.tssrc/relay/pty-handler.tssrc/renderer/src/components/right-sidebar/ai-vault-session-launch-actions.tssrc/renderer/src/components/tab-group/AiVaultSessionDropLayer.tsxsrc/renderer/src/components/tab-group/useTabGroupWorkspaceModel.focus.test.tssrc/renderer/src/components/tab-group/useTabGroupWorkspaceModel.tssrc/renderer/src/components/terminal-pane/pty-connection-types.tssrc/renderer/src/components/terminal-pane/pty-connection.test.tssrc/renderer/src/components/terminal-pane/pty-connection.tssrc/renderer/src/components/terminal-pane/pty-transport-types.tssrc/renderer/src/components/terminal-pane/pty-transport.test.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-transport.test.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-transport.tssrc/renderer/src/hooks/useIpcEvents.test.tssrc/renderer/src/hooks/useIpcEvents.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/renderer/src/lib/agent-background-session-test-state.tssrc/renderer/src/lib/ai-vault-resume-command.test.tssrc/renderer/src/lib/ai-vault-resume-command.tssrc/renderer/src/lib/launch-agent-background-session.test.tssrc/renderer/src/lib/launch-agent-background-session.tssrc/renderer/src/lib/launch-agent-in-new-tab.test.tssrc/renderer/src/lib/launch-agent-in-new-tab.tssrc/renderer/src/lib/launch-agent-web-host-tab.tssrc/renderer/src/lib/launch-ai-vault-session.test.tssrc/renderer/src/lib/launch-ai-vault-session.tssrc/renderer/src/lib/resume-sleeping-agent-session-remote-compat.test.tssrc/renderer/src/lib/runtime-agent-background-create.tssrc/renderer/src/lib/sleeping-agent-session-launch.tssrc/renderer/src/lib/workspace-session-host-field-ownership.tssrc/renderer/src/lib/workspace-session-host-records.tssrc/renderer/src/lib/workspace-session-host-split.test.tssrc/renderer/src/lib/workspace-session-host-split.tssrc/renderer/src/runtime/agent-session-create-operation.tssrc/renderer/src/runtime/agent-session-operation-id.test.tssrc/renderer/src/runtime/agent-session-operation-id.tssrc/renderer/src/runtime/remote-agent-session-launch.test.tssrc/renderer/src/runtime/remote-agent-session-launch.tssrc/renderer/src/runtime/runtime-client-target.tssrc/renderer/src/runtime/runtime-rpc-client.test.tssrc/renderer/src/runtime/runtime-rpc-client.tssrc/renderer/src/runtime/web-agent-session-handoff.tssrc/renderer/src/runtime/web-runtime-session.test.tssrc/renderer/src/runtime/web-runtime-session.tssrc/renderer/src/runtime/web-session-tabs-sync.test.tssrc/renderer/src/runtime/web-session-tabs-sync.tssrc/renderer/src/store/slices/runtime-status.tssrc/renderer/src/store/slices/terminals.tssrc/shared/agent-session-host-authority.tssrc/shared/claimed-agent-pty-owner-snapshot.tssrc/shared/claimed-agent-pty-owner.test.tssrc/shared/claimed-agent-pty-owner.tssrc/shared/protocol-version.tssrc/shared/pty-incarnation.tssrc/shared/runtime-types.tssrc/shared/types.tssrc/shared/workspace-session-schema.ts
| function canonicalPathForPlatform(value: string): string { | ||
| const canonical = normalize(realpathSync(value)) | ||
| return process.platform === 'win32' ? canonical.toLocaleLowerCase('en-US') : canonical | ||
| } | ||
|
|
||
| export function canonicalizeAgentSessionIdentity( | ||
| agent: unknown, | ||
| rawProviderSession: unknown | ||
| ): CanonicalAgentSessionIdentity { | ||
| if (!isResumableTuiAgent(agent)) { | ||
| throw new Error('agent_session_identity_required') | ||
| } | ||
| const providerSession = normalizeAgentProviderSession(rawProviderSession) | ||
| if (!providerSession || !getAgentResumeArgv(agent, providerSession)) { | ||
| throw new Error('agent_session_identity_required') | ||
| } | ||
| if (agent !== 'pi') { | ||
| return { agent, providerSession } | ||
| } | ||
| const transcriptPath = providerSession.transcriptPath | ||
| if ( | ||
| !transcriptPath || | ||
| !isAbsolute(transcriptPath) || | ||
| Buffer.byteLength(transcriptPath, 'utf8') > TRANSCRIPT_PATH_MAX_BYTES | ||
| ) { | ||
| throw new Error('agent_session_identity_required') | ||
| } | ||
| const canonicalTranscriptPath = canonicalPathForPlatform(transcriptPath) | ||
| if (!statSync(canonicalTranscriptPath).isFile()) { | ||
| throw new Error('agent_session_identity_required') | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Normalize filesystem errors to the identity rejection.
realpathSync (Line 52) and statSync (Line 79) throw raw ENOENT/permission errors when the pi transcript path is missing or removed mid-flight, bypassing the explicit agent_session_identity_required rejection used elsewhere in this function. A deleted/relocated transcript is an invalid identity, not an internal fault, so it should reject consistently.
🛡️ Proposed fix to normalize the rejection
-function canonicalPathForPlatform(value: string): string {
- const canonical = normalize(realpathSync(value))
- return process.platform === 'win32' ? canonical.toLocaleLowerCase('en-US') : canonical
-}
+function canonicalPathForPlatform(value: string): string {
+ let canonical: string
+ try {
+ canonical = normalize(realpathSync(value))
+ } catch {
+ throw new Error('agent_session_identity_required')
+ }
+ return process.platform === 'win32' ? canonical.toLocaleLowerCase('en-US') : canonical
+}And guard the statSync call similarly:
- const canonicalTranscriptPath = canonicalPathForPlatform(transcriptPath)
- if (!statSync(canonicalTranscriptPath).isFile()) {
- throw new Error('agent_session_identity_required')
- }
+ const canonicalTranscriptPath = canonicalPathForPlatform(transcriptPath)
+ let isFile = false
+ try {
+ isFile = statSync(canonicalTranscriptPath).isFile()
+ } catch {
+ throw new Error('agent_session_identity_required')
+ }
+ if (!isFile) {
+ throw new Error('agent_session_identity_required')
+ }📝 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.
| function canonicalPathForPlatform(value: string): string { | |
| const canonical = normalize(realpathSync(value)) | |
| return process.platform === 'win32' ? canonical.toLocaleLowerCase('en-US') : canonical | |
| } | |
| export function canonicalizeAgentSessionIdentity( | |
| agent: unknown, | |
| rawProviderSession: unknown | |
| ): CanonicalAgentSessionIdentity { | |
| if (!isResumableTuiAgent(agent)) { | |
| throw new Error('agent_session_identity_required') | |
| } | |
| const providerSession = normalizeAgentProviderSession(rawProviderSession) | |
| if (!providerSession || !getAgentResumeArgv(agent, providerSession)) { | |
| throw new Error('agent_session_identity_required') | |
| } | |
| if (agent !== 'pi') { | |
| return { agent, providerSession } | |
| } | |
| const transcriptPath = providerSession.transcriptPath | |
| if ( | |
| !transcriptPath || | |
| !isAbsolute(transcriptPath) || | |
| Buffer.byteLength(transcriptPath, 'utf8') > TRANSCRIPT_PATH_MAX_BYTES | |
| ) { | |
| throw new Error('agent_session_identity_required') | |
| } | |
| const canonicalTranscriptPath = canonicalPathForPlatform(transcriptPath) | |
| if (!statSync(canonicalTranscriptPath).isFile()) { | |
| throw new Error('agent_session_identity_required') | |
| } | |
| function canonicalPathForPlatform(value: string): string { | |
| let canonical: string | |
| try { | |
| canonical = normalize(realpathSync(value)) | |
| } catch { | |
| throw new Error('agent_session_identity_required') | |
| } | |
| return process.platform === 'win32' ? canonical.toLocaleLowerCase('en-US') : canonical | |
| } | |
| export function canonicalizeAgentSessionIdentity( | |
| agent: unknown, | |
| rawProviderSession: unknown | |
| ): CanonicalAgentSessionIdentity { | |
| if (!isResumableTuiAgent(agent)) { | |
| throw new Error('agent_session_identity_required') | |
| } | |
| const providerSession = normalizeAgentProviderSession(rawProviderSession) | |
| if (!providerSession || !getAgentResumeArgv(agent, providerSession)) { | |
| throw new Error('agent_session_identity_required') | |
| } | |
| if (agent !== 'pi') { | |
| return { agent, providerSession } | |
| } | |
| const transcriptPath = providerSession.transcriptPath | |
| if ( | |
| !transcriptPath || | |
| !isAbsolute(transcriptPath) || | |
| Buffer.byteLength(transcriptPath, 'utf8') > TRANSCRIPT_PATH_MAX_BYTES | |
| ) { | |
| throw new Error('agent_session_identity_required') | |
| } | |
| const canonicalTranscriptPath = canonicalPathForPlatform(transcriptPath) | |
| let isFile = false | |
| try { | |
| isFile = statSync(canonicalTranscriptPath).isFile() | |
| } catch { | |
| throw new Error('agent_session_identity_required') | |
| } | |
| if (!isFile) { | |
| throw new Error('agent_session_identity_required') | |
| } |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/main/providers/ssh-pty-provider.ts (1)
184-199: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueDead
sessionExpiredbranch in the fresh-create return.
opts.sessionIdtruthy is already fully handled by the earlyreattachSshPtySessionWithExitFencereturn at Line 126, so this return path is only reached whenopts.sessionIdis falsy. The...(opts.sessionId ? { sessionExpired: true } : {})therefore always spreads{}. Drop it (or confirm whether a fresh create was ever meant to surfacesessionExpired).♻️ Suggested cleanup
- ...(opts.sessionId ? { sessionExpired: true } : {}) }
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: f8b2741b-b933-4464-a696-52870914e2a0
📥 Commits
Reviewing files that changed from the base of the PR and between 64196d977a8a60e414c1f3045a68c3d5b35d25c4 and af2e0a7.
📒 Files selected for processing (153)
config/localization-coverage-allowlist.jsonconfig/scripts/remote-agent-session-authority-repro.mjsconfig/scripts/remote-agent-session-repro-client.mjsconfig/scripts/remote-agent-session-repro-fixture.mjsdocs/reference/remote-agent-session-host-authority.mdpackage.jsonsrc/main/daemon/daemon-create-or-attach-result.tssrc/main/daemon/daemon-foreground-confirmation-protocol.test.tssrc/main/daemon/daemon-protocol-version.test.tssrc/main/daemon/daemon-protocol-version.tssrc/main/daemon/daemon-pty-adapter.test.tssrc/main/daemon/daemon-pty-adapter.tssrc/main/daemon/daemon-pty-provider.test.tssrc/main/daemon/daemon-pty-provider.tssrc/main/daemon/daemon-pty-router.test.tssrc/main/daemon/daemon-pty-router.tssrc/main/daemon/daemon-server.tssrc/main/daemon/daemon-stream-events.tssrc/main/daemon/degraded-daemon-pty-provider.test.tssrc/main/daemon/degraded-daemon-pty-provider.tssrc/main/daemon/pty-session-id.test.tssrc/main/daemon/pty-session-id.tssrc/main/daemon/session.test.tssrc/main/daemon/session.tssrc/main/daemon/terminal-host-agent-session-claim.tssrc/main/daemon/terminal-host-agent-session-generations.tssrc/main/daemon/terminal-host-agent-session.test.tssrc/main/daemon/terminal-host-create-contract.tssrc/main/daemon/terminal-host-options.tssrc/main/daemon/terminal-host-session-create.tssrc/main/daemon/terminal-host-session-cwd.tssrc/main/daemon/terminal-host-session-listing.tssrc/main/daemon/terminal-host-tombstones.tssrc/main/daemon/terminal-host.tssrc/main/daemon/types.tssrc/main/index.tssrc/main/ipc/pty.test.tssrc/main/ipc/pty.tssrc/main/ipc/ssh.test.tssrc/main/ipc/ssh.tssrc/main/orca-profiles/profile-project-session-state.test.tssrc/main/orca-profiles/profile-project-session-state.tssrc/main/orca-profiles/profile-project-session-transfer.tssrc/main/orca-profiles/profile-project-transfer-payload.tssrc/main/persistence.test.tssrc/main/persistence.tssrc/main/providers/local-pty-provider.test.tssrc/main/providers/local-pty-provider.tssrc/main/providers/pty-spawn-result.tssrc/main/providers/ssh-agent-session-capabilities.tssrc/main/providers/ssh-agent-session-claim-validation.tssrc/main/providers/ssh-agent-session-create-operation.tssrc/main/providers/ssh-agent-session-process-list.tssrc/main/providers/ssh-capability-probe-waiter.tssrc/main/providers/ssh-pty-errors.tssrc/main/providers/ssh-pty-provider-agent-session-create-operation.test.tssrc/main/providers/ssh-pty-provider-claim-incarnation.test.tssrc/main/providers/ssh-pty-provider-contract.tssrc/main/providers/ssh-pty-provider-exit-race.test.tssrc/main/providers/ssh-pty-provider-process-events.test.tssrc/main/providers/ssh-pty-provider.test.tssrc/main/providers/ssh-pty-provider.tssrc/main/providers/ssh-pty-session-reattach.tssrc/main/providers/ssh-pty-spawn-env.tssrc/main/providers/ssh-pty-spawn-exit-race.tssrc/main/providers/ssh-pty-spawn-request.tssrc/main/providers/types.tssrc/main/runtime/agent-session-claim-identity.test.tssrc/main/runtime/agent-session-claim-identity.tssrc/main/runtime/mobile-rpc-allowlist.test.tssrc/main/runtime/mobile-session-terminal-persistence-retirement.test.tssrc/main/runtime/mobile-session-terminal-persistence-retirement.tssrc/main/runtime/mobile-session-terminal-retirement.test.tssrc/main/runtime/mobile-session-terminal-retirement.tssrc/main/runtime/orca-runtime-agent-session-operation.test.tssrc/main/runtime/orca-runtime-terminal-retirement.test.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/remote-agent-session-host-authority.integration.test.tssrc/main/runtime/rpc/errors.tssrc/main/runtime/rpc/methods/agent-session.test.tssrc/main/runtime/rpc/methods/agent-session.tssrc/main/runtime/rpc/methods/index.tssrc/main/runtime/rpc/methods/session-tabs.test.tssrc/main/runtime/runtime-rpc.tssrc/main/runtime/workspace-session-terminal-membership-authority.tssrc/main/ssh/ssh-relay-session-incarnation.test.tssrc/main/ssh/ssh-relay-session-reconnect-incarnation.test.tssrc/main/ssh/ssh-relay-session-test-fixtures.tssrc/main/ssh/ssh-relay-session.test.tssrc/main/ssh/ssh-relay-session.tssrc/relay/pty-handler.test.tssrc/relay/pty-handler.tssrc/renderer/src/components/right-sidebar/ai-vault-session-launch-actions.tssrc/renderer/src/components/tab-group/AiVaultSessionDropLayer.tsxsrc/renderer/src/components/tab-group/useTabGroupWorkspaceModel.focus.test.tssrc/renderer/src/components/tab-group/useTabGroupWorkspaceModel.tssrc/renderer/src/components/terminal-pane/pty-connection-types.tssrc/renderer/src/components/terminal-pane/pty-connection.test.tssrc/renderer/src/components/terminal-pane/pty-connection.tssrc/renderer/src/components/terminal-pane/pty-transport-types.tssrc/renderer/src/components/terminal-pane/pty-transport.test.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-transport.test.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-transport.tssrc/renderer/src/hooks/useIpcEvents.test.tssrc/renderer/src/hooks/useIpcEvents.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/renderer/src/lib/agent-background-session-test-state.tssrc/renderer/src/lib/ai-vault-resume-command.test.tssrc/renderer/src/lib/ai-vault-resume-command.tssrc/renderer/src/lib/launch-agent-background-session.test.tssrc/renderer/src/lib/launch-agent-background-session.tssrc/renderer/src/lib/launch-agent-in-new-tab-web-runtime.test.tssrc/renderer/src/lib/launch-agent-in-new-tab.test.tssrc/renderer/src/lib/launch-agent-in-new-tab.tssrc/renderer/src/lib/launch-agent-web-host-tab.tssrc/renderer/src/lib/launch-ai-vault-session.test.tssrc/renderer/src/lib/launch-ai-vault-session.tssrc/renderer/src/lib/resume-sleeping-agent-session-remote-compat.test.tssrc/renderer/src/lib/runtime-agent-background-create.tssrc/renderer/src/lib/sleeping-agent-session-launch.tssrc/renderer/src/lib/workspace-session-host-field-ownership.tssrc/renderer/src/lib/workspace-session-host-records.tssrc/renderer/src/lib/workspace-session-host-split.test.tssrc/renderer/src/lib/workspace-session-host-split.tssrc/renderer/src/runtime/agent-session-create-operation.tssrc/renderer/src/runtime/agent-session-operation-id.test.tssrc/renderer/src/runtime/agent-session-operation-id.tssrc/renderer/src/runtime/remote-agent-session-launch.test.tssrc/renderer/src/runtime/remote-agent-session-launch.tssrc/renderer/src/runtime/runtime-client-target.tssrc/renderer/src/runtime/runtime-rpc-client.test.tssrc/renderer/src/runtime/runtime-rpc-client.tssrc/renderer/src/runtime/web-agent-session-handoff.tssrc/renderer/src/runtime/web-runtime-session.test.tssrc/renderer/src/runtime/web-runtime-session.tssrc/renderer/src/runtime/web-session-tabs-sync.test.tssrc/renderer/src/runtime/web-session-tabs-sync.tssrc/renderer/src/store/slices/runtime-status.tssrc/renderer/src/store/slices/terminals.tssrc/shared/agent-session-host-authority.tssrc/shared/claimed-agent-pty-owner-snapshot.tssrc/shared/claimed-agent-pty-owner.test.tssrc/shared/claimed-agent-pty-owner.tssrc/shared/protocol-version.tssrc/shared/pty-incarnation.tssrc/shared/runtime-types.tssrc/shared/types.tssrc/shared/workspace-session-schema.ts
🚧 Files skipped from review as they are similar to previous changes (139)
- src/main/daemon/daemon-foreground-confirmation-protocol.test.ts
- src/main/daemon/daemon-protocol-version.test.ts
- src/main/runtime/rpc/methods/index.ts
- config/localization-coverage-allowlist.json
- src/main/providers/ssh-capability-probe-waiter.ts
- src/main/daemon/pty-session-id.ts
- src/main/daemon/terminal-host-session-cwd.ts
- src/main/providers/ssh-pty-provider-contract.ts
- src/main/daemon/terminal-host-agent-session-generations.ts
- src/main/providers/ssh-pty-spawn-request.ts
- src/main/daemon/daemon-stream-events.ts
- src/main/daemon/terminal-host-agent-session.test.ts
- src/main/daemon/terminal-host-session-listing.ts
- src/renderer/src/store/slices/runtime-status.ts
- src/renderer/src/runtime/agent-session-operation-id.test.ts
- src/main/daemon/daemon-pty-provider.test.ts
- src/main/daemon/terminal-host-options.ts
- src/renderer/src/runtime/runtime-client-target.ts
- src/shared/pty-incarnation.ts
- src/main/providers/ssh-agent-session-process-list.ts
- config/scripts/remote-agent-session-repro-fixture.mjs
- src/main/providers/pty-spawn-result.ts
- src/renderer/src/lib/sleeping-agent-session-launch.ts
- src/shared/protocol-version.ts
- package.json
- src/main/ipc/ssh.ts
- src/renderer/src/lib/workspace-session-host-field-ownership.ts
- src/main/runtime/mobile-session-terminal-retirement.test.ts
- src/renderer/src/components/right-sidebar/ai-vault-session-launch-actions.ts
- src/main/daemon/terminal-host-tombstones.ts
- src/renderer/src/components/terminal-pane/pty-connection.test.ts
- src/main/runtime/mobile-rpc-allowlist.test.ts
- src/renderer/src/runtime/agent-session-operation-id.ts
- src/main/daemon/session.test.ts
- src/main/providers/ssh-pty-spawn-exit-race.ts
- src/main/ssh/ssh-relay-session.test.ts
- src/main/providers/ssh-pty-provider-claim-incarnation.test.ts
- src/renderer/src/hooks/useIpcEvents.test.ts
- config/scripts/remote-agent-session-repro-client.mjs
- src/main/runtime/orca-runtime.test.ts
- src/main/daemon/terminal-host-agent-session-claim.ts
- src/main/runtime/orca-runtime-agent-session-operation.test.ts
- src/main/runtime/agent-session-claim-identity.test.ts
- src/main/daemon/pty-session-id.test.ts
- src/renderer/src/lib/ai-vault-resume-command.test.ts
- src/shared/types.ts
- src/main/daemon/terminal-host-create-contract.ts
- src/main/daemon/daemon-create-or-attach-result.ts
- src/main/runtime/rpc/errors.ts
- src/renderer/src/components/terminal-pane/pty-connection-types.ts
- src/renderer/src/components/tab-group/AiVaultSessionDropLayer.tsx
- src/shared/workspace-session-schema.ts
- src/main/providers/ssh-agent-session-create-operation.ts
- src/main/ipc/ssh.test.ts
- src/main/orca-profiles/profile-project-session-state.test.ts
- src/main/providers/ssh-pty-spawn-env.ts
- src/renderer/src/hooks/useIpcEvents.ts
- src/renderer/src/lib/workspace-session-host-split.test.ts
- src/renderer/src/i18n/locales/es.json
- config/scripts/remote-agent-session-authority-repro.mjs
- src/main/daemon/degraded-daemon-pty-provider.test.ts
- src/main/providers/ssh-pty-provider-exit-race.test.ts
- src/renderer/src/components/tab-group/useTabGroupWorkspaceModel.ts
- src/renderer/src/lib/workspace-session-host-records.ts
- src/main/ssh/ssh-relay-session-incarnation.test.ts
- src/renderer/src/runtime/remote-agent-session-launch.ts
- src/main/runtime/runtime-rpc.ts
- src/renderer/src/components/terminal-pane/pty-transport-types.ts
- src/renderer/src/i18n/locales/en.json
- src/main/daemon/daemon-pty-adapter.test.ts
- src/renderer/src/components/tab-group/useTabGroupWorkspaceModel.focus.test.ts
- src/main/daemon/daemon-pty-provider.ts
- src/renderer/src/runtime/agent-session-create-operation.ts
- src/renderer/src/components/terminal-pane/pty-connection.ts
- src/main/providers/ssh-pty-errors.ts
- src/main/providers/ssh-pty-provider-agent-session-create-operation.test.ts
- src/main/index.ts
- src/renderer/src/store/slices/terminals.ts
- src/main/orca-profiles/profile-project-session-transfer.ts
- src/renderer/src/i18n/locales/ja.json
- src/main/runtime/agent-session-claim-identity.ts
- src/main/providers/local-pty-provider.test.ts
- src/renderer/src/components/terminal-pane/pty-transport.test.ts
- src/renderer/src/lib/resume-sleeping-agent-session-remote-compat.test.ts
- src/main/runtime/rpc/methods/session-tabs.test.ts
- src/main/runtime/rpc/methods/agent-session.test.ts
- src/shared/claimed-agent-pty-owner.test.ts
- src/main/ssh/ssh-relay-session-reconnect-incarnation.test.ts
- src/renderer/src/lib/launch-ai-vault-session.ts
- src/main/orca-profiles/profile-project-transfer-payload.ts
- src/main/daemon/daemon-pty-router.test.ts
- src/main/runtime/mobile-session-terminal-persistence-retirement.test.ts
- src/renderer/src/lib/launch-agent-background-session.ts
- src/renderer/src/runtime/web-session-tabs-sync.test.ts
- src/main/ssh/ssh-relay-session-test-fixtures.ts
- src/renderer/src/lib/runtime-agent-background-create.ts
- src/main/daemon/session.ts
- src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts
- src/main/runtime/remote-agent-session-host-authority.integration.test.ts
- src/renderer/src/lib/launch-ai-vault-session.test.ts
- src/main/daemon/daemon-protocol-version.ts
- src/main/daemon/types.ts
- src/renderer/src/lib/ai-vault-resume-command.ts
- src/main/daemon/daemon-pty-router.ts
- src/renderer/src/lib/launch-agent-in-new-tab.ts
- src/renderer/src/runtime/remote-agent-session-launch.test.ts
- src/shared/claimed-agent-pty-owner-snapshot.ts
- src/renderer/src/i18n/locales/zh.json
- src/renderer/src/runtime/runtime-rpc-client.test.ts
- src/main/runtime/workspace-session-terminal-membership-authority.ts
- src/renderer/src/runtime/web-runtime-session.ts
- src/renderer/src/runtime/web-agent-session-handoff.ts
- src/main/runtime/rpc/methods/agent-session.ts
- src/renderer/src/i18n/locales/ko.json
- src/main/providers/ssh-agent-session-claim-validation.ts
- src/main/daemon/terminal-host-session-create.ts
- src/renderer/src/runtime/runtime-rpc-client.ts
- src/main/runtime/mobile-session-terminal-persistence-retirement.ts
- src/renderer/src/runtime/web-session-tabs-sync.ts
- src/main/providers/local-pty-provider.ts
- src/main/providers/types.ts
- src/renderer/src/lib/agent-background-session-test-state.ts
- src/main/runtime/orca-runtime-terminal-retirement.test.ts
- src/relay/pty-handler.test.ts
- src/main/daemon/terminal-host.ts
- src/renderer/src/runtime/web-runtime-session.test.ts
- src/main/runtime/mobile-session-terminal-retirement.ts
- src/renderer/src/lib/launch-agent-background-session.test.ts
- src/shared/claimed-agent-pty-owner.ts
- src/main/persistence.test.ts
- src/main/persistence.ts
- src/main/runtime/orca-runtime.ts
- src/main/ipc/pty.test.ts
- src/main/ipc/pty.ts
- src/relay/pty-handler.ts
- src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.test.ts
- src/main/daemon/daemon-pty-adapter.ts
- src/renderer/src/lib/workspace-session-host-split.ts
- src/main/ssh/ssh-relay-session.ts
4517536 to
180d3cf
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
src/main/daemon/daemon-server.ts (1)
721-786: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winReject an attach/create whose PTY exited before its response.
onExitqueues the exit but does not fence the pending RPC. If the PTY exits duringhost.createOrAttach, Lines 762-786 still register and return it as a successful live session, allowing a stale binding/ghost surface race.Proposed fix
+ let exitedBeforeResponse = false try { ... streamClient: { ... onExit: (code, incarnationId) => { + exitedBeforeResponse = true ... } } } finally { ... } routedSessionId = result.agentSessionEnsure?.owner.ptyId ?? p.sessionId + if (exitedBeforeResponse) { + throw new Error('agent_session_exited_during_start') + } this.streamClientIdBySessionId.set(routedSessionId, clientId)Based on PR objectives, an exit must retire the surface rather than permit a successful stale attachment.
src/main/persistence.ts (1)
4821-4831: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy liftPrune
workspaceSessionsByHostIdhere too
removeWorktreeMetaonly clears the localworkspaceSession; remote/runtime partitions inworkspaceSessionsByHostIdcan still retain the removed worktree’s tabs and topology fence. That leaves stale PTY state behind after worktree deletion.
🧹 Nitpick comments (3)
src/main/index.ts (1)
1989-1992: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDocument the shared profile-path authority domain.
Using the profile path as both key directory and authority-domain ID is intentional but non-obvious; add a rationale comment so future path changes do not silently invalidate durable claims.
Suggested clarification
+ // Why: the authority domain must remain profile-scoped and stable across restarts, + // matching the location of the durable coordination key. agentSessionClaimSigner: loadAgentSessionClaimSigner( getProfileUserDataPath(), getProfileUserDataPath()As per coding guidelines, “For non-obvious TypeScript code, add a concise comment explaining why the constraint exists, not how the code works.”
Source: Coding guidelines
src/main/daemon/daemon-server.ts (1)
689-695: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDocument why malformed claims must fail before PTY admission.
This validation is security-sensitive and non-obvious enough to warrant a brief rationale comment.
As per coding guidelines, “For non-obvious TypeScript code, add a concise comment explaining why the constraint exists.”
Source: Coding guidelines
src/main/providers/ssh-pty-session-reattach.ts (1)
88-100: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExplain the attach/exit race fence.
Add a short rationale before the match check; this prevents future changes from removing a necessary dead-binding guard.
As per coding guidelines, “For non-obvious TypeScript code, add a concise comment explaining why the constraint exists.”
Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 74e63cc0-efa3-48e6-af4d-52cb89c54a1a
📒 Files selected for processing (143)
config/localization-coverage-allowlist.jsonconfig/scripts/remote-agent-session-authority-repro.mjsconfig/scripts/remote-agent-session-repro-client.mjsconfig/scripts/remote-agent-session-repro-fixture.mjsdocs/reference/remote-agent-session-host-authority.mdpackage.jsonsrc/main/daemon/daemon-create-or-attach-result.tssrc/main/daemon/daemon-foreground-confirmation-protocol.test.tssrc/main/daemon/daemon-protocol-version.test.tssrc/main/daemon/daemon-protocol-version.tssrc/main/daemon/daemon-pty-adapter.test.tssrc/main/daemon/daemon-pty-adapter.tssrc/main/daemon/daemon-pty-provider.test.tssrc/main/daemon/daemon-pty-provider.tssrc/main/daemon/daemon-pty-router.test.tssrc/main/daemon/daemon-pty-router.tssrc/main/daemon/daemon-server.tssrc/main/daemon/daemon-stream-events.tssrc/main/daemon/degraded-daemon-pty-provider.test.tssrc/main/daemon/degraded-daemon-pty-provider.tssrc/main/daemon/pty-session-id.test.tssrc/main/daemon/pty-session-id.tssrc/main/daemon/session.test.tssrc/main/daemon/session.tssrc/main/daemon/terminal-host-agent-session-claim.tssrc/main/daemon/terminal-host-agent-session-generations.tssrc/main/daemon/terminal-host-agent-session.test.tssrc/main/daemon/terminal-host-create-contract.tssrc/main/daemon/terminal-host-options.tssrc/main/daemon/terminal-host-session-create.tssrc/main/daemon/terminal-host-session-cwd.tssrc/main/daemon/terminal-host-session-listing.tssrc/main/daemon/terminal-host-tombstones.tssrc/main/daemon/terminal-host.tssrc/main/daemon/types.tssrc/main/index.tssrc/main/ipc/pty.test.tssrc/main/ipc/pty.tssrc/main/ipc/ssh.test.tssrc/main/ipc/ssh.tssrc/main/orca-profiles/profile-project-session-state.test.tssrc/main/orca-profiles/profile-project-session-state.tssrc/main/orca-profiles/profile-project-session-transfer.tssrc/main/orca-profiles/profile-project-transfer-payload.tssrc/main/persistence.test.tssrc/main/persistence.tssrc/main/providers/local-pty-provider.test.tssrc/main/providers/local-pty-provider.tssrc/main/providers/pty-spawn-result.tssrc/main/providers/ssh-agent-session-capabilities.tssrc/main/providers/ssh-agent-session-claim-validation.tssrc/main/providers/ssh-agent-session-create-operation.tssrc/main/providers/ssh-agent-session-process-list.tssrc/main/providers/ssh-capability-probe-waiter.tssrc/main/providers/ssh-pty-errors.tssrc/main/providers/ssh-pty-provider-agent-session-create-operation.test.tssrc/main/providers/ssh-pty-provider-claim-incarnation.test.tssrc/main/providers/ssh-pty-provider-contract.tssrc/main/providers/ssh-pty-provider-exit-race.test.tssrc/main/providers/ssh-pty-provider-process-events.test.tssrc/main/providers/ssh-pty-provider.test.tssrc/main/providers/ssh-pty-provider.tssrc/main/providers/ssh-pty-session-reattach.tssrc/main/providers/ssh-pty-spawn-env.tssrc/main/providers/ssh-pty-spawn-exit-race.tssrc/main/providers/ssh-pty-spawn-request.tssrc/main/providers/types.tssrc/main/runtime/agent-session-claim-identity.test.tssrc/main/runtime/agent-session-claim-identity.tssrc/main/runtime/mobile-rpc-allowlist.test.tssrc/main/runtime/mobile-session-terminal-persistence-retirement.test.tssrc/main/runtime/mobile-session-terminal-persistence-retirement.tssrc/main/runtime/mobile-session-terminal-retirement.test.tssrc/main/runtime/mobile-session-terminal-retirement.tssrc/main/runtime/orca-runtime-agent-session-operation.test.tssrc/main/runtime/orca-runtime-terminal-retirement.test.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/remote-agent-session-host-authority.integration.test.tssrc/main/runtime/rpc/errors.tssrc/main/runtime/rpc/methods/agent-session.test.tssrc/main/runtime/rpc/methods/agent-session.tssrc/main/runtime/rpc/methods/index.tssrc/main/runtime/rpc/methods/session-tabs.test.tssrc/main/runtime/runtime-rpc.tssrc/main/runtime/workspace-session-terminal-membership-authority.tssrc/main/ssh/ssh-relay-session-incarnation.test.tssrc/main/ssh/ssh-relay-session-reconnect-incarnation.test.tssrc/main/ssh/ssh-relay-session-test-fixtures.tssrc/main/ssh/ssh-relay-session.test.tssrc/main/ssh/ssh-relay-session.tssrc/relay/pty-handler.test.tssrc/relay/pty-handler.tssrc/renderer/src/components/right-sidebar/ai-vault-session-launch-actions.tssrc/renderer/src/components/tab-group/AiVaultSessionDropLayer.tsxsrc/renderer/src/components/tab-group/useTabGroupWorkspaceModel.focus.test.tssrc/renderer/src/components/tab-group/useTabGroupWorkspaceModel.tssrc/renderer/src/components/terminal-pane/pty-connection-types.tssrc/renderer/src/components/terminal-pane/pty-connection.test.tssrc/renderer/src/components/terminal-pane/pty-connection.tssrc/renderer/src/components/terminal-pane/pty-transport-types.tssrc/renderer/src/components/terminal-pane/pty-transport.test.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-transport.test.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-transport.tssrc/renderer/src/hooks/useIpcEvents.test.tssrc/renderer/src/hooks/useIpcEvents.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/renderer/src/lib/agent-background-session-test-state.tssrc/renderer/src/lib/ai-vault-resume-command.test.tssrc/renderer/src/lib/ai-vault-resume-command.tssrc/renderer/src/lib/launch-agent-background-session.test.tssrc/renderer/src/lib/launch-agent-background-session.tssrc/renderer/src/lib/launch-agent-in-new-tab-cwd.test.tssrc/renderer/src/lib/launch-agent-in-new-tab-web-runtime.test.tssrc/renderer/src/lib/launch-agent-in-new-tab.test.tssrc/renderer/src/lib/launch-agent-in-new-tab.tssrc/renderer/src/lib/launch-agent-web-host-tab.tssrc/renderer/src/lib/launch-ai-vault-session.test.tssrc/renderer/src/lib/launch-ai-vault-session.tssrc/renderer/src/lib/resume-sleeping-agent-session-remote-compat.test.tssrc/renderer/src/lib/runtime-agent-background-create.tssrc/renderer/src/lib/sleeping-agent-session-launch.tssrc/renderer/src/lib/workspace-session-host-field-ownership.tssrc/renderer/src/lib/workspace-session-host-records.tssrc/renderer/src/lib/workspace-session-host-split.test.tssrc/renderer/src/lib/workspace-session-host-split.tssrc/renderer/src/runtime/agent-session-create-operation.tssrc/renderer/src/runtime/agent-session-operation-id.test.tssrc/renderer/src/runtime/agent-session-operation-id.tssrc/renderer/src/runtime/remote-agent-session-launch.test.tssrc/renderer/src/runtime/remote-agent-session-launch.tssrc/renderer/src/runtime/runtime-client-target.tssrc/renderer/src/runtime/runtime-rpc-client.test.tssrc/renderer/src/runtime/runtime-rpc-client.tssrc/renderer/src/runtime/web-agent-session-handoff.tssrc/renderer/src/runtime/web-runtime-session.test.tssrc/renderer/src/runtime/web-runtime-session.tssrc/renderer/src/runtime/web-session-tabs-sync.test.tssrc/renderer/src/runtime/web-session-tabs-sync.ts
🚧 Files skipped from review as they are similar to previous changes (124)
- src/main/daemon/daemon-foreground-confirmation-protocol.test.ts
- src/main/daemon/daemon-protocol-version.test.ts
- src/main/providers/ssh-pty-provider-claim-incarnation.test.ts
- src/main/daemon/terminal-host-session-cwd.ts
- src/main/daemon/terminal-host-tombstones.ts
- config/localization-coverage-allowlist.json
- src/main/daemon/terminal-host-agent-session-generations.ts
- config/scripts/remote-agent-session-repro-client.mjs
- src/main/daemon/terminal-host-session-listing.ts
- src/main/daemon/terminal-host-agent-session.test.ts
- src/main/runtime/rpc/methods/index.ts
- src/main/daemon/pty-session-id.ts
- src/main/providers/ssh-pty-provider-exit-race.test.ts
- src/main/runtime/runtime-rpc.ts
- src/renderer/src/lib/workspace-session-host-field-ownership.ts
- src/main/providers/ssh-capability-probe-waiter.ts
- src/renderer/src/hooks/useIpcEvents.test.ts
- src/renderer/src/components/terminal-pane/pty-transport-types.ts
- src/renderer/src/runtime/agent-session-operation-id.ts
- src/main/daemon/degraded-daemon-pty-provider.test.ts
- src/main/daemon/daemon-stream-events.ts
- src/main/providers/ssh-agent-session-process-list.ts
- src/renderer/src/components/terminal-pane/pty-connection-types.ts
- config/scripts/remote-agent-session-repro-fixture.mjs
- src/renderer/src/runtime/agent-session-operation-id.test.ts
- src/renderer/src/components/terminal-pane/pty-connection.ts
- src/renderer/src/components/tab-group/useTabGroupWorkspaceModel.ts
- src/main/runtime/mobile-session-terminal-retirement.test.ts
- src/main/providers/ssh-pty-provider-contract.ts
- src/renderer/src/lib/ai-vault-resume-command.test.ts
- src/main/providers/pty-spawn-result.ts
- src/main/providers/ssh-pty-spawn-exit-race.ts
- src/main/daemon/daemon-create-or-attach-result.ts
- src/main/daemon/pty-session-id.test.ts
- src/main/daemon/types.ts
- src/renderer/src/lib/sleeping-agent-session-launch.ts
- src/main/providers/ssh-pty-errors.ts
- src/main/providers/ssh-pty-spawn-request.ts
- src/main/providers/ssh-agent-session-create-operation.ts
- src/renderer/src/hooks/useIpcEvents.ts
- package.json
- src/main/runtime/orca-runtime-agent-session-operation.test.ts
- src/main/providers/ssh-agent-session-capabilities.ts
- src/main/ssh/ssh-relay-session-incarnation.test.ts
- src/main/runtime/agent-session-claim-identity.test.ts
- src/main/orca-profiles/profile-project-transfer-payload.ts
- src/renderer/src/components/terminal-pane/pty-connection.test.ts
- src/main/daemon/terminal-host-create-contract.ts
- src/main/runtime/remote-agent-session-host-authority.integration.test.ts
- src/main/daemon/daemon-pty-provider.ts
- src/renderer/src/components/tab-group/useTabGroupWorkspaceModel.focus.test.ts
- src/renderer/src/lib/workspace-session-host-records.ts
- src/main/runtime/mobile-session-terminal-persistence-retirement.ts
- src/main/runtime/orca-runtime.test.ts
- src/main/daemon/daemon-pty-router.ts
- src/main/daemon/session.test.ts
- src/main/runtime/rpc/errors.ts
- src/main/daemon/terminal-host-agent-session-claim.ts
- src/main/providers/ssh-pty-provider-agent-session-create-operation.test.ts
- src/renderer/src/runtime/runtime-client-target.ts
- src/renderer/src/lib/launch-ai-vault-session.ts
- src/renderer/src/runtime/remote-agent-session-launch.ts
- src/renderer/src/lib/launch-agent-background-session.ts
- src/main/orca-profiles/profile-project-session-transfer.ts
- src/renderer/src/runtime/web-agent-session-handoff.ts
- src/main/runtime/mobile-rpc-allowlist.test.ts
- src/main/runtime/agent-session-claim-identity.ts
- src/main/providers/local-pty-provider.test.ts
- src/main/ssh/ssh-relay-session-test-fixtures.ts
- src/renderer/src/runtime/agent-session-create-operation.ts
- config/scripts/remote-agent-session-authority-repro.mjs
- src/main/ipc/ssh.ts
- src/renderer/src/runtime/runtime-rpc-client.test.ts
- src/renderer/src/runtime/remote-agent-session-launch.test.ts
- src/renderer/src/i18n/locales/en.json
- src/renderer/src/lib/runtime-agent-background-create.ts
- src/renderer/src/components/right-sidebar/ai-vault-session-launch-actions.ts
- src/main/daemon/degraded-daemon-pty-provider.ts
- src/renderer/src/i18n/locales/zh.json
- src/main/daemon/daemon-protocol-version.ts
- src/renderer/src/lib/launch-agent-in-new-tab-web-runtime.test.ts
- src/main/daemon/session.ts
- src/main/orca-profiles/profile-project-session-state.ts
- src/main/daemon/daemon-pty-adapter.test.ts
- src/main/runtime/workspace-session-terminal-membership-authority.ts
- src/main/daemon/terminal-host.ts
- src/main/providers/ssh-pty-provider.test.ts
- src/renderer/src/i18n/locales/ja.json
- src/main/providers/ssh-pty-spawn-env.ts
- src/main/ipc/ssh.test.ts
- src/renderer/src/lib/launch-agent-in-new-tab.test.ts
- src/renderer/src/components/terminal-pane/pty-transport.test.ts
- src/renderer/src/lib/agent-background-session-test-state.ts
- src/main/providers/types.ts
- src/main/daemon/daemon-pty-router.test.ts
- src/main/runtime/rpc/methods/session-tabs.test.ts
- src/renderer/src/lib/resume-sleeping-agent-session-remote-compat.test.ts
- src/main/providers/local-pty-provider.ts
- src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts
- src/main/runtime/mobile-session-terminal-persistence-retirement.test.ts
- src/renderer/src/runtime/web-session-tabs-sync.test.ts
- src/renderer/src/components/tab-group/AiVaultSessionDropLayer.tsx
- src/main/runtime/rpc/methods/agent-session.test.ts
- src/main/providers/ssh-pty-provider.ts
- src/main/ssh/ssh-relay-session-reconnect-incarnation.test.ts
- src/renderer/src/runtime/web-runtime-session.ts
- src/main/runtime/mobile-session-terminal-retirement.ts
- src/main/runtime/orca-runtime-terminal-retirement.test.ts
- src/main/runtime/rpc/methods/agent-session.ts
- src/main/providers/ssh-agent-session-claim-validation.ts
- src/main/daemon/terminal-host-session-create.ts
- src/renderer/src/lib/workspace-session-host-split.ts
- src/relay/pty-handler.test.ts
- src/renderer/src/runtime/web-session-tabs-sync.ts
- src/renderer/src/runtime/runtime-rpc-client.ts
- src/renderer/src/lib/launch-ai-vault-session.test.ts
- src/main/persistence.test.ts
- src/renderer/src/runtime/web-runtime-session.test.ts
- src/relay/pty-handler.ts
- src/main/runtime/orca-runtime.ts
- src/main/ssh/ssh-relay-session.ts
- src/main/daemon/daemon-pty-adapter.ts
- src/main/ipc/pty.test.ts
- src/main/ipc/pty.ts
👮 Files not reviewed due to content moderation or server errors (1)
- src/renderer/src/i18n/locales/ko.json
| const relaySessionId = toRelaySshPtyId(args.connectionId, args.sessionId) | ||
| console.warn(`[ssh-pty] spawn() called with sessionId=${args.sessionId}, attempting pty.attach`) | ||
| try { | ||
| // Why: expected pane identity prevents a reused relay id from attaching the wrong shell. | ||
| const expectedPaneKey = args.options.paneKey ?? args.options.env?.ORCA_PANE_KEY | ||
| const expectedTabId = args.options.tabId ?? args.options.env?.ORCA_TAB_ID | ||
| const attachResult = parseSshPtyAttachResult( | ||
| await args.mux.request('pty.attach', { | ||
| id: relaySessionId, | ||
| cols: args.options.cols, | ||
| rows: args.options.rows, | ||
| suppressReplayNotification: true, | ||
| ...(expectedPaneKey ? { expectedPaneKey } : {}), | ||
| ...(expectedTabId ? { expectedTabId } : {}) | ||
| }) | ||
| ) | ||
| console.warn( | ||
| `[ssh-pty] pty.attach succeeded for ${args.sessionId}, replay=${!!attachResult.replay}` | ||
| ) | ||
| return { | ||
| id: toAppSshPtyId(args.connectionId, relaySessionId), | ||
| isReattach: true, | ||
| ...(attachResult.replay ? { replay: attachResult.replay } : {}), | ||
| ...(attachResult.incarnationId ? { incarnationId: attachResult.incarnationId } : {}) | ||
| } | ||
| } catch (error) { | ||
| // Why: an expired relay lease must be surfaced distinctly so the renderer clears its binding. | ||
| console.warn(`[ssh-pty] pty.attach FAILED for ${args.sessionId}:`, error) | ||
| if (isSshPtyNotFoundError(error)) { | ||
| const mismatchMarker = isSshPtyIdentityMismatchError(error) | ||
| ? ` ${SSH_PTY_IDENTITY_MISMATCH_ERROR}` | ||
| : '' | ||
| throw new Error(`${SSH_SESSION_EXPIRED_ERROR}: ${relaySessionId}${mismatchMarker}`) |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win
Do not log raw relay errors or session identifiers.
The failure path writes the full remote error object, and all paths expose session IDs. Log a stable error class/code instead.
Proposed fix
- console.warn(`[ssh-pty] spawn() called with sessionId=${args.sessionId}, attempting pty.attach`)
+ console.warn('[ssh-pty] attempting pty.attach')
...
- console.warn(
- `[ssh-pty] pty.attach succeeded for ${args.sessionId}, replay=${!!attachResult.replay}`
- )
+ console.warn('[ssh-pty] pty.attach succeeded', { replay: Boolean(attachResult.replay) })
...
- console.warn(`[ssh-pty] pty.attach FAILED for ${args.sessionId}:`, error)
+ console.warn('[ssh-pty] pty.attach failed', {
+ reason: isSshPtyNotFoundError(error) ? 'not-found' : 'request-error'
+ })📝 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 relaySessionId = toRelaySshPtyId(args.connectionId, args.sessionId) | |
| console.warn(`[ssh-pty] spawn() called with sessionId=${args.sessionId}, attempting pty.attach`) | |
| try { | |
| // Why: expected pane identity prevents a reused relay id from attaching the wrong shell. | |
| const expectedPaneKey = args.options.paneKey ?? args.options.env?.ORCA_PANE_KEY | |
| const expectedTabId = args.options.tabId ?? args.options.env?.ORCA_TAB_ID | |
| const attachResult = parseSshPtyAttachResult( | |
| await args.mux.request('pty.attach', { | |
| id: relaySessionId, | |
| cols: args.options.cols, | |
| rows: args.options.rows, | |
| suppressReplayNotification: true, | |
| ...(expectedPaneKey ? { expectedPaneKey } : {}), | |
| ...(expectedTabId ? { expectedTabId } : {}) | |
| }) | |
| ) | |
| console.warn( | |
| `[ssh-pty] pty.attach succeeded for ${args.sessionId}, replay=${!!attachResult.replay}` | |
| ) | |
| return { | |
| id: toAppSshPtyId(args.connectionId, relaySessionId), | |
| isReattach: true, | |
| ...(attachResult.replay ? { replay: attachResult.replay } : {}), | |
| ...(attachResult.incarnationId ? { incarnationId: attachResult.incarnationId } : {}) | |
| } | |
| } catch (error) { | |
| // Why: an expired relay lease must be surfaced distinctly so the renderer clears its binding. | |
| console.warn(`[ssh-pty] pty.attach FAILED for ${args.sessionId}:`, error) | |
| if (isSshPtyNotFoundError(error)) { | |
| const mismatchMarker = isSshPtyIdentityMismatchError(error) | |
| ? ` ${SSH_PTY_IDENTITY_MISMATCH_ERROR}` | |
| : '' | |
| throw new Error(`${SSH_SESSION_EXPIRED_ERROR}: ${relaySessionId}${mismatchMarker}`) | |
| const relaySessionId = toRelaySshPtyId(args.connectionId, args.sessionId) | |
| console.warn('[ssh-pty] attempting pty.attach') | |
| try { | |
| // Why: expected pane identity prevents a reused relay id from attaching the wrong shell. | |
| const expectedPaneKey = args.options.paneKey ?? args.options.env?.ORCA_PANE_KEY | |
| const expectedTabId = args.options.tabId ?? args.options.env?.ORCA_TAB_ID | |
| const attachResult = parseSshPtyAttachResult( | |
| await args.mux.request('pty.attach', { | |
| id: relaySessionId, | |
| cols: args.options.cols, | |
| rows: args.options.rows, | |
| suppressReplayNotification: true, | |
| ...(expectedPaneKey ? { expectedPaneKey } : {}), | |
| ...(expectedTabId ? { expectedTabId } : {}) | |
| }) | |
| ) | |
| console.warn('[ssh-pty] pty.attach succeeded', { replay: Boolean(attachResult.replay) }) | |
| return { | |
| id: toAppSshPtyId(args.connectionId, relaySessionId), | |
| isReattach: true, | |
| ...(attachResult.replay ? { replay: attachResult.replay } : {}), | |
| ...(attachResult.incarnationId ? { incarnationId: attachResult.incarnationId } : {}) | |
| } | |
| } catch (error) { | |
| // Why: an expired relay lease must be surfaced distinctly so the renderer clears its binding. | |
| console.warn('[ssh-pty] pty.attach failed', { | |
| reason: isSshPtyNotFoundError(error) ? 'not-found' : 'request-error' | |
| }) | |
| if (isSshPtyNotFoundError(error)) { | |
| const mismatchMarker = isSshPtyIdentityMismatchError(error) | |
| ? ` ${SSH_PTY_IDENTITY_MISMATCH_ERROR}` | |
| : '' | |
| throw new Error(`${SSH_SESSION_EXPIRED_ERROR}: ${relaySessionId}${mismatchMarker}`) |
🧰 Tools
🪛 ast-grep (0.44.1)
[warning] 45-45: Avoid logging sensitive data
Context: console.warn([ssh-pty] spawn() called with sessionId=${args.sessionId}, attempting pty.attach)
Note: [CWE-532] Insertion of Sensitive Information into Log File.
(log-sensitive-data-typescript)
[warning] 60-62: Avoid logging sensitive data
Context: console.warn(
[ssh-pty] pty.attach succeeded for ${args.sessionId}, replay=${!!attachResult.replay}
)
Note: [CWE-532] Insertion of Sensitive Information into Log File.
(log-sensitive-data-typescript)
[warning] 71-71: Avoid logging sensitive data
Context: console.warn([ssh-pty] pty.attach FAILED for ${args.sessionId}:, error)
Note: [CWE-532] Insertion of Sensitive Information into Log File.
(log-sensitive-data-typescript)
Source: Linters/SAST tools
180d3cf to
60c9881
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
src/main/runtime/orca-runtime-agent-session-operation.test.ts (1)
42-58: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDocument the intentional type escapes.
as neverandunknown asbypass the runtime’s dependency/internal contracts. Add a concise why-comment so future contract drift is not silently hidden by this fixture.Proposed clarification
+ // Keep ledger tests isolated from unrelated store/provider setup while + // explicitly exposing the runtime seams exercised below. const runtime = new OrcaRuntimeService(Source: Coding guidelines
src/shared/claimed-agent-pty-owner.ts (1)
68-84: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd a "why" comment distinguishing the two equality checks.
agentSessionClaimsEqual(identity-scope) is checked first, thenworktreeScopeDigestis compared separately, whilefind()/the fresh-owner path elsewhere usescopedAgentSessionClaimsEqual(identity + worktree). This split is intentional — it's what lets same-identity/different-worktree claims fall through toagent_session_conflictinstead ofagent_session_ownership_unknown— but nothing here signals that distinction, making it easy to mistake for redundant/dead code.As per coding guidelines,
**/*.{ts,tsx}: "For non-obvious TypeScript code, add a concise comment explaining why the constraint exists, not how the code works."📝 Proposed comment
const live = this.live.get(key) if (live) { + // Why: this is identity-only equality (worktree-agnostic); a same-identity, + // different-worktree claim must fall through to the conflict check below + // rather than being rejected as an unrelated/unknown claim. if (!agentSessionClaimsEqual(live.claim, requestedClaim)) { throw new Error('agent_session_ownership_unknown') } + // Why: worktree scope is checked separately from identity so a same-identity + // claim from a different worktree is reported as a conflict, not "unknown". if (live.claim.worktreeScopeDigest !== requestedClaim.worktreeScopeDigest) { throw new Error('agent_session_conflict') }Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 37e265ee-ed81-4aca-81e6-4f29d4a6f843
📥 Commits
Reviewing files that changed from the base of the PR and between 180d3cf and 60c9881020e39717bc206f9ecbac76217e730b41.
📒 Files selected for processing (155)
config/localization-coverage-allowlist.jsonconfig/reliability-gates.jsoncconfig/scripts/remote-agent-session-authority-repro.mjsconfig/scripts/remote-agent-session-repro-client.mjsconfig/scripts/remote-agent-session-repro-fixture.mjsdocs/reference/remote-agent-session-host-authority.mdpackage.jsonsrc/main/daemon/daemon-create-or-attach-result.tssrc/main/daemon/daemon-foreground-confirmation-protocol.test.tssrc/main/daemon/daemon-protocol-version.test.tssrc/main/daemon/daemon-protocol-version.tssrc/main/daemon/daemon-pty-adapter.test.tssrc/main/daemon/daemon-pty-adapter.tssrc/main/daemon/daemon-pty-provider.test.tssrc/main/daemon/daemon-pty-provider.tssrc/main/daemon/daemon-pty-router.test.tssrc/main/daemon/daemon-pty-router.tssrc/main/daemon/daemon-server.tssrc/main/daemon/daemon-stream-events.tssrc/main/daemon/degraded-daemon-pty-provider.test.tssrc/main/daemon/degraded-daemon-pty-provider.tssrc/main/daemon/pty-session-id.test.tssrc/main/daemon/pty-session-id.tssrc/main/daemon/session.test.tssrc/main/daemon/session.tssrc/main/daemon/terminal-host-agent-session-claim.tssrc/main/daemon/terminal-host-agent-session-generations.tssrc/main/daemon/terminal-host-agent-session.test.tssrc/main/daemon/terminal-host-create-contract.tssrc/main/daemon/terminal-host-options.tssrc/main/daemon/terminal-host-session-create.tssrc/main/daemon/terminal-host-session-cwd.tssrc/main/daemon/terminal-host-session-listing.tssrc/main/daemon/terminal-host-tombstones.tssrc/main/daemon/terminal-host.tssrc/main/daemon/types.tssrc/main/index.tssrc/main/ipc/pty.test.tssrc/main/ipc/pty.tssrc/main/ipc/ssh.test.tssrc/main/ipc/ssh.tssrc/main/orca-profiles/profile-project-session-state.test.tssrc/main/orca-profiles/profile-project-session-state.tssrc/main/orca-profiles/profile-project-session-transfer.tssrc/main/orca-profiles/profile-project-transfer-payload.tssrc/main/persistence.test.tssrc/main/persistence.tssrc/main/providers/local-pty-provider.test.tssrc/main/providers/local-pty-provider.tssrc/main/providers/pty-spawn-result.tssrc/main/providers/ssh-agent-session-capabilities.tssrc/main/providers/ssh-agent-session-claim-validation.tssrc/main/providers/ssh-agent-session-create-operation.tssrc/main/providers/ssh-agent-session-process-list.tssrc/main/providers/ssh-capability-probe-waiter.tssrc/main/providers/ssh-pty-errors.tssrc/main/providers/ssh-pty-provider-agent-session-create-operation.test.tssrc/main/providers/ssh-pty-provider-claim-incarnation.test.tssrc/main/providers/ssh-pty-provider-contract.tssrc/main/providers/ssh-pty-provider-exit-race.test.tssrc/main/providers/ssh-pty-provider-process-events.test.tssrc/main/providers/ssh-pty-provider.test.tssrc/main/providers/ssh-pty-provider.tssrc/main/providers/ssh-pty-session-reattach.tssrc/main/providers/ssh-pty-spawn-env.tssrc/main/providers/ssh-pty-spawn-exit-race.tssrc/main/providers/ssh-pty-spawn-request.tssrc/main/providers/types.tssrc/main/runtime/agent-session-claim-identity.test.tssrc/main/runtime/agent-session-claim-identity.tssrc/main/runtime/mobile-rpc-allowlist.test.tssrc/main/runtime/mobile-session-terminal-persistence-retirement.test.tssrc/main/runtime/mobile-session-terminal-persistence-retirement.tssrc/main/runtime/mobile-session-terminal-retirement.test.tssrc/main/runtime/mobile-session-terminal-retirement.tssrc/main/runtime/orca-runtime-agent-session-operation.test.tssrc/main/runtime/orca-runtime-terminal-retirement.test.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/remote-agent-session-host-authority.integration.test.tssrc/main/runtime/rpc/errors.tssrc/main/runtime/rpc/methods/agent-session.test.tssrc/main/runtime/rpc/methods/agent-session.tssrc/main/runtime/rpc/methods/index.tssrc/main/runtime/rpc/methods/session-tabs.test.tssrc/main/runtime/runtime-rpc.tssrc/main/runtime/workspace-session-terminal-membership-authority.tssrc/main/ssh/ssh-relay-session-incarnation.test.tssrc/main/ssh/ssh-relay-session-reconnect-incarnation.test.tssrc/main/ssh/ssh-relay-session-test-fixtures.tssrc/main/ssh/ssh-relay-session.test.tssrc/main/ssh/ssh-relay-session.tssrc/relay/pty-handler.test.tssrc/relay/pty-handler.tssrc/renderer/src/components/right-sidebar/ai-vault-session-launch-actions.tssrc/renderer/src/components/tab-group/AiVaultSessionDropLayer.tsxsrc/renderer/src/components/tab-group/useTabGroupWorkspaceModel.focus.test.tssrc/renderer/src/components/tab-group/useTabGroupWorkspaceModel.tssrc/renderer/src/components/terminal-pane/pty-connection-types.tssrc/renderer/src/components/terminal-pane/pty-connection.test.tssrc/renderer/src/components/terminal-pane/pty-connection.tssrc/renderer/src/components/terminal-pane/pty-transport-types.tssrc/renderer/src/components/terminal-pane/pty-transport.test.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-transport.test.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-transport.tssrc/renderer/src/hooks/useIpcEvents.test.tssrc/renderer/src/hooks/useIpcEvents.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/renderer/src/lib/agent-background-session-test-state.tssrc/renderer/src/lib/ai-vault-resume-command.test.tssrc/renderer/src/lib/ai-vault-resume-command.tssrc/renderer/src/lib/launch-agent-background-session.test.tssrc/renderer/src/lib/launch-agent-background-session.tssrc/renderer/src/lib/launch-agent-in-new-tab-cwd.test.tssrc/renderer/src/lib/launch-agent-in-new-tab-web-runtime.test.tssrc/renderer/src/lib/launch-agent-in-new-tab.test.tssrc/renderer/src/lib/launch-agent-in-new-tab.tssrc/renderer/src/lib/launch-agent-web-host-tab.tssrc/renderer/src/lib/launch-ai-vault-session.test.tssrc/renderer/src/lib/launch-ai-vault-session.tssrc/renderer/src/lib/resume-sleeping-agent-session-remote-compat.test.tssrc/renderer/src/lib/runtime-agent-background-create.tssrc/renderer/src/lib/sleeping-agent-session-launch.tssrc/renderer/src/lib/workspace-session-host-field-ownership.tssrc/renderer/src/lib/workspace-session-host-records.tssrc/renderer/src/lib/workspace-session-host-split.test.tssrc/renderer/src/lib/workspace-session-host-split.tssrc/renderer/src/runtime/agent-session-create-operation.tssrc/renderer/src/runtime/agent-session-operation-id.test.tssrc/renderer/src/runtime/agent-session-operation-id.tssrc/renderer/src/runtime/remote-agent-session-launch.test.tssrc/renderer/src/runtime/remote-agent-session-launch.tssrc/renderer/src/runtime/runtime-client-target.tssrc/renderer/src/runtime/runtime-rpc-client.test.tssrc/renderer/src/runtime/runtime-rpc-client.tssrc/renderer/src/runtime/web-agent-session-handoff.tssrc/renderer/src/runtime/web-runtime-session.test.tssrc/renderer/src/runtime/web-runtime-session.tssrc/renderer/src/runtime/web-session-tabs-sync.test.tssrc/renderer/src/runtime/web-session-tabs-sync.tssrc/renderer/src/store/slices/runtime-status.tssrc/renderer/src/store/slices/terminals.tssrc/shared/agent-session-host-authority.tssrc/shared/claimed-agent-pty-owner-snapshot.tssrc/shared/claimed-agent-pty-owner.test.tssrc/shared/claimed-agent-pty-owner.tssrc/shared/protocol-version.tssrc/shared/pty-incarnation.tssrc/shared/runtime-types.tssrc/shared/types.tssrc/shared/workspace-session-schema.ts
🚧 Files skipped from review as they are similar to previous changes (138)
- config/localization-coverage-allowlist.json
- src/main/providers/ssh-pty-provider-claim-incarnation.test.ts
- src/main/daemon/terminal-host-session-cwd.ts
- src/renderer/src/runtime/agent-session-operation-id.ts
- config/scripts/remote-agent-session-repro-client.mjs
- src/main/daemon/terminal-host-agent-session-generations.ts
- src/renderer/src/i18n/locales/es.json
- src/main/ssh/ssh-relay-session.test.ts
- src/main/ipc/ssh.ts
- src/main/runtime/rpc/methods/index.ts
- src/main/providers/ssh-pty-provider-contract.ts
- src/renderer/src/hooks/useIpcEvents.test.ts
- src/main/daemon/terminal-host-agent-session.test.ts
- src/main/providers/ssh-pty-errors.ts
- src/main/providers/ssh-agent-session-process-list.ts
- src/main/daemon/daemon-pty-provider.test.ts
- src/main/daemon/terminal-host-session-listing.ts
- src/shared/runtime-types.ts
- src/main/daemon/pty-session-id.test.ts
- src/main/runtime/runtime-rpc.ts
- src/main/ssh/ssh-relay-session-incarnation.test.ts
- src/renderer/src/components/terminal-pane/pty-connection.test.ts
- src/renderer/src/hooks/useIpcEvents.ts
- src/main/daemon/pty-session-id.ts
- src/renderer/src/components/tab-group/useTabGroupWorkspaceModel.ts
- src/renderer/src/lib/resume-sleeping-agent-session-remote-compat.test.ts
- src/shared/pty-incarnation.ts
- src/renderer/src/components/terminal-pane/pty-connection-types.ts
- src/main/providers/ssh-capability-probe-waiter.ts
- src/main/daemon/daemon-protocol-version.test.ts
- src/main/daemon/terminal-host-tombstones.ts
- config/scripts/remote-agent-session-repro-fixture.mjs
- src/main/daemon/daemon-create-or-attach-result.ts
- src/main/runtime/agent-session-claim-identity.test.ts
- src/main/ssh/ssh-relay-session-test-fixtures.ts
- src/shared/protocol-version.ts
- src/renderer/src/components/terminal-pane/pty-connection.ts
- src/main/daemon/daemon-foreground-confirmation-protocol.test.ts
- src/main/providers/pty-spawn-result.ts
- src/main/runtime/rpc/methods/agent-session.test.ts
- src/renderer/src/lib/sleeping-agent-session-launch.ts
- src/renderer/src/runtime/runtime-client-target.ts
- src/main/daemon/terminal-host-agent-session-claim.ts
- src/renderer/src/store/slices/runtime-status.ts
- src/main/daemon/daemon-stream-events.ts
- src/renderer/src/lib/launch-agent-in-new-tab-cwd.test.ts
- src/renderer/src/lib/ai-vault-resume-command.test.ts
- src/shared/types.ts
- src/main/daemon/terminal-host-options.ts
- src/main/runtime/mobile-rpc-allowlist.test.ts
- src/renderer/src/lib/workspace-session-host-field-ownership.ts
- src/renderer/src/components/tab-group/useTabGroupWorkspaceModel.focus.test.ts
- src/main/orca-profiles/profile-project-session-transfer.ts
- src/main/daemon/daemon-protocol-version.ts
- src/main/ssh/ssh-relay-session-reconnect-incarnation.test.ts
- src/main/runtime/rpc/errors.ts
- src/main/runtime/orca-runtime.test.ts
- src/main/runtime/remote-agent-session-host-authority.integration.test.ts
- package.json
- src/main/providers/ssh-pty-spawn-exit-race.ts
- src/main/providers/ssh-pty-provider-exit-race.test.ts
- src/main/orca-profiles/profile-project-transfer-payload.ts
- src/main/providers/ssh-agent-session-create-operation.ts
- src/shared/workspace-session-schema.ts
- src/main/index.ts
- src/renderer/src/components/terminal-pane/pty-transport-types.ts
- src/main/daemon/session.test.ts
- src/main/runtime/mobile-session-terminal-retirement.test.ts
- src/renderer/src/lib/launch-agent-in-new-tab-web-runtime.test.ts
- src/main/orca-profiles/profile-project-session-state.test.ts
- src/main/runtime/mobile-session-terminal-persistence-retirement.test.ts
- src/main/providers/ssh-pty-spawn-env.ts
- src/main/providers/ssh-pty-provider-agent-session-create-operation.test.ts
- src/main/runtime/workspace-session-terminal-membership-authority.ts
- src/renderer/src/lib/workspace-session-host-split.test.ts
- src/renderer/src/lib/launch-ai-vault-session.test.ts
- src/renderer/src/lib/workspace-session-host-records.ts
- src/renderer/src/i18n/locales/en.json
- src/main/daemon/daemon-pty-provider.ts
- src/renderer/src/lib/runtime-agent-background-create.ts
- src/main/providers/local-pty-provider.test.ts
- src/renderer/src/components/tab-group/AiVaultSessionDropLayer.tsx
- config/scripts/remote-agent-session-authority-repro.mjs
- src/main/daemon/session.ts
- src/main/providers/ssh-agent-session-capabilities.ts
- src/renderer/src/runtime/web-session-tabs-sync.test.ts
- src/main/providers/ssh-pty-spawn-request.ts
- src/renderer/src/runtime/agent-session-create-operation.ts
- src/renderer/src/runtime/remote-agent-session-launch.ts
- src/main/runtime/orca-runtime-terminal-retirement.test.ts
- src/main/providers/ssh-agent-session-claim-validation.ts
- src/main/runtime/agent-session-claim-identity.ts
- src/renderer/src/lib/launch-agent-in-new-tab.ts
- src/renderer/src/lib/agent-background-session-test-state.ts
- src/renderer/src/i18n/locales/ko.json
- src/main/daemon/terminal-host-create-contract.ts
- src/main/daemon/daemon-pty-router.ts
- src/main/runtime/rpc/methods/session-tabs.test.ts
- src/renderer/src/i18n/locales/ja.json
- src/main/runtime/mobile-session-terminal-persistence-retirement.ts
- src/renderer/src/lib/launch-ai-vault-session.ts
- src/main/daemon/terminal-host.ts
- src/renderer/src/lib/launch-agent-in-new-tab.test.ts
- src/main/runtime/rpc/methods/agent-session.ts
- src/main/orca-profiles/profile-project-session-state.ts
- src/renderer/src/store/slices/terminals.ts
- src/main/providers/types.ts
- src/renderer/src/runtime/agent-session-operation-id.test.ts
- src/renderer/src/runtime/runtime-rpc-client.ts
- src/main/daemon/daemon-pty-router.test.ts
- src/main/providers/ssh-pty-provider-process-events.test.ts
- src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts
- src/renderer/src/runtime/web-session-tabs-sync.ts
- src/renderer/src/components/terminal-pane/pty-transport.test.ts
- src/main/daemon/terminal-host-session-create.ts
- src/shared/claimed-agent-pty-owner-snapshot.ts
- src/renderer/src/runtime/remote-agent-session-launch.test.ts
- src/renderer/src/runtime/web-runtime-session.ts
- src/main/providers/local-pty-provider.ts
- src/main/providers/ssh-pty-provider.test.ts
- src/renderer/src/lib/ai-vault-resume-command.ts
- src/renderer/src/lib/launch-agent-background-session.test.ts
- src/renderer/src/lib/workspace-session-host-split.ts
- src/main/runtime/mobile-session-terminal-retirement.ts
- src/main/daemon/daemon-pty-adapter.test.ts
- src/main/ssh/ssh-relay-session.ts
- src/main/persistence.ts
- src/main/providers/ssh-pty-provider.ts
- src/renderer/src/lib/launch-agent-web-host-tab.ts
- src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.test.ts
- src/main/ipc/pty.ts
- src/relay/pty-handler.ts
- src/main/runtime/orca-runtime.ts
- src/main/persistence.test.ts
- src/main/ipc/pty.test.ts
- src/main/daemon/daemon-pty-adapter.ts
- src/relay/pty-handler.test.ts
- src/main/daemon/types.ts
| "runtimeBudget": { | ||
| "p95Seconds": 30, | ||
| "scope": "focused ownership, compatibility, lifecycle, and renderer handoff tests; build-backed repro tracked separately" | ||
| }, |
There was a problem hiding this comment.
🚀 Performance & Scalability | 🟡 Minor | ⚡ Quick win
Align the runtime budget with the configured repro command.
The gate runs pnpm test:repro:remote-agent-session, but its recorded duration is 48.47s (Lines 1378-1381), exceeding this 30s budget. Raise the budget or split the repro into a separately budgeted gate.
60c9881 to
66e495a
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (3)
src/main/daemon/daemon-server.ts (1)
718-720: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDocument canonical PTY routing.
Explain why an adopted agent session must reroute all stream lifecycle state from the provisional request ID to the execution owner’s canonical PTY ID.
Suggested clarification
+ // Why: adoption replaces the provisional request ID with the canonical owner PTY; + // stream data and exit cleanup must use that owner to avoid stale lifecycle state. onSessionResolved: (sessionId) => { routedSessionId = sessionId },As per coding guidelines, “For non-obvious TypeScript code, add a concise comment explaining why the constraint exists, not how the code works.”
Also applies to: 762-763
Source: Coding guidelines
src/main/providers/ssh-pty-session-reattach.ts (1)
88-100: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDocument the attach/exit race fence.
Add a why-comment at the operation boundary: an exact exit can arrive while
pty.attachis in flight, and this check prevents reviving a dead or reused relay PTY.As per coding guidelines, “For non-obvious TypeScript code, add a concise comment explaining why the constraint exists, not how the code works.”
Source: Coding guidelines
src/renderer/src/runtime/remote-runtime-session-tabs-inflight.ts (1)
11-13: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueAdd a short "why" comment for the
\u0000key separator.Not obvious why a null byte was chosen over another delimiter; a brief note (e.g., prevents ambiguous key collisions between differing id boundaries) would help future readers.
As per path instructions, "For non-obvious TypeScript code, add a concise comment explaining why the constraint exists, not how the code works."
Source: Path instructions
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 976a208e-5820-4c24-b0fe-b6e6bdb2e67e
📥 Commits
Reviewing files that changed from the base of the PR and between 60c9881020e39717bc206f9ecbac76217e730b41 and 66e495aa777b0737d557e0d514cee17d2a269c8a.
📒 Files selected for processing (163)
config/localization-coverage-allowlist.jsonconfig/reliability-gates.jsoncconfig/scripts/remote-agent-session-authority-repro.mjsconfig/scripts/remote-agent-session-repro-client.mjsconfig/scripts/remote-agent-session-repro-fixture.mjsdocs/reference/plans/2026-07-21-windows-daemon-generation-safety-investigation.mddocs/reference/remote-agent-session-host-authority.mdpackage.jsonsrc/main/daemon/daemon-create-or-attach-result.tssrc/main/daemon/daemon-foreground-confirmation-protocol.test.tssrc/main/daemon/daemon-protocol-version.test.tssrc/main/daemon/daemon-protocol-version.tssrc/main/daemon/daemon-pty-adapter.test.tssrc/main/daemon/daemon-pty-adapter.tssrc/main/daemon/daemon-pty-provider.test.tssrc/main/daemon/daemon-pty-provider.tssrc/main/daemon/daemon-pty-router.test.tssrc/main/daemon/daemon-pty-router.tssrc/main/daemon/daemon-server.tssrc/main/daemon/daemon-stream-events.tssrc/main/daemon/degraded-daemon-pty-provider.test.tssrc/main/daemon/degraded-daemon-pty-provider.tssrc/main/daemon/pty-session-id.test.tssrc/main/daemon/pty-session-id.tssrc/main/daemon/session.test.tssrc/main/daemon/session.tssrc/main/daemon/terminal-host-agent-session-claim.tssrc/main/daemon/terminal-host-agent-session-generations.tssrc/main/daemon/terminal-host-agent-session.test.tssrc/main/daemon/terminal-host-create-contract.tssrc/main/daemon/terminal-host-options.tssrc/main/daemon/terminal-host-session-create.tssrc/main/daemon/terminal-host-session-cwd.tssrc/main/daemon/terminal-host-session-listing.tssrc/main/daemon/terminal-host-tombstones.tssrc/main/daemon/terminal-host.tssrc/main/daemon/types.tssrc/main/index.tssrc/main/ipc/pty.test.tssrc/main/ipc/pty.tssrc/main/ipc/ssh.test.tssrc/main/ipc/ssh.tssrc/main/orca-profiles/profile-project-session-state.test.tssrc/main/orca-profiles/profile-project-session-state.tssrc/main/orca-profiles/profile-project-session-transfer.tssrc/main/orca-profiles/profile-project-transfer-payload.tssrc/main/persistence.test.tssrc/main/persistence.tssrc/main/providers/local-pty-provider.test.tssrc/main/providers/local-pty-provider.tssrc/main/providers/pty-spawn-result.tssrc/main/providers/ssh-agent-session-capabilities.tssrc/main/providers/ssh-agent-session-claim-validation.tssrc/main/providers/ssh-agent-session-create-operation.tssrc/main/providers/ssh-agent-session-process-list.tssrc/main/providers/ssh-capability-probe-waiter.tssrc/main/providers/ssh-pty-errors.tssrc/main/providers/ssh-pty-provider-agent-session-create-operation.test.tssrc/main/providers/ssh-pty-provider-claim-incarnation.test.tssrc/main/providers/ssh-pty-provider-contract.tssrc/main/providers/ssh-pty-provider-exit-race.test.tssrc/main/providers/ssh-pty-provider-process-events.test.tssrc/main/providers/ssh-pty-provider.test.tssrc/main/providers/ssh-pty-provider.tssrc/main/providers/ssh-pty-session-reattach.tssrc/main/providers/ssh-pty-spawn-env.tssrc/main/providers/ssh-pty-spawn-exit-race.tssrc/main/providers/ssh-pty-spawn-request.tssrc/main/providers/types.tssrc/main/runtime/agent-session-claim-identity.test.tssrc/main/runtime/agent-session-claim-identity.tssrc/main/runtime/mobile-rpc-allowlist.test.tssrc/main/runtime/mobile-session-terminal-persistence-retirement.test.tssrc/main/runtime/mobile-session-terminal-persistence-retirement.tssrc/main/runtime/mobile-session-terminal-retirement.test.tssrc/main/runtime/mobile-session-terminal-retirement.tssrc/main/runtime/orca-runtime-agent-session-operation.test.tssrc/main/runtime/orca-runtime-terminal-retirement.test.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/remote-agent-session-host-authority.integration.test.tssrc/main/runtime/rpc/errors.tssrc/main/runtime/rpc/methods/agent-session.test.tssrc/main/runtime/rpc/methods/agent-session.tssrc/main/runtime/rpc/methods/index.tssrc/main/runtime/rpc/methods/session-tab-close-methods.tssrc/main/runtime/rpc/methods/session-tabs-schemas.tssrc/main/runtime/rpc/methods/session-tabs.test.tssrc/main/runtime/runtime-rpc.tssrc/main/runtime/workspace-session-terminal-membership-authority.tssrc/main/ssh/ssh-relay-session-incarnation.test.tssrc/main/ssh/ssh-relay-session-reconnect-incarnation.test.tssrc/main/ssh/ssh-relay-session-test-fixtures.tssrc/main/ssh/ssh-relay-session.test.tssrc/main/ssh/ssh-relay-session.tssrc/relay/pty-handler.test.tssrc/relay/pty-handler.tssrc/renderer/src/components/right-sidebar/ai-vault-session-launch-actions.tssrc/renderer/src/components/tab-group/AiVaultSessionDropLayer.tsxsrc/renderer/src/components/tab-group/useTabGroupWorkspaceModel.focus.test.tssrc/renderer/src/components/tab-group/useTabGroupWorkspaceModel.tssrc/renderer/src/components/terminal-pane/pty-connection-types.tssrc/renderer/src/components/terminal-pane/pty-connection.test.tssrc/renderer/src/components/terminal-pane/pty-connection.tssrc/renderer/src/components/terminal-pane/pty-transport-types.tssrc/renderer/src/components/terminal-pane/pty-transport.test.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-transport.test.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-transport.tssrc/renderer/src/hooks/useIpcEvents.test.tssrc/renderer/src/hooks/useIpcEvents.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/renderer/src/lib/agent-background-session-test-state.tssrc/renderer/src/lib/ai-vault-resume-command.test.tssrc/renderer/src/lib/ai-vault-resume-command.tssrc/renderer/src/lib/launch-agent-background-session.test.tssrc/renderer/src/lib/launch-agent-background-session.tssrc/renderer/src/lib/launch-agent-in-new-tab-cwd.test.tssrc/renderer/src/lib/launch-agent-in-new-tab-web-runtime.test.tssrc/renderer/src/lib/launch-agent-in-new-tab.test.tssrc/renderer/src/lib/launch-agent-in-new-tab.tssrc/renderer/src/lib/launch-agent-web-host-tab.tssrc/renderer/src/lib/launch-ai-vault-session.test.tssrc/renderer/src/lib/launch-ai-vault-session.tssrc/renderer/src/lib/resume-sleeping-agent-session-remote-compat.test.tssrc/renderer/src/lib/runtime-agent-background-create.tssrc/renderer/src/lib/sleeping-agent-session-launch.tssrc/renderer/src/lib/workspace-session-host-field-ownership.tssrc/renderer/src/lib/workspace-session-host-records.tssrc/renderer/src/lib/workspace-session-host-split.test.tssrc/renderer/src/lib/workspace-session-host-split.tssrc/renderer/src/runtime/agent-session-create-operation.tssrc/renderer/src/runtime/agent-session-operation-id.test.tssrc/renderer/src/runtime/agent-session-operation-id.tssrc/renderer/src/runtime/close-mirrored-editor-tab.test.tssrc/renderer/src/runtime/close-mirrored-editor-tab.tssrc/renderer/src/runtime/remote-agent-session-launch.test.tssrc/renderer/src/runtime/remote-agent-session-launch.tssrc/renderer/src/runtime/remote-runtime-session-tabs-inflight.test.tssrc/renderer/src/runtime/remote-runtime-session-tabs-inflight.tssrc/renderer/src/runtime/runtime-client-target.tssrc/renderer/src/runtime/runtime-rpc-client.test.tssrc/renderer/src/runtime/runtime-rpc-client.tssrc/renderer/src/runtime/web-agent-session-handoff.tssrc/renderer/src/runtime/web-runtime-session.test.tssrc/renderer/src/runtime/web-runtime-session.tssrc/renderer/src/runtime/web-session-tabs-sync.test.tssrc/renderer/src/runtime/web-session-tabs-sync.tssrc/renderer/src/store/slices/runtime-status.tssrc/renderer/src/store/slices/terminals.tssrc/shared/agent-session-host-authority.tssrc/shared/claimed-agent-pty-owner-snapshot.tssrc/shared/claimed-agent-pty-owner.test.tssrc/shared/claimed-agent-pty-owner.tssrc/shared/protocol-version.tssrc/shared/pty-incarnation.tssrc/shared/runtime-types.tssrc/shared/types.tssrc/shared/workspace-session-schema.tstests/e2e/daemon-generation-reconnect-safety.spec.ts
🚧 Files skipped from review as they are similar to previous changes (142)
- src/main/daemon/daemon-protocol-version.test.ts
- src/main/daemon/daemon-foreground-confirmation-protocol.test.ts
- src/main/daemon/terminal-host-session-cwd.ts
- src/renderer/src/store/slices/runtime-status.ts
- src/main/providers/ssh-capability-probe-waiter.ts
- src/main/ipc/ssh.ts
- config/localization-coverage-allowlist.json
- config/scripts/remote-agent-session-repro-fixture.mjs
- src/shared/pty-incarnation.ts
- src/main/daemon/daemon-stream-events.ts
- src/main/daemon/terminal-host-agent-session-generations.ts
- src/main/daemon/terminal-host-session-listing.ts
- src/main/daemon/terminal-host-options.ts
- src/main/daemon/daemon-pty-provider.test.ts
- src/main/daemon/terminal-host-tombstones.ts
- src/main/daemon/daemon-create-or-attach-result.ts
- src/shared/runtime-types.ts
- src/main/providers/ssh-pty-provider-claim-incarnation.test.ts
- config/scripts/remote-agent-session-repro-client.mjs
- src/main/providers/ssh-pty-provider-contract.ts
- src/renderer/src/runtime/agent-session-operation-id.test.ts
- src/renderer/src/hooks/useIpcEvents.test.ts
- src/main/providers/ssh-agent-session-process-list.ts
- src/shared/types.ts
- src/renderer/src/lib/sleeping-agent-session-launch.ts
- src/renderer/src/runtime/agent-session-operation-id.ts
- src/main/providers/ssh-pty-spawn-env.ts
- src/renderer/src/lib/resume-sleeping-agent-session-remote-compat.test.ts
- src/main/providers/ssh-pty-errors.ts
- src/renderer/src/components/terminal-pane/pty-connection.test.ts
- src/main/daemon/terminal-host-agent-session.test.ts
- src/main/runtime/runtime-rpc.ts
- src/main/daemon/terminal-host-create-contract.ts
- src/main/providers/ssh-pty-provider-exit-race.test.ts
- src/main/ssh/ssh-relay-session-incarnation.test.ts
- src/main/index.ts
- src/main/runtime/remote-agent-session-host-authority.integration.test.ts
- src/main/runtime/mobile-rpc-allowlist.test.ts
- src/renderer/src/hooks/useIpcEvents.ts
- src/main/runtime/rpc/methods/index.ts
- src/renderer/src/components/terminal-pane/pty-transport-types.ts
- src/main/ssh/ssh-relay-session.test.ts
- src/main/providers/ssh-pty-spawn-request.ts
- src/renderer/src/lib/launch-ai-vault-session.test.ts
- src/renderer/src/components/tab-group/useTabGroupWorkspaceModel.ts
- src/main/runtime/rpc/errors.ts
- package.json
- src/renderer/src/components/tab-group/AiVaultSessionDropLayer.tsx
- src/main/runtime/orca-runtime.test.ts
- src/renderer/src/components/right-sidebar/ai-vault-session-launch-actions.ts
- src/renderer/src/i18n/locales/es.json
- src/main/orca-profiles/profile-project-session-state.test.ts
- src/main/daemon/types.ts
- src/renderer/src/components/terminal-pane/pty-connection-types.ts
- src/main/providers/ssh-pty-spawn-exit-race.ts
- src/renderer/src/runtime/runtime-client-target.ts
- src/renderer/src/i18n/locales/en.json
- src/main/ssh/ssh-relay-session-test-fixtures.ts
- src/main/providers/ssh-agent-session-capabilities.ts
- src/main/daemon/terminal-host-agent-session-claim.ts
- src/renderer/src/lib/launch-agent-background-session.ts
- src/renderer/src/runtime/remote-agent-session-launch.ts
- src/renderer/src/lib/runtime-agent-background-create.ts
- src/renderer/src/lib/launch-agent-in-new-tab.ts
- src/shared/protocol-version.ts
- src/renderer/src/lib/workspace-session-host-records.ts
- src/shared/workspace-session-schema.ts
- src/renderer/src/lib/launch-agent-in-new-tab-cwd.test.ts
- src/main/daemon/pty-session-id.ts
- src/main/daemon/daemon-protocol-version.ts
- src/main/providers/ssh-pty-provider-process-events.test.ts
- src/renderer/src/runtime/agent-session-create-operation.ts
- src/renderer/src/store/slices/terminals.ts
- src/main/orca-profiles/profile-project-transfer-payload.ts
- src/main/runtime/agent-session-claim-identity.test.ts
- src/main/orca-profiles/profile-project-session-transfer.ts
- src/main/ipc/ssh.test.ts
- src/renderer/src/lib/workspace-session-host-field-ownership.ts
- src/main/daemon/daemon-pty-router.ts
- src/renderer/src/runtime/remote-agent-session-launch.test.ts
- src/main/providers/pty-spawn-result.ts
- src/main/providers/ssh-agent-session-create-operation.ts
- src/main/providers/ssh-agent-session-claim-validation.ts
- src/main/daemon/session.test.ts
- src/renderer/src/i18n/locales/ja.json
- src/renderer/src/components/tab-group/useTabGroupWorkspaceModel.focus.test.ts
- src/renderer/src/runtime/web-session-tabs-sync.test.ts
- src/main/runtime/orca-runtime-agent-session-operation.test.ts
- src/main/daemon/terminal-host-session-create.ts
- src/renderer/src/components/terminal-pane/pty-connection.ts
- src/main/runtime/agent-session-claim-identity.ts
- src/renderer/src/lib/workspace-session-host-split.test.ts
- src/renderer/src/lib/launch-ai-vault-session.ts
- src/main/daemon/pty-session-id.test.ts
- src/renderer/src/lib/ai-vault-resume-command.ts
- src/main/daemon/daemon-pty-adapter.test.ts
- src/main/runtime/mobile-session-terminal-persistence-retirement.test.ts
- src/main/orca-profiles/profile-project-session-state.ts
- src/main/runtime/rpc/methods/agent-session.ts
- src/main/daemon/degraded-daemon-pty-provider.test.ts
- src/main/daemon/terminal-host.ts
- src/main/providers/types.ts
- src/main/daemon/session.ts
- src/renderer/src/i18n/locales/zh.json
- src/renderer/src/i18n/locales/ko.json
- src/main/runtime/workspace-session-terminal-membership-authority.ts
- config/scripts/remote-agent-session-authority-repro.mjs
- src/main/runtime/mobile-session-terminal-persistence-retirement.ts
- src/main/runtime/mobile-session-terminal-retirement.test.ts
- src/main/runtime/rpc/methods/agent-session.test.ts
- src/renderer/src/lib/agent-background-session-test-state.ts
- src/main/providers/local-pty-provider.ts
- src/main/providers/ssh-pty-provider.ts
- src/renderer/src/lib/launch-agent-web-host-tab.ts
- src/renderer/src/runtime/web-session-tabs-sync.ts
- src/main/daemon/daemon-pty-router.test.ts
- src/renderer/src/lib/workspace-session-host-split.ts
- src/main/runtime/orca-runtime-terminal-retirement.test.ts
- src/main/daemon/degraded-daemon-pty-provider.ts
- src/renderer/src/runtime/runtime-rpc-client.ts
- src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts
- src/renderer/src/runtime/web-runtime-session.ts
- src/shared/claimed-agent-pty-owner.test.ts
- src/relay/pty-handler.test.ts
- src/shared/claimed-agent-pty-owner-snapshot.ts
- src/main/providers/ssh-pty-provider.test.ts
- src/renderer/src/runtime/web-runtime-session.test.ts
- src/renderer/src/runtime/web-agent-session-handoff.ts
- src/main/persistence.ts
- src/main/runtime/mobile-session-terminal-retirement.ts
- src/renderer/src/lib/launch-agent-background-session.test.ts
- src/main/ssh/ssh-relay-session.ts
- src/shared/claimed-agent-pty-owner.ts
- src/relay/pty-handler.ts
- src/main/daemon/daemon-pty-adapter.ts
- src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.test.ts
- src/main/ipc/pty.test.ts
- src/main/persistence.test.ts
- src/main/runtime/orca-runtime.ts
- src/renderer/src/lib/launch-agent-in-new-tab-web-runtime.test.ts
- src/main/ipc/pty.ts
- src/renderer/src/components/terminal-pane/pty-transport.test.ts
66e495a to
25c017a
Compare
|
Rebased onto current Upstream integration audit:
Post-rebase validation:
The branch remains one squashed commit authored and committed by OrcaWin. |
|
Related to #8871. |
Summary
Make the remote Orca host authoritative for agent-session ownership and terminal membership.
agent-session.remote-host-authorityFixes #8878.
Related to #9352 and #9804.
Screenshots
No visual change.
Testing
pnpm lint— repository-wide baseline failures remain in untouched skill-freshness and generated skill-manifest files; task-owned oxlint, reliability, and max-lines checks passpnpm typecheckpnpm test— 3,213 files passed; 33,949 tests passed in the pre-review full-root validationpnpm test:repro:remote-agent-sessionFinal post-rebase validation:
orca serveharness over encrypted WebSocket pairing: one physical spawn across two racing clients, canonical retry adoption, durable exit retirement, stale-publication rejection, and no resurrection after server restartgit diff --checkThe Windows daemon harness now derives explicit v24 clean-disconnect, v25 startup-ingress, and v26 agent-authority boundaries and covers v21–v26. Recorded native Windows evidence remains v21–v25; the six-generation v26 native rerun has not been collected locally.
AI Review Report
The final combined diff was independently re-reviewed for lifecycle, protocol compatibility, and topology after rebasing onto #9804. All three specialist reviews returned clean.
The review/fix rounds covered multi-client races, old/new client-runtime-daemon-relay combinations, SSH reconnect identity, daemon and relay exit-before-reply ordering, PTY ID reuse, stale renderer writes, provisional-tab retirement, deletion boundaries, bounded operation state, and reconnect lifecycle safety.
The final #9804 integration review found and fixed:
Cross-platform review considered macOS, Linux, Windows, native, WSL, SSH, daemon, relay, and remote-runtime execution. This PR adds no keyboard shortcut or UI-label behavior, uses platform path APIs in the harness, and does not add production shell assumptions or Git-version-dependent commands.
Security Audit
method_not_foundproves an old host did not recognize the requestNo follow-up security action is required for the v1 scope.
Compatibility
Mixed-version combinations preserve workflows that existed before upgrading. New hosts continue accepting old clients. Authenticated old runtime and mobile clients that omit a close reason retain the historical explicit-user close behavior. New clients use the evidence-bearing lifecycle method and never fall back from an unsupported lifecycle call to a destructive legacy close.
New clients use structured agent-session authority only when every authority layer for that route advertises support; otherwise they select the unchanged legacy request before trust, claim, spawn, replay fencing, or execution-owner-local filesystem access. Partially upgraded routes may retain the original duplicate-resume/ghost-tab behavior until the route is fully capable, but upgrading any subset does not remove previously working launch, resume, or explicit-close behavior.
Reliability Contract
Experimental gate:
agent-session.remote-host-authorityThe invariant requires one live PTY owner and one canonical host surface per provider-session identity on every claim-capable route. Exact physical exit retires that incarnation durably, while mixed-version routes choose legacy behavior before authority side effects. Causally fresh inventory fencing prevents a pre-operation snapshot from confirming a post-operation handoff.
Documented future extensions remain intentionally outside this PR: