-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Add Codex launch arguments setting #2892
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
juliusmarminge
merged 23 commits into
pingdotgg:main
from
jamesx0416:t3code/codex-launch-args
Jul 20, 2026
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
6af7cf5
Add Codex launch arguments setting
jamesx0416 8d4883a
Address Codex launch args review
jamesx0416 e9608d9
Keep Codex launch args PR small
jamesx0416 e051516
Fix Codex adapter launch args test expectation
jamesx0416 3d522fe
Forward shared Codex launch args to exec
jamesx0416 4f301a6
Merge branch 'main' into t3code/codex-launch-args
jamesx0416 8939411
Merge branch 'main' into t3code/codex-launch-args
jamesx0416 c714c38
Handle incomplete Codex exec launch flags
jamesx0416 15cbb46
Merge branch 'main' into t3code/codex-launch-args
juliusmarminge 518e65d
Change test framework import from vitest to vite-plus
juliusmarminge 737d8f6
Merge upstream/main into pr-2892
jamesx0416 9fcde3c
Merge branch 'main' into t3code/codex-launch-args
juliusmarminge 0d5061a
Fix Codex app-server args
jamesx0416 7867442
Merge branch 'main' into t3code/codex-launch-args
jamesx0416 7b3b6d3
Fix Codex launch args checks
jamesx0416 006c9f5
Merge branch 'main' into t3code/codex-launch-args
jamesx0416 ccfabb2
Add codex launch args env override
invalid-email-address 5304b45
Preserve launch args for MCP Codex sessions
invalid-email-address 036a8dd
Parse quoted Codex launch args
invalid-email-address 568ae0e
Preserve backslashes in Codex launch args
invalid-email-address bfa7715
Resolve catalog store merge conflict
jamesx0416 9dbbf9e
Merge branch 'main' into t3code/codex-launch-args
jamesx0416 04cb6cd
Share quote-aware CLI arg tokenization
jamesx0416 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| import * as NodeAssert from "node:assert/strict"; | ||
|
|
||
| import { describe, it } from "vite-plus/test"; | ||
|
|
||
| import { | ||
| codexAppServerArgs, | ||
| codexExecLaunchArgs, | ||
| resolveCodexLaunchArgs, | ||
| } from "./codexLaunchArgs.ts"; | ||
|
|
||
| describe("resolveCodexLaunchArgs", () => { | ||
| it("uses T3CODE_CODEX_LAUNCH_ARGS before configured settings", () => { | ||
| NodeAssert.equal( | ||
| resolveCodexLaunchArgs(" --strict-config ", { T3CODE_CODEX_LAUNCH_ARGS: "--enable foo" }), | ||
| "--enable foo", | ||
| ); | ||
| }); | ||
|
|
||
| it("uses configured settings when T3CODE_CODEX_LAUNCH_ARGS is empty", () => { | ||
| NodeAssert.equal( | ||
| resolveCodexLaunchArgs(" --strict-config ", { T3CODE_CODEX_LAUNCH_ARGS: " " }), | ||
| "--strict-config", | ||
| ); | ||
| }); | ||
|
|
||
| it("ignores whitespace-only environment values", () => { | ||
| NodeAssert.equal(resolveCodexLaunchArgs("", { T3CODE_CODEX_LAUNCH_ARGS: " " }), ""); | ||
| }); | ||
| }); | ||
|
|
||
| describe("codexAppServerArgs", () => { | ||
| it("returns the app-server command for empty launch args", () => { | ||
| NodeAssert.deepStrictEqual(codexAppServerArgs(""), ["app-server"]); | ||
| }); | ||
|
|
||
| it("appends parsed launch args after app-server", () => { | ||
| NodeAssert.deepStrictEqual(codexAppServerArgs("--strict-config --enable foo"), [ | ||
| "app-server", | ||
| "--strict-config", | ||
| "--enable", | ||
| "foo", | ||
| ]); | ||
| }); | ||
| }); | ||
|
|
||
| describe("codexExecLaunchArgs", () => { | ||
| it("keeps shared codex flags and omits app-server-only flags", () => { | ||
| NodeAssert.deepStrictEqual( | ||
| codexExecLaunchArgs('--strict-config --enable foo --listen off --config model="gpt 5"'), | ||
| ["--strict-config", "--enable", "foo", "--config", "model=gpt 5"], | ||
| ); | ||
| }); | ||
|
|
||
| it("does not pair value-taking flags with adjacent flags", () => { | ||
| NodeAssert.deepStrictEqual(codexExecLaunchArgs("--config --strict-config --enable --disable"), [ | ||
| "--strict-config", | ||
| ]); | ||
| }); | ||
| }); |
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,48 @@ | ||
| import { tokenizeCliArgs } from "@t3tools/shared/cliArgs"; | ||
|
|
||
| export const T3CODE_CODEX_LAUNCH_ARGS_ENV = "T3CODE_CODEX_LAUNCH_ARGS"; | ||
|
|
||
| export const resolveCodexLaunchArgs = ( | ||
| launchArgs?: string, | ||
| environment: NodeJS.ProcessEnv = process.env, | ||
| ) => environment[T3CODE_CODEX_LAUNCH_ARGS_ENV]?.trim() || launchArgs?.trim() || ""; | ||
|
|
||
| export const codexLaunchArgv = (launchArgs?: string): ReadonlyArray<string> => | ||
| tokenizeCliArgs(launchArgs); | ||
|
|
||
| export const codexAppServerArgs = (launchArgs?: string) => [ | ||
| "app-server", | ||
| ...codexLaunchArgv(launchArgs), | ||
| ]; | ||
|
|
||
| export const codexExecLaunchArgs = (launchArgs?: string) => { | ||
| const args = codexLaunchArgv(launchArgs); | ||
| const execArgs: Array<string> = []; | ||
|
|
||
| for (let index = 0; index < args.length; index++) { | ||
| const arg = args[index]; | ||
| if (arg === undefined) continue; | ||
|
|
||
| if (arg === "--strict-config" || arg.startsWith("--config=") || arg.startsWith("-c=")) { | ||
| execArgs.push(arg); | ||
| } else if (arg === "--config" || arg === "-c" || arg === "--enable" || arg === "--disable") { | ||
| const value = args[index + 1]; | ||
| if (value !== undefined && !value.startsWith("-")) { | ||
| execArgs.push(arg, value); | ||
| index++; | ||
| } | ||
| } else if (arg.startsWith("--enable=") || arg.startsWith("--disable=")) { | ||
| execArgs.push(arg); | ||
| } | ||
| } | ||
|
|
||
| return execArgs; | ||
| }; | ||
|
|
||
| export const codexSessionAppServerArgs = ( | ||
| appServerArgs: ReadonlyArray<string> | undefined, | ||
| launchArgs: string | undefined, | ||
| ) => { | ||
| const launchAppServerArgs = codexAppServerArgs(launchArgs); | ||
| return appServerArgs ? [...launchAppServerArgs, ...appServerArgs] : launchAppServerArgs; | ||
| }; |
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
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.
Uh oh!
There was an error while loading. Please reload this page.