Repository navigation
Conversation
ad733ee to
03a93d7
Compare
|
Rebased onto current |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📥 CommitsReviewing files that changed from the base of the PR and between 5464525 and a5052d8588f1492156bf063464163d09b616c316. 📒 Files selected for processing (52)
🚧 Files skipped from review as they are similar to previous changes (52)
📝 WalkthroughWalkthroughThe change adds validated Codex provider-account references to local, WSL, runtime, web, and remote session launches. Codex home preparation and PTY model discovery now resolve account-specific routes without changing global selection. Commit-message model discovery carries PTY identifiers through local and remote paths. Native-chat enrichment is scoped by PTY and account. Codex model probing now parses bounded model-list output and creates dynamic reasoning-level options. Remote account-aware launches require negotiated host-authority capability. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 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 |
03a93d7 to
4ceb692
Compare
There was a problem hiding this comment.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
src/renderer/src/runtime/runtime-git-client.ts (1)
698-713: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winKeep a remote PTY bound to its owning runtime.
When
ptyIdencodesenv-1but the selected target isenv-2, this code sends the PTY handle toenv-2. The receiving runtime can resolve a colliding handle or fall back to its default account home. CompareremotePty.environmentIdwith the selected target before addingptyId. Omit the field when the environments differ. Add a mismatch test.Proposed fix
if (target.kind === 'local' || !context.worktreeId) { return window.api.git.discoverCommitMessageModels({ agentId, worktreePath: resolveLocalWorktreePath(context), connectionId: context.connectionId, ...(!remotePty && ptyId ? { ptyId } : {}) }) as Promise<RuntimeDiscoverCommitMessageModelsResult> } + const runtimePtyId = + remotePty?.environmentId && remotePty.environmentId !== target.environmentId + ? undefined + : (remotePty?.handle ?? ptyId) return callRuntimeRpc<RuntimeDiscoverCommitMessageModelsResult>( target, 'git.discoverCommitMessageModels', { worktree: toRuntimeWorktreeSelector(context.worktreeId), agentId, - ...(ptyId ? { ptyId: remotePty?.handle ?? ptyId } : {}), + ...(runtimePtyId ? { ptyId: runtimePtyId } : {}),src/renderer/src/components/native-chat/native-chat-session-option-enrichment.ts (1)
63-71: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy liftValidate authoritative models in the active discovery scope.
Line 63 checks every host and PTY scope. If account A does not expose a persisted Codex model but account B does, this function keeps the model and the launch can send an unavailable
--modelvalue for account A.Pass the active host and PTY scope into this function. Check only that scope before retaining a persisted model selection.
src/main/runtime/orca-runtime.ts (1)
26214-26232: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy liftThread
providerAccountRefthrough renderer-backed agent creation.For a focused
createAgentSessionrequest with an attached renderer,terminal:requestTabCreateomitsproviderAccountRef. The renderer then queues startup data without it, so the PTY transport cannot apply the validated managed Codex account. Add the field to the shared IPC payload and queue it through topty.spawn.
🧹 Nitpick comments (1)
src/main/runtime/orca-runtime.ts (1)
25462-25481: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExtract the duplicated provider-account validation into a shared helper.
ensureAgentSession(lines 25462-25481) andcreateAgentSession(lines 25641-25662) run the exact same four checks againstrequest.providerAccountRef: agent/provider must becodex, the workspace must not be SSH, thewsl/host runtime must matchparseWslUncPath(workspace.path), and anywslDistromust match case-insensitively. The error codes and check order are identical.Duplicated security-relevant validation risks silent divergence if one call site is updated later and the other is missed. Extract this into one private method, for example
assertProviderAccountRefCompatibleWithWorkspace(providerAccountRef, agent, workspace), and call it from both places.♻️ Proposed refactor
+ private assertProviderAccountRefCompatibleWithWorkspace( + providerAccountRef: ProviderAccountRef | undefined, + agent: TuiAgent, + workspace: TerminalWorkspaceLaunchScope + ): void { + if (!providerAccountRef) { + return + } + if (agent !== 'codex' || providerAccountRef.provider !== 'codex') { + throw new Error('agent_session_account_agent_mismatch') + } + if (workspace.connectionId) { + // Why: an account ref belongs to this Orca runtime, not an SSH + // downstream whose credential registry this process cannot attest. + throw new Error('agent_session_account_runtime_mismatch') + } + const wsl = parseWslUncPath(workspace.path) + if ((providerAccountRef.runtime === 'wsl') !== Boolean(wsl)) { + throw new Error('agent_session_account_runtime_mismatch') + } + if ( + wsl && + providerAccountRef.wslDistro?.trim() && + providerAccountRef.wslDistro.trim().toLocaleLowerCase('en-US') !== + wsl.distro.toLocaleLowerCase('en-US') + ) { + throw new Error('agent_session_account_runtime_mismatch') + } + }Then call
this.assertProviderAccountRefCompatibleWithWorkspace(request.providerAccountRef, request.agent, workspace)at both sites.Also applies to: 25641-25662
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 6eac47db-8f8c-4de5-9079-ddd19a46659e
📥 Commits
Reviewing files that changed from the base of the PR and between 400321e and 4ceb692438a6599dad6490b3634cc8aacca75e69.
📒 Files selected for processing (51)
src/main/codex-accounts/runtime-home-service.test.tssrc/main/codex-accounts/runtime-home-service.tssrc/main/index.tssrc/main/ipc/filesystem.test.tssrc/main/ipc/filesystem.tssrc/main/ipc/pty.test.tssrc/main/ipc/pty.tssrc/main/runtime/orca-runtime-agent-session-operation.test.tssrc/main/runtime/orca-runtime-git.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/rpc/methods/agent-session.test.tssrc/main/runtime/rpc/methods/agent-session.tssrc/main/runtime/rpc/methods/git-params.tssrc/main/runtime/rpc/methods/git.test.tssrc/main/runtime/rpc/methods/git.tssrc/main/text-generation/commit-message-agent-environment.test.tssrc/main/text-generation/commit-message-agent-environment.tssrc/preload/api-types.tssrc/preload/index.tssrc/renderer/src/components/native-chat/native-chat-session-option-discovery.tssrc/renderer/src/components/native-chat/native-chat-session-option-enrichment.test.tssrc/renderer/src/components/native-chat/native-chat-session-option-enrichment.tssrc/renderer/src/components/native-chat/use-native-chat-session-options.tssrc/renderer/src/components/terminal-pane/pty-connection-types.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/pty-transport.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-transport.test.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-transport.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/runtime-agent-background-create.tssrc/renderer/src/runtime/remote-agent-session-launch.test.tssrc/renderer/src/runtime/remote-agent-session-launch.tssrc/renderer/src/runtime/runtime-git-client.test.tssrc/renderer/src/runtime/runtime-git-client.tssrc/renderer/src/runtime/web-runtime-session.tssrc/renderer/src/store/slices/terminals.tssrc/shared/agent-session-host-authority.tssrc/shared/agent-session-option-catalog-claude-codex.tssrc/shared/agent-session-option-catalog.test.tssrc/shared/agent-session-option-catalog.tssrc/shared/codex-model-list-probe.test.tssrc/shared/codex-model-list-probe.tssrc/shared/commit-message-agent-spec.tssrc/shared/protocol-version.tssrc/shared/provider-account-ref.test.tssrc/shared/provider-account-ref.tssrc/shared/types.ts
f2e69cf to
1ad69c4
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
There was a problem hiding this comment.
♻️ Duplicate comments (1)
src/main/index.ts (1)
1067-1077:⚠️ Potential issue | 🟠 MajorRestore best-effort hook preparation.
installForRuntimeHomeandrefreshRuntimeUserHooksForRuntimeHomecan throw. This path has notry/catch, so a hook error blocks an explicit account launch. Match the error handling at Lines 1126-1151.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 98b05384-c15d-4178-af91-8322f7538b48
📥 Commits
Reviewing files that changed from the base of the PR and between cb42b60 and 1ad69c4248bbb52c6eea55026d99fcf948aad913.
📒 Files selected for processing (52)
src/main/codex-accounts/runtime-home-service.test.tssrc/main/codex-accounts/runtime-home-service.tssrc/main/index.tssrc/main/ipc/filesystem.test.tssrc/main/ipc/filesystem.tssrc/main/ipc/pty.test.tssrc/main/ipc/pty.tssrc/main/runtime/orca-runtime-agent-session-operation.test.tssrc/main/runtime/orca-runtime-git.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/rpc/methods/agent-session.test.tssrc/main/runtime/rpc/methods/agent-session.tssrc/main/runtime/rpc/methods/git-params.tssrc/main/runtime/rpc/methods/git.test.tssrc/main/runtime/rpc/methods/git.tssrc/main/text-generation/commit-message-agent-environment.test.tssrc/main/text-generation/commit-message-agent-environment.tssrc/preload/api/git-inspection-api.tssrc/preload/api/pty-api.tssrc/preload/index.tssrc/renderer/src/components/native-chat/native-chat-session-option-discovery.tssrc/renderer/src/components/native-chat/native-chat-session-option-enrichment.test.tssrc/renderer/src/components/native-chat/native-chat-session-option-enrichment.tssrc/renderer/src/components/native-chat/use-native-chat-session-options.tssrc/renderer/src/components/terminal-pane/pty-connection-types.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/pty-transport.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-transport.test.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-transport.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/runtime-agent-background-create.tssrc/renderer/src/runtime/remote-agent-session-launch.test.tssrc/renderer/src/runtime/remote-agent-session-launch.tssrc/renderer/src/runtime/runtime-git-client.test.tssrc/renderer/src/runtime/runtime-git-client.tssrc/renderer/src/runtime/web-runtime-session.tssrc/renderer/src/store/slices/terminals.tssrc/shared/agent-session-host-authority.tssrc/shared/agent-session-option-catalog-claude-codex.tssrc/shared/agent-session-option-catalog.test.tssrc/shared/agent-session-option-catalog.tssrc/shared/codex-model-list-probe.test.tssrc/shared/codex-model-list-probe.tssrc/shared/commit-message-agent-spec.tssrc/shared/protocol-version.tssrc/shared/provider-account-ref.test.tssrc/shared/provider-account-ref.tssrc/shared/worktree/launch-types.ts
🚧 Files skipped from review as they are similar to previous changes (48)
- src/renderer/src/components/terminal-pane/pty-transport.test.ts
- src/main/runtime/orca-runtime-git.ts
- src/main/runtime/rpc/methods/agent-session.test.ts
- src/main/ipc/filesystem.test.ts
- src/shared/codex-model-list-probe.test.ts
- src/shared/provider-account-ref.test.ts
- src/renderer/src/components/terminal-pane/pty-transport.ts
- src/main/runtime/rpc/methods/git.test.ts
- src/renderer/src/components/terminal-pane/pty-connection-types.ts
- src/renderer/src/lib/launch-agent-in-new-tab.test.ts
- src/renderer/src/runtime/runtime-git-client.test.ts
- src/shared/codex-model-list-probe.ts
- src/main/text-generation/commit-message-agent-environment.ts
- src/shared/agent-session-option-catalog.test.ts
- src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts
- src/renderer/src/components/native-chat/use-native-chat-session-options.ts
- src/main/text-generation/commit-message-agent-environment.test.ts
- src/preload/index.ts
- src/shared/provider-account-ref.ts
- src/main/runtime/orca-runtime-agent-session-operation.test.ts
- src/renderer/src/components/terminal-pane/pty-connection.ts
- src/main/ipc/filesystem.ts
- src/renderer/src/runtime/web-runtime-session.ts
- src/renderer/src/store/slices/terminals.ts
- src/main/ipc/pty.test.ts
- src/main/runtime/rpc/methods/git.ts
- src/renderer/src/components/terminal-pane/pty-transport-types.ts
- src/shared/protocol-version.ts
- src/main/codex-accounts/runtime-home-service.test.ts
- src/renderer/src/runtime/runtime-git-client.ts
- src/renderer/src/components/native-chat/native-chat-session-option-discovery.ts
- src/renderer/src/runtime/remote-agent-session-launch.ts
- src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.test.ts
- src/shared/commit-message-agent-spec.ts
- src/main/runtime/rpc/methods/git-params.ts
- src/main/runtime/rpc/methods/agent-session.ts
- src/renderer/src/lib/launch-agent-web-host-tab.ts
- src/renderer/src/components/native-chat/native-chat-session-option-enrichment.test.ts
- src/shared/agent-session-option-catalog-claude-codex.ts
- src/shared/agent-session-option-catalog.ts
- src/main/ipc/pty.ts
- src/main/runtime/orca-runtime.ts
- src/renderer/src/components/native-chat/native-chat-session-option-enrichment.ts
- src/shared/agent-session-host-authority.ts
- src/renderer/src/lib/launch-agent-in-new-tab.ts
- src/renderer/src/runtime/remote-agent-session-launch.test.ts
- src/main/codex-accounts/runtime-home-service.ts
- src/renderer/src/lib/runtime-agent-background-create.ts
2731a17 to
a5052d8
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
3aa6d4f to
8142afc
Compare
|
Restacked onto current The stack was also restructured so each PR is green on its own head — previously every follow-up fix landed on the tip (#13276), which meant ancestor heads failed This head was verified standalone: Added here: |
launch-agent-in-new-tab.test.ts grew past the 800-line budget once the account-scoped cases landed; move those cases to their own file. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01KvdKNvkWoiVSxqbw7DKmgm
8142afc to
d4d3e6e
Compare
Summary
Agent launches can now carry an optional
ProviderAccountRefthat identifies the selected provider account without exposing its credential home. Codex launches resolve and validate that reference in the owning main/runtime process before applying the managed account environment.The reference is forwarded through local PTY, background-session, web-host, and remote-runtime launch paths. Remote clients send it only when the runtime advertises the new capability; older runtimes keep the existing launch contract.
This PR is stacked on #13270 and #13183. Please review it after those PRs land; their changes will disappear from this diff as the stack advances.
Screenshots
No visual layout change. This PR adds the launch contract used by the account selector in the next PR.
Testing
pnpm lintpnpm typecheckpnpm testpnpm buildFocused validation:
pnpm run build:desktop— passed.git diff --check— passed.git merge-tree --write-tree origin/main HEAD— passed with a clean merge result.Local environment note: the repository requests Node 24, while this workstation currently exposes Node 25.8.1. The desktop build completed; its development CLI install step reported the expected permission warning for
/usr/local/bin/orca-devwithout failing the build.AI Review Report
The review traced
ProviderAccountReffrom renderer launch helpers through preload/IPC and runtime RPC to the main-process authority boundary. It checked capability-gated remote forwarding, launch-token fingerprinting, provider/agent matching, local-versus-WSL ownership, and fallback behavior when no account is selected.Regression tests cover local and remote launch transport, unsupported remote runtimes, account/agent mismatch, runtime mismatch, WSL distro mismatch, and unchanged launches without an account reference.
Cross-platform review:
Security Audit
ProviderAccountRefcontains provider, opaque local account ID, runtime kind, and optional WSL distro only; it contains no token, auth file, or credential path.Notes
@rp0927