Repository navigation
fix(terminal): run Orca's cmd.exe, path-named and setup-gated Codex launches without the shared server #23933
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d55fb27
fix(terminal): give plain shells and cmd.exe Codex launches --no-daemon
Jinwoo-H 985498a
fix(terminal): keep plain bash a login shell and give the setup gate …
Jinwoo-H b0e2cc1
fix(terminal): define the setup gate's codex function after setup fin…
Jinwoo-H 1732946
refactor(terminal): fold the SSH/WSL guard into the Codex launch plan…
Jinwoo-H e53885b
Merge remote-tracking branch 'origin/main' into jinwoo/codex-no-daemo…
Jinwoo-H 5bdd18e
fix(terminal): honour the pane's env deletions in the Codex opt-out c…
Jinwoo-H dc4823e
revert(terminal): launch plain zsh and fish tabs exactly as on main
Jinwoo-H File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| import { mkdtempSync, rmSync } from 'node:fs' | ||
| import { tmpdir } from 'node:os' | ||
| import { join } from 'node:path' | ||
| import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' | ||
| import { createPtyShellLaunchPlan } from '../daemon/pty-subprocess/shell-launch-plan' | ||
| import { createDaemonPtyEnvironment } from '../daemon/pty-subprocess/spawn-environment' | ||
| import { finalizeLocalPtySpawnEnvironment } from './local-pty-finalize-environment' | ||
| import { createLocalPtyLaunchPlan } from './local-pty-launch-plan' | ||
|
|
||
| // Why: a plain tab launched with the user's configured shell args stays exactly | ||
| // their shell; Orca wraps it only when it needs a feature (e.g. zsh history). | ||
| const CONFIGURED_ARGS = ['--custom-arg'] | ||
| const SHELLS = ['/bin/bash', '/bin/zsh', '/usr/bin/fish'] | ||
|
|
||
| describe.skipIf(process.platform === 'win32')('plain tabs with configured shell args', () => { | ||
| let userData: string | ||
|
|
||
| beforeEach(() => { | ||
| userData = mkdtempSync(join(tmpdir(), 'orca-configured-shell-args-')) | ||
| vi.stubEnv('ORCA_USER_DATA_PATH', userData) | ||
| // Why: the daemon env inherits this process's; a parent's zsh or history setting must not leak in. | ||
| vi.stubEnv('ZDOTDIR', undefined) | ||
| vi.stubEnv('ORCA_HISTFILE', undefined) | ||
| }) | ||
|
|
||
| afterEach(() => { | ||
| vi.unstubAllEnvs() | ||
| rmSync(userData, { recursive: true, force: true }) | ||
| }) | ||
|
|
||
| it.each(SHELLS)('daemon transport keeps %s unwrapped on the configured args', (shell) => { | ||
| const opts = { | ||
| sessionId: 'configured-args', | ||
| cols: 80, | ||
| rows: 24, | ||
| cwd: userData, | ||
| shellOverride: shell, | ||
| terminalShellArgs: CONFIGURED_ARGS | ||
| } | ||
| const env = createDaemonPtyEnvironment(opts) | ||
|
|
||
| const plan = createPtyShellLaunchPlan(opts, env) | ||
|
|
||
| expect(plan.shellArgs).toEqual(CONFIGURED_ARGS) | ||
| expect(env.ZDOTDIR).toBeUndefined() | ||
| expect(env.ORCA_SHELL_FEATURES).toBeUndefined() | ||
| }) | ||
|
|
||
| it.each(SHELLS)('local transport keeps %s unwrapped on the configured args', (shell) => { | ||
| const spawn = { | ||
| cols: 80, | ||
| rows: 24, | ||
| cwd: userData, | ||
| shellOverride: shell, | ||
| terminalShellArgs: CONFIGURED_ARGS | ||
| } | ||
| const getOptions = () => ({}) | ||
| const plan = createLocalPtyLaunchPlan(spawn, getOptions) | ||
| if (!('shellArgs' in plan)) { | ||
| throw new Error('expected a resolved posix launch plan') | ||
| } | ||
| const env: Record<string, string> = { HOME: userData } | ||
|
|
||
| finalizeLocalPtySpawnEnvironment({ spawn, getOptions, plan, env }) | ||
|
|
||
| expect(plan.shellArgs).toEqual(CONFIGURED_ARGS) | ||
| expect(env.ZDOTDIR).toBeUndefined() | ||
| expect(env.ORCA_SHELL_FEATURES).toBeUndefined() | ||
| }) | ||
| }) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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-setupCodex launch slips through:runtime-local-worktree-terminal-startup.ts:79-93replaces the launch command with a sequencing gate and moves the real Codex command into envORCA_SEQUENCED_STARTUP_COMMAND, whose gate shell (bash -lcon POSIX,-NoProfile -NonInteractivePowerShell on Windows) never sources the Orca wrapper — so neither this flag nor the shell function reaches Codex, and #22873 persists. The runtime call site atsrc/main/ipc/pty/runtime/spawn-options.ts:105-110has the same gap.Technical details
There was a problem hiding this comment.
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.tsruns the real POSIX gate and shows main runningcodex --yolo. Instead of a host-side rewrite, the gate'sbash -lcscript now defines the same codex function (moved tosrc/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-EncodedCommandwhose size is limited by cmd.exe's 8191-character command line. That remains a documented gap.