@devries-cameron20 / t3code-1 / commits / 32f93dab3d
Fork 0

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

fix(server): shadow-home Codex instances keep bundled plugins (#23668)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: maria-rcks <maria@kuuro.net> Co-authored-by: Julius Marminge <julius0216@outlook.com>

barmatr committed Nov 19, 2026 at 06:58 UTC 32f93dab3dcdfe114229fb91983e72bc2bf976ea
4 files changed +87
apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts
+2
@@ -117,6 +117,7 @@ import {
117 toMcpElicitationResponse,
118 } from "../../provider/CodexMcpElicitation.ts";
119 import {
120 + codexHomeLaunchArgs,
121 materializeCodexShadowHome,
122 resolveCodexHomeLayout,
123 } from "../../provider/Drivers/CodexHomeLayout.ts";
@@ -1863,6 +1864,7 @@ export const createCodexAdapterV2 = Effect.fn("CodexAdapterV2.createCodexAdapter
1864 enabled,
1865 binaryPath: expandHomePath(config.binaryPath, yield* HostProcess.HomeDirectory),
1866 homePath: homeLayout.effectiveHomePath ?? "",
1867 + launchArgs: codexHomeLaunchArgs(yield* Path.Path, homeLayout, config.launchArgs),
1868 } satisfies CodexSettings;
1869
1870 return yield* makeCodexAdapterV2({
apps/server/src/provider/Drivers/CodexDriver.test.ts
+67
@@ -38,6 +38,7 @@ import {
38 createProviderVersionAdvisory,
39 resolveLatestProviderVersion,
40 } from "@t3tools/provider-core/server/maintenanceResolver";
41 +import { codexAppServerArgs } from "../codexLaunchArgs.ts";
42 import { CodexDriver } from "./CodexDriver.ts";
43 import * as CodexAdapterV2 from "../../orchestration-v2/Adapters/CodexAdapterV2.ts";
44 import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
@@ -379,6 +380,72 @@ it.layer(layerTest)("CodexDriver", (it) => {
380 }).pipe(Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, noSpawn)),
381 );
382
383 + it.effect("points a shadow home's bundled marketplace at the shadow CODEX_HOME", () =>
384 + Effect.gen(function* () {
385 + const fs = yield* FileSystem.FileSystem;
386 + const tempDir = yield* fs.makeTempDirectoryScoped({ prefix: "t3-codex-driver-" });
387 + const sharedHome = NodePath.join(tempDir, "codex home");
388 + const shadowHome = NodePath.join(tempDir, "codex shadow");
389 + const launches: Array<
390 + Parameters<CodexAdapterV2.CodexAppServerClientFactoryShape["open"]>[0]
391 + > = [];
392 + const instance = yield* CodexDriver.create({
393 + instanceId: ProviderInstanceId.make("codex-shadow"),
394 + displayName: "Codex test",
395 + enabled: false,
396 + environment: [],
397 + config: {
398 + ...CodexDriver.defaultConfig(),
399 + homePath: sharedHome,
400 + shadowHomePath: shadowHome,
401 + launchArgs: "-c model_auto_compact_token_limit=250000",
402 + },
403 + }).pipe(
404 + Effect.provideService(
405 + CodexAdapterV2.CodexAppServerClientFactory,
406 + CodexAdapterV2.CodexAppServerClientFactory.of({
407 + open: (launch) =>
408 + Effect.sync(() => launches.push(launch)).pipe(
409 + Effect.andThen(Effect.die("The fixture stops after recording the launch")),
410 + ),
411 + }),
412 + ),
413 + );
414 +
415 + yield* instance.orchestrationAdapter
416 + .openSession({
417 + threadId: ThreadId.make("shadow-home-thread"),
418 + providerSessionId: ProviderSessionId.make("shadow-home-session"),
419 + modelSelection: { instanceId: instance.instanceId, model: "gpt-5.4" },
420 + runtimePolicy: ProviderAdapter.ProviderAdapterV2RuntimePolicy.make({
421 + runtimeMode: "full-access",
422 + interactionMode: "default",
423 + cwd: tempDir,
424 + }),
425 + })
426 + .pipe(Effect.scoped, Effect.exit);
427 +
428 + expect(launches).toHaveLength(1);
429 + const settings = launches[0]!.settings;
430 + expect(settings.homePath).toBe(shadowHome);
431 + const bundledSource = NodePath.join(
432 + shadowHome,
433 + ".tmp",
434 + "bundled-marketplaces",
435 + "openai-bundled",
436 + );
437 + expect(codexAppServerArgs(settings.launchArgs)).toEqual([
438 + "app-server",
439 + "-c",
440 + "thread_unload_delay_secs=0",
441 + "-c",
442 + `marketplaces.openai-bundled.source=${JSON.stringify(bundledSource)}`,
443 + "-c",
444 + "model_auto_compact_token_limit=250000",
445 + ]);
446 + }).pipe(Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, noSpawn), Effect.scoped),
447 + );
448 +
449 it.effect.skipIf(windowsHost)(
450 "runs the standalone updater against the home that holds a shared install",
451 () =>
apps/server/src/provider/Drivers/CodexDriver.ts
+2
@@ -53,6 +53,7 @@ import {
53 } from "@t3tools/provider-core/server/snapshotSettings";
54 import {
55 codexContinuationIdentity,
56 + codexHomeLaunchArgs,
57 materializeCodexShadowHome,
58 resolveCodexHomeLayout,
59 } from "./CodexHomeLayout.ts";
@@ -219,6 +220,7 @@ export const CodexDriver: ProviderDriver<
220 enabled,
221 binaryPath: expandHomePath(config.binaryPath, yield* HostProcess.HomeDirectory),
222 homePath: homeLayout.effectiveHomePath ?? "",
223 + launchArgs: codexHomeLaunchArgs(pathService, homeLayout, config.launchArgs),
224 } satisfies CodexSettings;
225 const resolveInstallation = yield* makeCachedProviderMaintenanceResolution(
226 resolveProviderMaintenanceCapabilitiesEffect(
apps/server/src/provider/Drivers/CodexHomeLayout.ts
+16
@@ -71,6 +71,22 @@ export const resolveCodexHomeLayout = Effect.fn("resolveCodexHomeLayout")(functi
71 };
72 });
73
74 +// Codex accepts bundled plugins only from this path under CODEX_HOME. The shared
75 +// config names the original home, so shadow homes must override it through their .tmp link.
76 +const BUNDLED_MARKETPLACE = "openai-bundled";
77 +
78 +const quoteCliArg = (value: string) => `"${value.replace(/["\\$`]/g, "\\$&")}"`;
79 +
80 +export function codexHomeLaunchArgs(path: Path.Path, layout: CodexHomeLayout, launchArgs: string) {
81 + const homePath = layout.effectiveHomePath;
82 + if (layout.mode !== "authOverlay" || homePath === undefined) return launchArgs;
83 + const source = path.join(homePath, ".tmp", "bundled-marketplaces", BUNDLED_MARKETPLACE);
84 + const setting = `marketplaces.${BUNDLED_MARKETPLACE}.source=${JSON.stringify(source)}`;
85 + const override = `-c ${quoteCliArg(setting)}`;
86 + // User launch args come last so an explicit source still wins.
87 + return launchArgs.length > 0 ? `${override} ${launchArgs}` : override;
88 +}
89 +
90 const CodexShadowHomeContext = {
91 sharedHomePath: Schema.String,
92 effectiveHomePath: Schema.String,