@devries-cameron20 / t3code-1 / commits / e9d8ac5673
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(server): skip user hooks in Codex text generation (#35203)

Co-authored-by: Nathan Wong <20381195+thelogicmatrix@users.noreply.github.com> Co-authored-by: Julius Marminge <julius0216@outlook.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Nathan Wong committed Nov 15, 2026 at 12:47 UTC e9d8ac5673c54ddfb4efda196ee7ebaae15208c9
4 files changed +45 -2
apps/server/src/provider/codexLaunchArgs.test.ts
+9
@@ -38,6 +38,15 @@ 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 + );
48 + });
49 +
50 it("does not pair value-taking flags with adjacent flags", () => {
51 NodeAssert.deepStrictEqual(codexExecLaunchArgs("--config --strict-config --enable --disable"), [
52 "--strict-config",
apps/server/src/provider/codexLaunchArgs.ts
+11 -2
@@ -62,8 +62,17 @@ const filterLaunchArgs = (launchArgs: string | undefined, allowed: LaunchArgFilt
62 return kept;
63 };
64
65 -export const codexExecLaunchArgs = (launchArgs?: string) =>
66 - filterLaunchArgs(launchArgs, EXEC_FILTER);
65 +const HOOK_FEATURES = new Set(["hooks", "codex_hooks"]);
66 +
67 +// Feature toggles beat config overrides, so a launch arg's hook enable would undo ours.
68 +export const codexExecLaunchArgs = (launchArgs?: string) => {
69 + const args = filterLaunchArgs(launchArgs, EXEC_FILTER);
70 + return args.filter((arg, index) => {
71 + if (arg.startsWith("--enable=")) return !HOOK_FEATURES.has(arg.slice("--enable=".length));
72 + if (arg === "--enable") return !HOOK_FEATURES.has(args[index + 1] ?? "");
73 + return !(args[index - 1] === "--enable" && HOOK_FEATURES.has(arg));
74 + });
75 +};
76
77 export const codexMcpListLaunchArgs = (launchArgs?: string) =>
78 filterLaunchArgs(launchArgs, MCP_LIST_FILTER);
apps/server/src/textGeneration/CodexTextGeneration.test.ts
+20
@@ -499,6 +499,26 @@ it.layer(layerCodexTextGenerationTest)("CodexTextGeneration", (it) => {
499 ),
500 );
501
502 + it.effect("keeps user hooks off over launch args that turn them on", () =>
503 + withFakeCodexEnv(
504 + {
505 + output: JSON.stringify({ title: "Hookless title" }),
506 + launchArgs: "--config features.hooks=true --enable hooks",
507 + requireArg: "--config features.codex_hooks=false --config features.hooks=false",
508 + forbidArg: "--enable",
509 + },
510 + (textGeneration) =>
511 + Effect.gen(function* () {
512 + const result = yield* textGeneration.generateThreadTitle({
513 + cwd: process.cwd(),
514 + message: "Describe this change",
515 + modelSelection: DEFAULT_TEST_MODEL_SELECTION,
516 + });
517 + expect(result.title).toBe("Hookless title");
518 + }),
519 + ),
520 + );
521 +
522 it.effect("passes exec-safe launch args into codex exec", () =>
523 withFakeCodexEnv(
524 {
apps/server/src/textGeneration/CodexTextGeneration.ts
+5
@@ -326,6 +326,11 @@ export const makeCodexTextGeneration = Effect.fn("makeCodexTextGeneration")(func
326 model,
327 "--config",
328 `model_reasoning_effort="${reasoningEffort}"`,
329 + // Current Codex gives hooks precedence over the historical codex_hooks alias.
330 + "--config",
331 + "features.codex_hooks=false",
332 + "--config",
333 + "features.hooks=false",
334 ...(serviceTier ? ["--config", `service_tier="${serviceTier}"`] : []),
335 "--output-schema",
336 schemaPath,