The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 06:00 UTC
fix(server): keep Codex apps and plugins off during text generation (#39086)
Co-authored-by: Simone <185146821+Lucenx9@users.noreply.github.com>
Simone committed
Nov 19, 2026 at 21:14 UTC
4fccab84a0e67a43f752bb87acd7e7302c418a7c
4 files changed
+40
-20
apps/server/src/provider/codexLaunchArgs.test.ts
+21
-7
@@ -38,13 +38,27 @@ describe("codexExecLaunchArgs", () => {
38
);
39
});
40
41
- it("drops launch args that enable user hooks", () => {
42
- NodeAssert.deepStrictEqual(
43
- codexExecLaunchArgs(
44
- "--enable hooks --enable=hooks --enable codex_hooks --enable=codex_hooks --enable foo --disable hooks",
45
- ),
46
- ["--enable", "foo", "--disable", "hooks"],
47
- );
41
+ it("keeps user hooks, apps, and plugins off during text generation", () => {
42
+ const launchArgs =
43
+ "--enable hooks --enable=hooks --enable codex_hooks --enable=codex_hooks --enable apps --enable=apps --enable connectors --enable=connectors --enable plugins --enable=plugins --enable foo --disable hooks";
44
+ NodeAssert.deepStrictEqual(codexExecLaunchArgs(launchArgs), [
45
+ "--enable",
46
+ "foo",
47
+ "--disable",
48
+ "hooks",
49
+ ]);
50
+ NodeAssert.deepStrictEqual(codexMcpListLaunchArgs(launchArgs), [
51
+ "--enable",
52
+ "hooks",
53
+ "--enable=hooks",
54
+ "--enable",
55
+ "codex_hooks",
56
+ "--enable=codex_hooks",
57
+ "--enable",
58
+ "foo",
59
+ "--disable",
60
+ "hooks",
61
+ ]);
62
});
63
64
it("does not pair value-taking flags with adjacent flags", () => {
apps/server/src/provider/codexLaunchArgs.ts
+13
-11
@@ -63,17 +63,19 @@ const filterLaunchArgs = (launchArgs: string | undefined, allowed: LaunchArgFilt
63
return kept;
64
};
65
66
-const HOOK_FEATURES = new Set(["hooks", "codex_hooks"]);
67
-
68
-// Feature toggles beat config overrides, so a launch arg's hook enable would undo ours.
69
-export const codexExecLaunchArgs = (launchArgs?: string) => {
70
- const args = filterLaunchArgs(launchArgs, EXEC_FILTER);
71
- return args.filter((arg, index) => {
72
- if (arg.startsWith("--enable=")) return !HOOK_FEATURES.has(arg.slice("--enable=".length));
73
- if (arg === "--enable") return !HOOK_FEATURES.has(args[index + 1] ?? "");
74
- return !(args[index - 1] === "--enable" && HOOK_FEATURES.has(arg));
66
+const MCP_LIST_DISABLED_FEATURES = new Set(["apps", "connectors", "plugins"]);
67
+const EXEC_DISABLED_FEATURES = new Set([...MCP_LIST_DISABLED_FEATURES, "hooks", "codex_hooks"]);
68
+
69
+// Codex can apply explicit --enable flags after trailing -c overrides.
70
+const omitFeatureEnables = (args: ReadonlyArray<string>, features: ReadonlySet<string>) =>
71
+ args.filter((arg, index) => {
72
+ if (arg.startsWith("--enable=")) return !features.has(arg.slice("--enable=".length));
73
+ if (arg === "--enable") return !features.has(args[index + 1] ?? "");
74
+ return !(args[index - 1] === "--enable" && features.has(arg));
75
});
76
-};
76
+
77
+export const codexExecLaunchArgs = (launchArgs?: string) =>
78
+ omitFeatureEnables(filterLaunchArgs(launchArgs, EXEC_FILTER), EXEC_DISABLED_FEATURES);
79
80
export const codexMcpListLaunchArgs = (launchArgs?: string) =>
79
- filterLaunchArgs(launchArgs, MCP_LIST_FILTER);
81
+ omitFeatureEnables(filterLaunchArgs(launchArgs, MCP_LIST_FILTER), MCP_LIST_DISABLED_FEATURES);
apps/server/src/textGeneration/CodexTextGeneration.test.ts
+3
-2
@@ -488,9 +488,10 @@ it.layer(layerCodexTextGenerationTest)("CodexTextGeneration", (it) => {
488
withFakeCodexEnv(
489
{
490
output: JSON.stringify({ title: "Remove default shapes" }),
491
- launchArgs: "--config features.plugins=true --config features.apps=true",
491
+ launchArgs:
492
+ "--config features.plugins=true --config features.apps=true --config features.connectors=true",
493
requireArg:
493
- "--config features.plugins=true --config features.apps=true --config features.plugins=false --config features.apps=false --ephemeral",
494
+ "--config features.plugins=true --config features.apps=true --config features.connectors=true --config features.connectors=false --config features.plugins=false --config features.apps=false --ephemeral",
495
},
496
(textGeneration) =>
497
Effect.gen(function* () {
apps/server/src/textGeneration/CodexTextGeneration.ts
+3
@@ -40,7 +40,10 @@ import * as HostProcess from "@t3tools/shared/HostProcess";
40
const CODEX_TIMEOUT_MS = 180_000;
41
const CODEX_MCP_LIST_TIMEOUT_MS = 10_000;
42
// Plugins/apps add MCP servers; use trailing config overrides because --disable loses to user -c flags.
43
+// Codex also reads the legacy connectors key for apps.
44
const CODEX_NO_PLUGIN_ARGS = [
45
+ "--config",
46
+ "features.connectors=false",
47
"--config",
48
"features.plugins=false",
49
"--config",