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, 07:15 UTC
fix(server): codex text generation identifies as T3 Code (#38464)
Julius Marminge committed
Nov 17, 2026 at 23:01 UTC
a1b1a6388c33716d5909e63a48d3ccc67734452c
2 files changed
+22
-1
apps/server/src/textGeneration/CodexTextGeneration.test.ts
+20
@@ -59,6 +59,7 @@ interface FakeCodexInput {
59
requiredCwd?: string;
60
requireInstructions?: string;
61
requireMcpServersOff?: ReadonlyArray<string>;
62
+ requireOriginator?: string;
63
}
64
65
function makeFakeCodexBinary(dir: string, input: FakeCodexInput) {
@@ -75,6 +76,7 @@ function makeFakeCodexBinary(dir: string, input: FakeCodexInput) {
76
requiredCwd: input.requiredCwd ?? null,
77
requireInstructions: input.requireInstructions ?? null,
78
requireMcpServersOff: input.requireMcpServersOff ?? [],
79
+ requireOriginator: input.requireOriginator ?? null,
80
stderr: input.stderr ?? null,
81
output: input.output,
82
exitCode: input.exitCode ?? 0,
@@ -158,6 +160,9 @@ function makeFakeCodexBinary(dir: string, input: FakeCodexInput) {
160
"for (const name of check.requireMcpServersOff) {",
161
' if (!offServers.has(name)) fail("MCP server left on: " + name, 13);',
162
"}",
163
+ "if (check.requireOriginator !== null && process.env.CODEX_INTERNAL_ORIGINATOR_OVERRIDE !== check.requireOriginator) {",
164
+ ' fail("unexpected originator: " + process.env.CODEX_INTERNAL_ORIGINATOR_OVERRIDE, 14);',
165
+ "}",
166
'if (check.requiredCwd !== null && process.cwd() !== check.requiredCwd) fail("cannot inspect checkout", 10);',
167
'if (check.requireInstructions !== null && !instructions.includes(check.requireInstructions)) fail("missing writer task", 11);',
168
"if (check.requireArg !== null && !originalArgs.includes(` ${check.requireArg} `)) {",
@@ -519,6 +524,21 @@ it.layer(layerCodexTextGenerationTest)("CodexTextGeneration", (it) => {
524
),
525
);
526
527
+ it.effect("identifies codex exec as T3 Code", () =>
528
+ withFakeCodexEnv(
529
+ { output: JSON.stringify({ title: "Live title" }), requireOriginator: "T3 Code" },
530
+ (textGeneration) =>
531
+ Effect.gen(function* () {
532
+ const result = yield* textGeneration.generateThreadTitle({
533
+ cwd: process.cwd(),
534
+ message: "Name this thread",
535
+ modelSelection: DEFAULT_TEST_MODEL_SELECTION,
536
+ });
537
+ expect(result.title).toBe("Live title");
538
+ }),
539
+ ),
540
+ );
541
+
542
it.effect("passes exec-safe launch args into codex exec", () =>
543
withFakeCodexEnv(
544
{
apps/server/src/textGeneration/CodexTextGeneration.ts
+2
-1
@@ -23,6 +23,7 @@ import {
23
codexMcpListLaunchArgs,
24
resolveCodexLaunchArgs,
25
} from "../provider/codexLaunchArgs.ts";
26
+import { codexAppServerEnvironment } from "../provider/CodexProvider.ts";
27
import * as TextGenerationOperations from "@t3tools/provider-core/server/textGenerationOperations";
28
import {
29
normalizeCliError,
@@ -286,7 +287,7 @@ export const makeCodexTextGeneration = Effect.fn("makeCodexTextGeneration")(func
287
resolved || fellBack ? undefined : getCodexServiceTierOptionValue(modelSelection);
288
const binary = effectiveConfig.binaryPath || "codex";
289
const env = {
289
- ...effectiveEnvironment,
290
+ ...codexAppServerEnvironment(effectiveEnvironment),
291
...(effectiveConfig.homePath
292
? {
293
CODEX_HOME: expandHomePath(