Skip to content

fix(terminal): run Orca's cmd.exe, path-named and setup-gated Codex launches without the shared server - #23933

Merged
Jinwoo-H merged 7 commits into
mainfrom
jinwoo/codex-no-daemon-gaps
Sep 30, 2026
Merged

Jinwoo-H merged 7 commits into
mainfrom
jinwoo/codex-no-daemon-gaps

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Codex 0.156+ runs every Codex window through one shared background server unless it is started with --no-daemon. Orca already adds that flag through a small codex shell function (#23900). Some Codex launches that Orca builds itself never reached that function:

  • Codex started from Orca in a cmd.exe tab
  • Codex started through a custom command with a full path (e.g. /opt/homebrew/bin/codex)
  • Codex started after "wait for setup" finishes

Those launches still shared one server. Every tab then reported its status as the first tab, and closing the first tab killed the others (#22873 / STA-8467). This PR gives those launches --no-daemon too.

What Changed

Before: those three kinds of launch ran Codex on the shared server.
After: they run with exactly one --no-daemon, following the same rule as the shell function. Nothing else changes: plain bash, zsh, fish, Git Bash, WSL and PowerShell tabs launch exactly as on main.

  1. Orca adds --no-daemon itself where no shell function can run. When Orca starts a local Codex terminal, the spawn step puts --no-daemon right after the Codex program. This covers the Codex button, worktree create --agent, worker start, resume/restore, and custom command overrides. The code is in src/main/pty/codex-no-daemon-launch-command.ts, called from both spawn-option builders.
    • It only acts when the tab's shell is cmd.exe or the program is an absolute path. In both cases the binary Orca checks is exactly the one the tab runs.
    • The rule matches the function's: skip agents, queue, --no-daemon, --remote and --remote=*; skip when the terminal's final environment has ORCA_CODEX_ISOLATE=0 (after the pane's own env deletions); add the flag only if codex --help lists it.
    • The check runs on every launch through runProcess, with a 5 s limit and no cache.
    • SSH and WSL launches are left alone. The planner answers synchronously when nothing applies, so non-Codex spawns get no extra await.
  2. The wait-for-setup gate defines the codex function after setup succeeds, right before it runs the agent. The gate runs the agent in a fresh bash -lc, which never reads Orca's shell wrapper.
    • The function text moved, unchanged, to src/shared/codex-shell-function.ts so shared code can embed it.
    • It checks the binary the gate itself resolves after the login profile and after setup. So it still works when setup is what installs codex, and SSH gates get it too.
    • Like the function in wrapped shell tabs, it also runs Orca's Codex launch prep (ORCA_CODEX_LAUNCH_PREFLIGHT … prepare-codex) before starting Codex, which gated launches previously skipped.

The terminal daemon's launch configs and generated wrappers are byte-identical to main. I compared launch configs for plain, history, overlay and startup-command tabs across bash, zsh, fish, pwsh and PowerShell on both transports, plus Git Bash, cmd.exe, PowerShell and WSL on Windows. The wrapper snapshots are unchanged. So no daemon protocol bump is needed.

Not covered (unchanged from main)

  • codex typed by hand in a plain shell tab. Wrapping plain tabs would change how they start: bash would lose login-shell mode.
  • The PowerShell wait-for-setup gate for native Windows runners. It is an -EncodedCommand limited by cmd.exe's 8191-character command line.
  • cmd.exe commands typed after the tab opened.
  • SSH/WSL launches that bypass the remote shell function.

Why

  • Why not add the flag host-side for every launch? The shell function checks the binary the shell finds after the user's startup files run, which Orca's main process cannot see. If Orca checked a newer codex than the one the tab runs, a 0.155 binary would get --no-daemon and exit with status 2. For cmd.exe and absolute paths the check is exact. For the same reason, the setup gate carries the function rather than a host-side rewrite.
  • Why not -c features.daemon_auto_start=false: it does not stop a TUI from joining a server that is already running.
  • Because the opt-out is read from the terminal's environment, a setting that injects ORCA_CODEX_ISOLATE=0 into the spawn environment works here too.

Linked Issue

Refs #22873 (STA-8467). Follow-up to #23900 and #23907.

Visual Proof

N/A. Nothing on screen changes; the effect is Codex's argv.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated

Unit tests:

  • codex-no-daemon-launch-command.test.ts covers each exclusion, the opt-out, an opt-out the pane deletes, SSH/WSL, an unsupported binary, bare codex left to the function, and cmd.exe PATH lookup.
  • setup-agent-sequencing-codex-no-daemon.test.ts runs the real gate under bash with a fake codex pinned ahead of path_helper. It covers a supported binary, an old binary, agents, the opt-out, and codex installed by setup. The supported case fails on main.
  • A throwaway diff of launch configs, run in both trees, found them identical to main.
  • pnpm tc, oxlint and check:code-quality:changed pass.
  • Daemon, providers, pty, ipc, relay and setup-sequencing suites pass, apart from two sqlite repro-13767 tests that also fail on main on this machine.

Live runs (earlier commits; the host-side code is unchanged in substance since):

  • macOS headless dev runtime with isolated HOME and CODEX_HOME: terminal create --command, worktree create --agent codex and an absolute-path command each got exactly one --no-daemon. ~/.codex stayed byte-identical.
  • Windows ("windows 2"): a cmd.exe tab launched with codex --yolo ran real Codex 0.159 as codex.js --no-daemon --yolo.
  • Not verified: the absence of the ← for agents footer and of popup windows on Windows. That needs a signed-in Codex and a visible desktop.

Plain bash, zsh and fish tabs were never wrapped, so a typed codex skipped the
shell function that adds --no-daemon. Wrap them (bash keeps its prompt and
DEBUG trap untouched unless Orca asked for command markers), add --no-daemon
host-side where no function can run (cmd.exe, path-named binaries), and move
new tabs to a v38 terminal daemon so they get the new wrappers.
@greptile-apps

greptile-apps Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 4/5

[High risk] Refactors shell startup and terminal launch logic across multiple systems.

The PR does not appear safe to merge while plain zsh and fish tabs can launch hand-typed Codex on the shared server.

Summary

This PR adds a host-side --no-daemon check for local Codex launches that bypass shell functions and embeds the Codex function in the wait-for-setup gate. It also changes which plain shells receive wrappers. The new unwrapped plain zsh and fish paths leave hand-typed Codex launches using the shared server.

Reviews (6) · Last reviewed commit: "revert(terminal): launch plain zsh and f..."

Comment thread src/main/daemon/shell-ready.ts Resolved
@greptile-apps

greptile-apps Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Comments Outside Diff

These findings could not be posted inline.

  • P1 Plain Codex tabs lose isolation src/main/daemon/shell-ready.ts:136 ▶

    In a plain zsh tab with no startup features, this branch skips the wrapper that defines Orca’s codex function. The local PTY does the same, and plain fish tabs are also left unwrapped. If a user types codex in one of these tabs, it runs without --no-daemon: the host-side rewrite does not apply to hand-typed commands. Those sessions can again share a server, so closing one tab can disrupt the others.

  • P1 Plain bash loses Codex isolation src/main/daemon/shell-ready.ts:154 ▶

    In a plain bash tab with no startup features, this branch starts the login shell without Orca’s rcfile. If a user types codex, the function that adds --no-daemon is absent, so Codex can use the shared server again. That restores the cross-tab status and shutdown problem this PR addresses. The local PTY makes the same choice, and a plain Git Bash tab can also start without the rcfile when it has neither a startup command nor a Codex preflight command.

  • P1 Configured shell arguments are lost src/main/providers/local-pty-shell-ready.ts:104 ▶

    When a plain local bash, zsh, or fish tab has configured shell arguments, the new wrapper arguments replace them. Previously, a tab with no startup features kept its configured arguments. Shell profiles that depend on those arguments now start with a different configuration.

@coderabbitai

coderabbitai Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 095a7989-c705-4876-b6a1-144a0d7457ac

📥 Commits

Reviewing files that changed from the base of the PR and between e53885b and 5bdd18e.

📒 Files selected for processing (5)
  • src/main/ipc/pty/ipc/spawn-options.ts
  • src/main/ipc/pty/runtime/spawn-options.ts
  • src/main/pty/codex-no-daemon-launch-command.test.ts
  • src/main/pty/codex-no-daemon-launch-command.ts
  • src/shared/setup-agent-sequencing-codex-no-daemon.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.


📝 Walkthrough

Walkthrough

The change adds shared POSIX, fish, and PowerShell Codex shell preflight generators, updates shell launch configuration for zsh and fish, and adds local PTY command planning that inserts --no-daemon when supported. It also advances the daemon protocol and compatibility contract to version 38.

Priority: ➖ Normal

Merge Risk: 🟡 Moderate · up to 5bdd1

Native Windows Codex launches that wait for setup can still use the shared server, so this launch mode misses the PR’s isolation behavior. Resolve or explicitly accept this gap before merging.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 5bdd1

The change improves separation between Codex sessions while preserving explicit shared-server choices. A new pre-launch process does not participate in launch cancellation or verified descendant cleanup, creating a limited local failure-containment concern. No new remote access or privilege escalation was established.

Retained concerns

  • Low · reliability · inferred: The new host-side capability probe executes before terminal spawning without launch cancellation or verified process-tree cleanup. A canceled launch can continue probing until its timeout, and probe descendants may survive root termination outside terminal ownership. This additional execution was absent from the affected direct-launch paths at base. Exposure is limited to an eligible local executable already selected for launch; remote probing and privilege escalation were not established.
Security review details

Security Blast Radius

  • inferred — The new probe's demonstrated execution scope is the local user's host and selected executable. Both callers exclude connection-backed and WSL launches. Influencing the command or executable could influence preflight execution, but upstream attacker control and any privilege gain were not established.

Trust Boundaries and Controls

  • observed — The planner rejects shell-diverging executable spans and non-Codex program names. The callers' environment-deletion policy is applied again before the probe, preventing this merge from restoring explicitly deleted inherited keys.

Resilience and Maintainability Implications

  • inferred — The native-Windows deferred PowerShell gate still evaluates its stored startup command without embedding the Codex preflight, and the direct-executable planner does not recognize that PowerShell gate as Codex. This isolation limitation predates the PR; the new deferred Codex tests cover POSIX execution rather than proving Windows coverage.

Hardening Proposals

  • proposed — Bind host-side capability probes to launch cancellation and an explicit child-tree cleanup policy so preflight work cannot silently outlive the launch that requested it.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 39.29% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 28 functions across 39 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the main behavior change: local Codex launches in cmd.exe, path-named commands, and setup-gated launches avoid the shared server.
Description check ✅ Passed The description includes the core required sections, explains the user impact and implementation, links the related issue, records visual proof as not applicable, and documents testing. Several admini…
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

The cmd.exe and plain-shell wrapping changes look correct, but a supported wait-for-setup worktree launch still runs Codex without --no-daemon, so #22873 persists on that path. Details inline; two smaller scope notes below.

Reviewed changes

  • Host-side --no-daemon injection — new src/main/pty/codex-no-daemon-launch-command.ts adds the flag after a Codex executable for cmd.exe and path-named launches where the shell codex function never runs, applying the same exclusions, ORCA_CODEX_ISOLATE=0 opt-out, and --help capability probe. Wired into both PTY spawn-options builders and skipped for SSH and WSL.
  • Plain shells always wrapped — getShellLaunchConfig (daemon + local) and the Windows Git Bash launch now wrap bash/zsh/fish even with zero features, so a hand-typed codex reaches the wrapper-defined function. The bash rcfiles gate their OSC 133 / DEBUG trap / bracketed-paste / startup block behind the markers feature and return early when it is off. WSL bash exports ORCA_SHELL_FEATURES=markers to keep its prior lifecycle.
  • Daemon protocol 37 → 38 — content-addressed wrapper bump so new tabs get the new wrappers, with prior versions still attachable; contract json/ts and tests updated consistently.

ℹ️ Plain zsh and fish tabs on SSH/relay hosts still share the server

The host-side planner is intentionally skipped when args.connectionId is set, delegating to the codex function on the remote host. But the relay only wraps remote bash unconditionally — src/relay/pty-shell-launch.ts:109 still returns the unwrapped login shell for zsh when features.length === 0, and fish is not handled at all — so a hand-typed codex in a plain remote zsh or fish tab has no function to reach. The PR body states SSH is unchanged, so this may be a deliberate follow-up, but the plain-shell coverage described in the PR does not hold over SSH. Worth stating explicitly, or covering in a follow-up.

Technical details
# Relay plain shells still bypass the codex function

## Affected sites
- `src/relay/pty-shell-launch.ts:109-111` — `if (shellName !== 'bash' && features.length === 0) return unwrapped`, so plain zsh never gets a wrapper; fish returns `unwrapped` earlier at `:90-92`.
- `src/main/ipc/pty/ipc/spawn-options.ts:82` and `src/main/ipc/pty/runtime/spawn-options.ts:103` — host-side planner skipped for `connectionId`.

## Required outcome
Either accept and document that SSH plain zsh/fish Codex launches are not covered, or wrap plain zsh (and fish) on the relay so the remote codex function exists too.

## Open questions for the human
Is the relay's plain-shell path intended as a follow-up to this PR?

ℹ️ Nitpicks

  • local-pty-shell-ready.ts:71-74 can append startup without markers, but the new bash early-return gates the startup block on markers. Production callers always set hasStartupCommand when a startup command exists, so this is not reachable today — but a guard coupling the two (or keying the early-return off the startup-command env) would remove the silent-drop landmine.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Comment thread src/main/ipc/pty/ipc/spawn-options.ts Outdated
args.connectionId || ctx.codexSelectionTarget.runtime === 'wsl'
? null
: planCodexNoDaemonLaunch({
command: ctx.launchCommand,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This planner only receives the PTY launch command, so a wait-for-setup Codex launch slips through: runtime-local-worktree-terminal-startup.ts:79-93 replaces the launch command with a sequencing gate and moves the real Codex command into env ORCA_SEQUENCED_STARTUP_COMMAND, whose gate shell (bash -lc on POSIX, -NoProfile -NonInteractive PowerShell on Windows) never sources the Orca wrapper — so neither this flag nor the shell function reaches Codex, and #22873 persists. The runtime call site at src/main/ipc/pty/runtime/spawn-options.ts:105-110 has the same gap.

Technical details
# Sequenced setup launches never get `--no-daemon`

## Affected sites
- `src/main/ipc/pty/ipc/spawn-options.ts:84-89` — planner sees only `ctx.launchCommand`
- `src/main/ipc/pty/runtime/spawn-options.ts:105-110` — same, using `ctx.daemonShellOverride`
- `src/main/runtime/runtime-local-worktree-terminal-startup.ts:79-93` — swaps the launch command for the gate, real Codex command goes to `ORCA_SEQUENCED_STARTUP_COMMAND`
- `src/shared/setup-agent-sequencing.ts:82` — POSIX gate `bash -lc 'eval "$ORCA_SEQUENCED_STARTUP_SCRIPT"'`; `:268` — Windows gate evals `$env:ORCA_SEQUENCED_STARTUP_COMMAND` under a profile-less PowerShell
- `src/main/ipc/pty/host-env/codex-resume.ts:120-137` — existing precedent for rewriting the sequenced env (`stripSequencedStartupResumeArgv`)

## Required outcome
A Codex launch under the `wait-for-setup` policy must receive exactly one `--no-daemon`, including on cmd.exe/Git Bash where no shell function exists.

## Suggested approach
When the env carries `ORCA_SEQUENCED_STARTUP_COMMAND`, apply the same `planCodexNoDaemonLaunch` rule to that string and write the result back into the spawn env (mirroring how resume argv is stripped from it), or emit the flag into the sequenced command before it is stored. Cover the sequenced path in `codex-no-daemon-launch-command.test.ts`.

## Open questions for the human
Is `wait-for-setup` deliberately out of scope for this PR, or should the host-side planner also handle the sequenced command?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Valid, fixed in 985498a. This is a pre-existing gap from #23900 rather than a regression: setup-agent-sequencing-codex-no-daemon.test.ts runs the real POSIX gate and shows main running codex --yolo. Instead of a host-side rewrite, the gate's bash -lc script now defines the same codex function (moved to src/shared/codex-shell-function.ts). That way it checks the binary the gate actually runs after the login profile, and it also covers SSH gates. The PowerShell gate (native Windows runner) is left as-is: it is typed as an -EncodedCommand whose size is limited by cmd.exe's 8191-character command line. That remains a documented gap.

…the codex function

Plain bash and Git Bash tabs launch exactly as before again: the rcfile
wrapper would have made every one a non-login shell. Plain tabs on the
user's configured shell args stay unwrapped on both transports. The
wait-for-setup gate's bash -lc now defines the codex function, so a
sequenced Codex launch gets --no-daemon from the binary it actually runs.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No new issues in this incremental delta. The POSIX wait-for-setup gap from the prior review is fixed and tested; the plain bash/Git Bash launch behavior is back to main's.

Reviewed changes

  • Reverted plain bash and Git Bash to their login-shell launch, so only a wrapped pane (a feature or startup command present) runs the bash rcfile that defines the codex function.
  • Moved the codex shell-function text into src/shared/codex-shell-function.ts so main, relay, the PowerShell bootstrap, and the setup gate embed one definition; codex-shell-launch-preflight.ts now only exports resolveCodexShellLaunchPreflightCommand.
  • Taught the POSIX wait-for-setup gate to prepend the codex function to its script, closing the sequenced-launch --no-daemon gap raised in the prior review.
  • Added keepsConfiguredShellUnwrapped so a plain tab launched on the user's configured shell args stays exactly the user's shell on both the daemon and local transports.
  • Updated tests, fixtures, and the daemon-v38 comment to describe plain zsh and fish only.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 28ffeaf7-29ef-4861-9209-abed62b34fc4

📥 Commits

Reviewing files that changed from the base of the PR and between d55fb27 and 985498a.

📒 Files selected for processing (23)
  • config/scripts/pr-code-change-scope.mjs
  • src/main/daemon/daemon-bash-shell-ready-rcfile.ts
  • src/main/daemon/daemon-protocol-version.ts
  • src/main/daemon/pty-subprocess/shell-launch-plan.ts
  • src/main/daemon/shell-ready.ts
  • src/main/powershell-osc133-bootstrap.ts
  • src/main/providers/configured-shell-args-wrapping.test.ts
  • src/main/providers/local-pty-finalize-environment.ts
  • src/main/providers/local-pty-shell-ready-bash-rcfile.ts
  • src/main/providers/local-pty-shell-ready-wrapper-generation.test.ts
  • src/main/providers/local-pty-shell-ready.ts
  • src/main/pty/codex-launch-shell-wrapping.test.ts
  • src/main/pty/codex-no-daemon-binary-contract.test.ts
  • src/main/pty/codex-no-daemon-launch-command.ts
  • src/main/pty/codex-shell-launch-preflight.test.ts
  • src/main/pty/codex-shell-launch-preflight.ts
  • src/main/pty/codex-shell-no-daemon.test.ts
  • src/main/shell-startup-features.ts
  • src/main/zsh-startup-wrapper-builder.ts
  • src/relay/pty-shell-overlay-wrappers.ts
  • src/shared/codex-shell-function.ts
  • src/shared/setup-agent-sequencing-codex-no-daemon.test.ts
  • src/shared/setup-agent-sequencing.ts
💤 Files with no reviewable changes (1)
  • src/main/pty/codex-shell-launch-preflight.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/daemon/daemon-protocol-version.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

Comment thread src/shared/setup-agent-sequencing.ts Resolved
…ishes

Setup can be what puts codex on PATH, so defining the function before the
marker wait found no binary and skipped --no-daemon.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No new issues in this incremental delta. The previous commit defined the gate's codex function before the setup wait, so it found no binary; this commit moves that definition after setup finishes.

Reviewed changes

  • Moved the codex shell-function definition from the prologue of the POSIX wait-for-setup gate script into its post-setup status = 0 branch, so the function probes the codex binary that setup may have just installed on PATH.
  • Reworked setup-agent-sequencing-codex-no-daemon.test.ts around prepareGate/finishSetup helpers and added a case that installs codex only after the gate is already waiting, asserting the launch gets exactly one --no-daemon.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No new issues in this incremental delta. The new commit is a behavior-preserving refactor plus test hardening; the earlier wait-for-setup PowerShell-gate limitation is unchanged and remains documented.

Reviewed changes

  • Folded the SSH/WSL skip into planCodexNoDaemonLaunch as a required executesOnThisHost flag, so both spawn-options builders pass it instead of guarding the call with a ternary. Equivalent behavior: the planner still returns null synchronously for remote and WSL launches.
  • Un-exported the daemon UNWRAPPED sentinel; createPtyShellLaunchPlan now uses null for the configured-shell-unwrapped branch and folds terminalShellArgs into a ?? chain, preserving the old ternary's precedence.
  • Bounded the sequenced-gate test with waitTimeoutSeconds: 5 and an afterEach that kills spawned gates, so a failed assertion can no longer leave a two-hour poll running.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: e18a0805-faec-4da5-b774-cdfee1de05da

📥 Commits

Reviewing files that changed from the base of the PR and between b0e2cc1 and e53885b.

📒 Files selected for processing (7)
  • src/main/daemon/pty-subprocess/shell-launch-plan.ts
  • src/main/daemon/shell-ready.ts
  • src/main/ipc/pty/ipc/spawn-options.ts
  • src/main/ipc/pty/runtime/spawn-options.ts
  • src/main/pty/codex-no-daemon-launch-command.test.ts
  • src/main/pty/codex-no-daemon-launch-command.ts
  • src/shared/setup-agent-sequencing-codex-no-daemon.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.

…heck

Also pin the setup-gate test's fake codex ahead of path_helper's PATH.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No new issues in this incremental delta. The one new commit deletes the pane's requested env keys from the merged environment before the Codex launch planner reads the ORCA_CODEX_ISOLATE opt-out, plus a setup-gate test hardening.

Reviewed changes

  • Threaded envToDelete through LocalCodexLaunch, so planCodexNoDaemonLaunch now deletes those keys from the merged { ...process.env, ...launch.env } before checking ORCA_CODEX_ISOLATE. Both spawn-options builders pass their deletion lists (ctx.combinedEnvToDelete, ctx.spawnOptions.envToDelete); the overlay scrub alone could not remove a value inherited from process.env.
  • Added coverage that fails without the fix: a stubbed inherited ORCA_CODEX_ISOLATE=0 plus envToDelete: ['ORCA_CODEX_ISOLATE'] now resolves to a single --no-daemon, with vi.unstubAllEnvs() in teardown.
  • Hardened the sequenced-gate test: .bash_profile re-prepends the fixture bin ahead of macOS path_helper's PATH reordering, and CODEX_HOME is pinned to the temp root so no real ~/.codex is touched.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Drops the always-wrap for plain zsh and fish, the configured-args guard
that only served it, and the v38 daemon bump: the daemon's launch configs
and generated wrappers are byte-identical to main again. Keeps the
host-side --no-daemon for cmd.exe and path-named launches and the setup
gate's codex function.
@Jinwoo-H Jinwoo-H changed the title fix(terminal): run Codex without the shared server in cmd.exe, path-named, and plain-shell launches fix(terminal): run Orca's cmd.exe, path-named and setup-gated Codex launches without the shared server Sep 30, 2026

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No new issues in this incremental delta. The one new commit reverts the plain zsh/fish wrapping added earlier in the PR, so those tabs launch exactly as on main again.

Reviewed changes

  • Reverted plain zsh and fish tabs to their main launch config on both the daemon and local PTY transports, so only an Orca-launched agent (or a pane with a startup command) reaches the codex wrapper. A hand-typed codex in a plain zsh/fish tab no longer gets --no-daemon, matching main and the PR body's "Not covered".
  • Removed the now-unused keepsConfiguredShellUnwrapped helper, the UNWRAPPED re-export, the two wrapping test files, and the daemon protocol 38 bump. PROTOCOL_VERSION is back to main's 37 and the compatibility contract json/ts are untouched.
  • Left the host-side planCodexNoDaemonLaunch path, the POSIX setup gate, and src/shared/codex-shell-function.ts unchanged.

ℹ️ Nitpicks

  • The "Not covered" bullet explains plain tabs are left unwrapped because "bash would lose login-shell mode", but that reason is bash-specific: zsh and fish keep their -l login shell. Worth stating why plain zsh/fish were reverted too, so the scope decision is legible.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@Jinwoo-H
Jinwoo-H merged commit 26bb7c2 into main Sep 30, 2026
56 checks passed
nwparker added a commit that referenced this pull request Sep 30, 2026
#23933 added a --help capability probe that runs on every Codex launch and is
deliberately uncached. This spec puts a fake codex on PATH that records every
invocation, so the probe landed in the spawn ledger and the first-mount
assertion saw two launches where one was expected.

Verified on plain main: 8/8 repetitions fail at spec line 617 with
[{args:['--help']}, {args:['--dangerously-bypass-approvals-and-sandbox',...]}],
so the breakage is independent of the retention change this branch makes.
Jinwoo-H added a commit that referenced this pull request Sep 30, 2026
…aunches without the shared server (#23933)

* fix(terminal): give plain shells and cmd.exe Codex launches --no-daemon

Plain bash, zsh and fish tabs were never wrapped, so a typed codex skipped the
shell function that adds --no-daemon. Wrap them (bash keeps its prompt and
DEBUG trap untouched unless Orca asked for command markers), add --no-daemon
host-side where no function can run (cmd.exe, path-named binaries), and move
new tabs to a v38 terminal daemon so they get the new wrappers.

* fix(terminal): keep plain bash a login shell and give the setup gate the codex function

Plain bash and Git Bash tabs launch exactly as before again: the rcfile
wrapper would have made every one a non-login shell. Plain tabs on the
user's configured shell args stay unwrapped on both transports. The
wait-for-setup gate's bash -lc now defines the codex function, so a
sequenced Codex launch gets --no-daemon from the binary it actually runs.

* fix(terminal): define the setup gate's codex function after setup finishes

Setup can be what puts codex on PATH, so defining the function before the
marker wait found no binary and skipped --no-daemon.

* refactor(terminal): fold the SSH/WSL guard into the Codex launch planner and bound the gate test

* fix(terminal): honour the pane's env deletions in the Codex opt-out check

Also pin the setup-gate test's fake codex ahead of path_helper's PATH.

* revert(terminal): launch plain zsh and fish tabs exactly as on main

Drops the always-wrap for plain zsh and fish, the configured-args guard
that only served it, and the v38 daemon bump: the daemon's launch configs
and generated wrappers are byte-identical to main again. Keeps the
host-side --no-daemon for cmd.exe and path-named launches and the setup
gate's codex function.

(cherry picked from commit 26bb7c2)
brennanb2025 added a commit that referenced this pull request Oct 1, 2026
…spawn (#24440)

* test(e2e): fake Codex answers the --no-daemon --help probe without a spawn

Since #23933 Orca runs `codex --help` before a path-named Codex launch. The
fakes logged it as an agent spawn and held the probe for its 5 s timeout.
Move the app-server refusal and --help answer into one shared
FAKE_CODEX_LAUNCH_PROBES_SOURCE used by every fake Codex.

* test(e2e): stop asserting the dispatch capability column a current worker no longer has

#23994 stopped minting the per-dispatch capability, so capability_hash is null.
The --help spawn failure used to stop this test before it got here.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant