Repository navigation
fix(terminal): avoid retained PowerShell for stock Codex on Windows - #9052
slashdevcorpse wants to merge 4 commits into
Conversation
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai full review |
✅ Action performedFull review finished. |
|
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 Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds Windows Codex shell handoff support across launch configuration, RPC validation, renderer state, daemon IPC, PTY fallback chains, and Windows process execution. The change introduces canonical Codex command and package resolution, compressed handoff configuration, a Node.js host process, logical shell-path tracking, protocol version 23, and extensive unit and Windows ConPTY integration coverage. It also adjusts PowerShell startup-command size handling and preserves the handoff marker through session persistence and resume flows. 🚥 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 |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/renderer/src/components/terminal-pane/pty-connection.ts (1)
1-1: 📐 Maintainability & Code Quality | 🔴 Critical | ⚡ Quick winDo not disable
max-lines.As per coding guidelines, never disable
max-linesvia ESLint or oxlint, including line-specific variants.♻️ Proposed fix
-/* oxlint-disable max-lines */Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: ddf50aee-749a-4e97-8684-4155a3acbfb6
📥 Commits
Reviewing files that changed from the base of the PR and between 92fc79e and 53c871925306973af5abda11bcbbfe8eb77a059a.
📒 Files selected for processing (46)
src/main/daemon/daemon-create-or-attach-protocol.tssrc/main/daemon/daemon-pty-adapter.test.tssrc/main/daemon/daemon-pty-adapter.tssrc/main/daemon/daemon-server.test.tssrc/main/daemon/daemon-server.tssrc/main/daemon/pty-subprocess.test.tssrc/main/daemon/pty-subprocess.tssrc/main/daemon/terminal-host-create-contract.tssrc/main/daemon/terminal-host.tssrc/main/daemon/types.tssrc/main/ipc/pty.test.tssrc/main/ipc/pty.tssrc/main/providers/__fixtures__/codex-cli-entrypoint-0.144.5.txtsrc/main/providers/local-pty-provider.test.tssrc/main/providers/local-pty-provider.tssrc/main/providers/local-pty-utils.tssrc/main/providers/types.tssrc/main/providers/windows-codex-generated-command.tssrc/main/providers/windows-codex-package-resolution.tssrc/main/providers/windows-codex-shell-handoff-host.tssrc/main/providers/windows-codex-shell-handoff.conpty.test.tssrc/main/providers/windows-codex-shell-handoff.test.tssrc/main/providers/windows-codex-shell-handoff.tssrc/main/providers/windows-powershell-command-resolution.tssrc/main/providers/windows-shell-args.test.tssrc/main/providers/windows-shell-args.tssrc/main/providers/windows-shell-fallback-chain.test.tssrc/main/providers/windows-shell-fallback-chain.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/rpc/methods/terminal.tssrc/main/runtime/rpc/terminal-create.test.tssrc/renderer/src/components/terminal-pane/pty-connection.tssrc/renderer/src/lib/ai-vault-session-drag.test.tssrc/renderer/src/lib/ai-vault-session-drag.tssrc/renderer/src/lib/sleeping-agent-session-launch.tssrc/renderer/src/store/slices/agent-status-quit-capture.test.tssrc/renderer/src/store/slices/agent-status.tssrc/shared/agent-session-resume.tssrc/shared/sleeping-agent-launch-config.tssrc/shared/tui-agent-base-command.tssrc/shared/tui-agent-launch-provenance.tssrc/shared/tui-agent-startup.test.tssrc/shared/tui-agent-startup.tssrc/shared/workspace-session-schema.sleeping-agent.test.tssrc/shared/workspace-session-sleeping-agents.ts
|
@coderabbitai The outside-diff |
|
@coderabbitai Please list the exact TypeScript functions counted as documented and undocumented for the 17.46% docstring coverage result, excluding test callbacks if the metric already does so. I will add concise contract-focused documentation to the appropriate production APIs. |
|
Tip For best results, initiate chat on the files or code changes.
✏️ Learnings added
|
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '== References to docstring coverage / percentage =='
rg -n -i -C 3 'docstring|documentation coverage|17\.46|max-lines-ratchet' \
-g '!*node_modules*' -g '!*.lock' . || true
printf '%s\n' '== Candidate config and script filenames =='
fd -HI -t f -i '(doc|string|coverage|lint|ratchet)' . \
-E node_modules -E .git -E dist -E build | sed -n '1,240p'
printf '%s\n' '== package scripts mentioning documentation or coverage =='
if [ -f package.json ]; then
jq -r '.scripts // {} | to_entries[] | select((.key + " " + .value | test("doc|string|coverage"; "i"))) | "\(.key): \(.value)"' package.json
fiLength of output: 23937 🏁 Script executed: #!/bin/bash
set -euo pipefail
repo="stablyai/orca"
pr="9052"
printf '%s\n' '== PR reviews =='
gh api "repos/$repo/pulls/$pr/reviews?per_page=100" --paginate \
--jq '.[] | {id, user: .user.login, state, body, submitted_at}' || true
printf '%s\n' '== PR issue comments matching coverage/docstrings =='
gh api "repos/$repo/issues/$pr/comments?per_page=100" --paginate \
--jq '.[] | select((.body | test("17\\.46|docstring|documentation coverage"; "i"))) | {id, user: .user.login, body, created_at, html_url}' || true
printf '%s\n' '== PR review comments matching coverage/docstrings =='
gh api "repos/$repo/pulls/$pr/comments?per_page=100" --paginate \
--jq '.[] | select((.body | test("17\\.46|docstring|documentation coverage"; "i"))) | {id, user: .user.login, path, line, body, created_at, html_url}' || trueLength of output: 11263
I also verified that this repository has no docstring-coverage script, configuration, or generated report from which the inventory could be reproduced. Producing a manual AST-derived list would therefore not be the exact set used by the reported metric. Accordingly, this warning is not actionable in its current form: it needs an itemized report (at minimum |
|
@coderabbitai Since you confirmed the 17.46% docstring warning has no itemized functions, denominator, recognition rule, or test exclusion rule—and therefore is not actionable—please withdraw that pre-merge warning for this PR. Adding speculative filler across production and test callbacks would conflict with the repository's concise, non-obvious-why comment policy. The new public contracts and safety constraints are already documented where they are non-obvious. |
|
Tip For best results, initiate chat on the files or code changes.
I also recognize the repository preference for concise documentation focused on non-obvious contracts and rationale; the relevant new public contracts and safety constraints are already documented accordingly. ✏️ Learnings added
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
1955751 to
229336d
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai full review |
✅ Action performedFull review finished. |
|
@coderabbitai The rebased full review has reintroduced the same unitemized docstring-coverage warning, now at 20.00%. Your earlier analysis and withdrawal still apply: the artifact provides no function inventory, denominator, recognition rule, or test/callback exclusion rule, while the rebase is patch-identical ( |
229336d to
fa445b4
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
src/main/daemon/daemon-server.ts (1)
39-48: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winReuse the shared subprocess options contract.
This duplicate shape omits fields that
TerminalHostforwards, includingenvToDelete,launchAgent, WSL distro, and PowerShell implementation. UseTerminalHostSubprocessOptionsto prevent contract drift.Proposed refactor
+import type { TerminalHostSubprocessOptions } from './terminal-host-create-contract' export type DaemonServerOptions = { socketPath: string tokenPath: string ptySpawnHealthCheck?: () => Promise<void> log?: DaemonFileLog - spawnSubprocess: (opts: { - sessionId: string - cols: number - rows: number - cwd?: string - env?: Record<string, string> - command?: string - windowsCodexShellHandoff?: boolean - shellOverride?: string - }) => SubprocessHandle + spawnSubprocess: (opts: TerminalHostSubprocessOptions) => SubprocessHandle }
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: ab1c646c-d412-436d-a260-626159dde426
📥 Commits
Reviewing files that changed from the base of the PR and between 6be4e29 and 229336de931065a73dbf27efd20d897f40d83948.
📒 Files selected for processing (46)
src/main/daemon/daemon-create-or-attach-protocol.tssrc/main/daemon/daemon-pty-adapter.test.tssrc/main/daemon/daemon-pty-adapter.tssrc/main/daemon/daemon-server.test.tssrc/main/daemon/daemon-server.tssrc/main/daemon/pty-subprocess.test.tssrc/main/daemon/pty-subprocess.tssrc/main/daemon/terminal-host-create-contract.tssrc/main/daemon/terminal-host.tssrc/main/daemon/types.tssrc/main/ipc/pty.test.tssrc/main/ipc/pty.tssrc/main/providers/__fixtures__/codex-cli-entrypoint-0.144.5.txtsrc/main/providers/local-pty-provider.test.tssrc/main/providers/local-pty-provider.tssrc/main/providers/local-pty-utils.tssrc/main/providers/types.tssrc/main/providers/windows-codex-generated-command.tssrc/main/providers/windows-codex-package-resolution.tssrc/main/providers/windows-codex-shell-handoff-host.tssrc/main/providers/windows-codex-shell-handoff.conpty.test.tssrc/main/providers/windows-codex-shell-handoff.test.tssrc/main/providers/windows-codex-shell-handoff.tssrc/main/providers/windows-powershell-command-resolution.tssrc/main/providers/windows-shell-args.test.tssrc/main/providers/windows-shell-args.tssrc/main/providers/windows-shell-fallback-chain.test.tssrc/main/providers/windows-shell-fallback-chain.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/rpc/methods/terminal.tssrc/main/runtime/rpc/terminal-create.test.tssrc/renderer/src/components/terminal-pane/pty-connection.tssrc/renderer/src/lib/ai-vault-session-drag.test.tssrc/renderer/src/lib/ai-vault-session-drag.tssrc/renderer/src/lib/sleeping-agent-session-launch.tssrc/renderer/src/store/slices/agent-status-quit-capture.test.tssrc/renderer/src/store/slices/agent-status.tssrc/shared/agent-session-resume.tssrc/shared/sleeping-agent-launch-config.tssrc/shared/tui-agent-base-command.tssrc/shared/tui-agent-launch-provenance.tssrc/shared/tui-agent-startup.test.tssrc/shared/tui-agent-startup.tssrc/shared/workspace-session-schema.sleeping-agent.test.tssrc/shared/workspace-session-sleeping-agents.ts
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai The final head 363d0a7 addresses every actionable and nitpick item, including the collapsed TerminalHostSubprocessOptions refactor, and your final incremental review finished with zero new threads. The walkthrough still repeats the unitemized 20.00% docstring warning that you previously withdrew at #9052 (comment) as non-actionable. Please withdraw/remove that repeated warning for the final head: it still provides no function inventory, denominator, recognition rules, or exclusions, and adding blanket documentation would conflict with this repository's concise why-only comment guidance. |
|
Tip For best results, initiate chat on the files or code changes.
Given the patch-identical rebase and no relevant production-contract changes, I’m withdrawing that repeated warning for the final head. No blanket documentation additions are warranted. 🐇 ✅ |
|
@AmethystLiang @brennanb2025 — PR #9052 is finalized and ready for review at 363d0a7. It is linked to and will close #8814, is mergeable, and CodeRabbit's final-head review is complete with every actionable finding and nitpick addressed, the repeated non-actionable warning withdrawn, and zero unresolved threads. The three fork workflows are waiting for maintainer approval (PR Checks, Computer-use e2e, and Linux Wayland GPU Sandbox) |
|
Re-assigning to @brennanb2025 for reviewing since Brennan is working on codex integration recently |
|
Closing as not planned. The retained PowerShell memory is material, but this fast path intentionally skips the selected shell profile and execution-policy semantics while Codex runs, changing PATH/environment/auth/tool setup for those panes. It also adds a native handoff host and pinned upstream shim/entrypoint allowlists across dozens of files. That fails zero user-facing trade-offs and low ongoing maintenance. |
Summary
On stock local Windows PowerShell Codex launches, start the exact trusted native Codex binary under a lightweight ConPTY handoff host instead of retaining PowerShell plus the npm Node wrapper for the lifetime of every pane. When Codex exits, the host starts the selected PowerShell so the terminal remains usable.
The fast path is deliberately narrow and fail-closed: custom commands, remote/SSH/WSL launches, non-PowerShell shells, modified or unknown package shims/entrypoints, unresolvable native packages, malformed IPC provenance, and oversized command lines retain the established shell launch path.
Observed Windows evidence:
Fixes #8814
Screenshots
No visual change.
Testing
pnpm lintpnpm typecheckpnpm test— the full Windows run was attempted but has 101 existing platform-sensitive failures outside this diff; changed-surface and lifecycle coverage below is greenpnpm buildValidation on final reviewed commit
363d0a76c:git diff --check: passedAI Review Report
Separate adversarial reviews audited launch provenance, package/shim resolution, local/daemon parity, ConPTY lifecycle, signal handling, fallback ordering, command-length boundaries, cleanup, PATH runtime compatibility, SSH/WSL exclusions, and every changed file. Their findings were fixed and regression-tested; both implementation audits approved
d4d30acbcwith no remaining blocker. A separate exact-head audit then approved the final type-contract refactor in363d0a76cwith no findings.CodeRabbit first found a shutdown fallback retry race and incomplete failed-test descendant cleanup; both were fixed and their threads resolved. Its later review found reliance on Node features newer than some PATH runtimes plus two optional-chain assertions that could false-pass. The host was made backward-compatible instead of adding a context-sensitive version probe, exercised end-to-end under Node 14.17.6, and the assertions now prove the startup plan is non-null before checking provenance. These fixes are included in
d4d30acbc. Its collapsed shared subprocess-contract nitpick was then applied and independently approved in363d0a76c.Cross-platform compatibility was checked explicitly. The optimization requires Windows + local + PowerShell + stock Codex provenance. macOS, Linux, WSL, SSH, Git Bash, cmd, custom commands, keyboard behavior, labels, and unrelated Electron paths remain on their existing behavior. Shell paths use Node path utilities and daemon/local transports carry the same literal opt-in marker.
Security Audit
trueprovenance at persistence, renderer drag, RPC, IPC, and daemon boundaries.cmd.execannot reinterpret prompt metacharacters;cmd.exeremains available only as a post-agent interactive shell fallback.Notes
During the native Codex phase, application-owned stock launches intentionally do not load a PowerShell profile or apply PowerShell execution-policy semantics. The selected PowerShell starts normally after Codex exits, and every custom/unverified launch keeps the previous PowerShell path.
The trusted Codex JavaScript entrypoint allowlist currently covers the reviewed
@openai/codex0.144.5 launcher. A changed upstream launcher safely falls back to PowerShell until its behavior is reviewed and recognized.ELI5
On Windows, starting Codex kept a heavy PowerShell-plus-Node wrapper running for every pane. Orca now starts the real Codex binary more directly when safe, and only falls back to PowerShell after Codex exits.