From 24f1561530751cdee65a4a9f16f86d5988c9feda Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Sat, 7 Nov 2026 03:15:22 +0000 Subject: [PATCH 1/4] test(server): reproduce missing remote plugin skills in Codex probes (#32290) These tests reproduce #32290. The mock Codex app-server lists a remote marketplace plugin skill only after the client requests plugin/installed, as real Codex does while its remote plugin cache is cold. Both the per-cwd skills probe and the provider snapshot probe call skills/list straight after startup and so report no impeccable:impeccable skill. AI-assisted; verified with the tests and tools listed above. --- .../server/src/provider/CodexProvider.test.ts | 88 ++++++++++++++++++- .../testFixtures/codexCollabMockPeer.mjs | 20 +++++ 2 files changed, 107 insertions(+), 1 deletion(-) diff --git a/apps/server/src/provider/CodexProvider.test.ts b/apps/server/src/provider/CodexProvider.test.ts index 30f63b21f318e..b58cec787daae 100644 --- a/apps/server/src/provider/CodexProvider.test.ts +++ b/apps/server/src/provider/CodexProvider.test.ts @@ -1,6 +1,92 @@ +import * as NodeServices from "@effect/platform-node/NodeServices"; import { assert, it } from "@effect/vitest"; +import * as HostProcess from "@t3tools/shared/HostProcess"; +import * as Effect from "effect/Effect"; +import * as FileSystem from "effect/FileSystem"; +import * as Path from "effect/Path"; -import { applyPreferredCodexDefaultModel, mapCodexModelCapabilities } from "./CodexProvider.ts"; +import { + applyPreferredCodexDefaultModel, + checkCodexProviderStatus, + mapCodexModelCapabilities, + probeCodexSkillsForCwd, +} from "./CodexProvider.ts"; + +// The mock app-server is a shell script Windows cannot execute. +const windowsHost = HostProcess.Platform.defaultValue() === "win32"; + +const makeRemotePluginCodexFixture = Effect.fn("CodexProvider.test.makeRemotePluginCodexFixture")( + function* () { + const fileSystem = yield* FileSystem.FileSystem; + const path = yield* Path.Path; + const fixtureDir = yield* fileSystem.makeTempDirectoryScoped({ prefix: "t3-codex-skills-" }); + const sourceDir = path.join(import.meta.dirname, "testFixtures"); + const binaryPath = path.join(fixtureDir, "codex"); + const scriptPath = path.join(fixtureDir, "codex-script.json"); + yield* fileSystem.copyFile(path.join(sourceDir, "codexCollabMockPeer.sh"), binaryPath); + yield* fileSystem.chmod(binaryPath, 0o755); + for (const file of ["codexCollabMockPeer.mjs", "codexMultiAgentWire.json"]) { + yield* fileSystem.copyFile(path.join(sourceDir, file), path.join(fixtureDir, file)); + } + yield* fileSystem.writeFileString( + scriptPath, + JSON.stringify({ + rootThreadId: "probe-thread", + notifications: [], + remoteInstalledPluginSkills: [ + { + name: "impeccable:impeccable", + description: "Design review skill", + path: path.join(fixtureDir, "impeccable", "SKILL.md"), + enabled: true, + scope: "user", + pluginId: "impeccable@openai-curated-remote", + }, + ], + }), + ); + return { + binaryPath, + cwd: fixtureDir, + environment: { ...process.env, T3_CODEX_COLLAB_SCRIPT: scriptPath }, + }; + }, +); + +it.live.skipIf(windowsHost)("lists remote marketplace plugin skills for a workspace", () => + Effect.gen(function* () { + const fixture = yield* makeRemotePluginCodexFixture(); + const skills = yield* probeCodexSkillsForCwd(fixture); + + assert.deepStrictEqual( + skills.map((skill) => skill.name), + ["impeccable:impeccable"], + ); + }).pipe(Effect.scoped, Effect.provide(NodeServices.layer)), +); + +it.live.skipIf(windowsHost)("reports remote marketplace plugin skills in the Codex snapshot", () => + Effect.gen(function* () { + const fixture = yield* makeRemotePluginCodexFixture(); + const provider = yield* checkCodexProviderStatus( + { + enabled: true, + binaryPath: fixture.binaryPath, + homePath: "", + shadowHomePath: "", + launchArgs: "", + customModels: [], + }, + undefined, + fixture.environment, + ); + + assert.deepStrictEqual( + provider.skills.map((skill) => skill.name), + ["impeccable:impeccable"], + ); + }).pipe(Effect.scoped, Effect.provide(NodeServices.layer)), +); it("maps current Codex model capability fields", () => { const capabilities = mapCodexModelCapabilities({ diff --git a/apps/server/src/provider/testFixtures/codexCollabMockPeer.mjs b/apps/server/src/provider/testFixtures/codexCollabMockPeer.mjs index cae8ea2c9380d..bed8a93aa319b 100644 --- a/apps/server/src/provider/testFixtures/codexCollabMockPeer.mjs +++ b/apps/server/src/provider/testFixtures/codexCollabMockPeer.mjs @@ -12,6 +12,7 @@ const script = JSON.parse(NodeFS.readFileSync(process.env.T3_CODEX_COLLAB_SCRIPT const write = (message) => process.stdout.write(`${JSON.stringify(message)}\n`); let turnStartCount = 0; let activeTurn; +let remotePluginCacheLoaded = false; const openServerRequests = new Map(); const rl = NodeReadline.createInterface({ input: process.stdin }); rl.on("line", (line) => { @@ -84,6 +85,25 @@ rl.on("line", (line) => { write({ id, result: { outcome: script.resetCreditOutcome } }); return; } + if (method === "plugin/installed") { + remotePluginCacheLoaded = true; + write({ id, result: { marketplaces: [] } }); + return; + } + if (method === "skills/list" && script.remoteInstalledPluginSkills) { + // Like real Codex, remote marketplace plugin skills appear only once plugin/installed has filled its cache. + write({ + id, + result: { + data: message.params.cwds.map((cwd) => ({ + cwd, + errors: [], + skills: remotePluginCacheLoaded ? script.remoteInstalledPluginSkills : [], + })), + }, + }); + return; + } if (method === "skills/list" || method === "model/list") { write({ id, result: { data: [] } }); return; From aad1d6a2ef553ad1e20fc95033994e8dd79d522c Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Sat, 7 Nov 2026 03:19:47 +0000 Subject: [PATCH 2/4] fix(server): Codex skill probes include remote marketplace plugin skills A fresh codex app-server loads its remote marketplace plugin inventory in the background, so the skills/list call T3 makes straight after startup leaves out skills from plugins such as impeccable@openai-curated-remote. Both the workspace skills probe and the provider snapshot probe now ask for plugin/installed first, which waits for that inventory, then list skills. The plugin/installed call is best-effort and capped at 5 seconds inside the existing discovery deadline, so an older Codex, an error or a slow answer still leaves the skill list, account and models intact. Fixes pingdotgg/t3code#32290 AI-assisted; verified with the tests and tools listed above. --- apps/server/src/provider/CodexProvider.ts | 34 +++++++++++++++++++++-- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/apps/server/src/provider/CodexProvider.ts b/apps/server/src/provider/CodexProvider.ts index 2d546b36a9b15..1b4655c457a56 100644 --- a/apps/server/src/provider/CodexProvider.ts +++ b/apps/server/src/provider/CodexProvider.ts @@ -72,6 +72,7 @@ type CodexRateLimitsProbe = const CODEX_APP_SERVER_PROBE_FORCE_KILL_AFTER = "2 seconds" as const; const CODEX_CATALOG_REFRESH_TIMEOUT_MS = 3_000; const CODEX_CONFIG_PROBE_TIMEOUT_MS = 3_000; +const CODEX_INSTALLED_PLUGINS_TIMEOUT_MS = 5_000; const CODEX_CATALOG_REFRESH_POLL = "100 millis" as const; const CODEX_CLIENT_NAME = "T3 Code"; // Handshake plus account/models/skills requests can exceed the shared 10s probe budget. @@ -448,6 +449,29 @@ const requestCodexChatGptModels = Effect.fn("requestCodexChatGptModels")(functio ); }); +/** + * A fresh app-server fills its remote plugin inventory in the background, and + * skills/list omits those plugins' skills until it lands. plugin/installed + * awaits that fetch, so ask for it first and treat it as best-effort. + */ +const requestCodexSkills = Effect.fn("requestCodexSkills")(function* (input: { + readonly client: CodexClient.CodexAppServerClient["Service"]; + readonly cwd: string; + readonly deadlineMs: number; +}) { + yield* withCodexDiscoveryDeadline( + input.client.request("plugin/installed", { cwds: [input.cwd] }), + input.deadlineMs, + CODEX_INSTALLED_PLUGINS_TIMEOUT_MS, + ).pipe( + Effect.catch((cause) => Effect.logDebug("Codex installed plugin read failed.", { cause })), + ); + return yield* withCodexDiscoveryDeadline( + input.client.request("skills/list", { cwds: [input.cwd] }), + input.deadlineMs, + ); +}); + /** Set originator at spawn; the pre-initialize refresh otherwise overwrites shared cache with plain-CLI models. */ export const codexAppServerEnvironment = ( environment: NodeJS.ProcessEnv | undefined, @@ -553,7 +577,7 @@ const probeCodexAppServerProvider = Effect.fn("probeCodexAppServerProvider")(fun const deadlineMs = spawnedAtMs + CODEX_AUTH_PROBE_TIMEOUT_MS - CODEX_DISCOVERY_MARGIN_MS; const [skillsResponse, models, serviceTier, rateLimits] = yield* Effect.all( [ - withCodexDiscoveryDeadline(client.request("skills/list", { cwds: [input.cwd] }), deadlineMs), + requestCodexSkills({ client, cwd: input.cwd, deadlineMs }), accountResponse.account?.type === "chatgpt" ? requestCodexChatGptModels({ client, @@ -651,8 +675,12 @@ export const probeCodexSkillsForCwd = Effect.fn("probeCodexSkillsForCwd")(functi readonly environment?: NodeJS.ProcessEnv; }) { const { client } = yield* withCodexAppServerClient(input); - const skillsResponse = yield* client.request("skills/list", { cwds: [input.cwd] }); - return parseCodexSkillsListResponse(skillsResponse, input.cwd); + const skillsResponse = yield* requestCodexSkills({ + client, + cwd: input.cwd, + deadlineMs: Infinity, + }); + return skillsResponse ? parseCodexSkillsListResponse(skillsResponse, input.cwd) : []; }); const emptyCodexModelsFromSettings = (codexSettings: CodexSettings): ServerProvider["models"] => From 86d5e5cf65b31740bfe3fd7ed6067cd9832a914a Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Sat, 7 Nov 2026 03:26:44 +0000 Subject: [PATCH 3/4] docs(server): clarify why Codex skill probes request plugin/installed first --- apps/server/src/provider/CodexProvider.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/server/src/provider/CodexProvider.ts b/apps/server/src/provider/CodexProvider.ts index 1b4655c457a56..e356a77fe01e2 100644 --- a/apps/server/src/provider/CodexProvider.ts +++ b/apps/server/src/provider/CodexProvider.ts @@ -452,7 +452,7 @@ const requestCodexChatGptModels = Effect.fn("requestCodexChatGptModels")(functio /** * A fresh app-server fills its remote plugin inventory in the background, and * skills/list omits those plugins' skills until it lands. plugin/installed - * awaits that fetch, so ask for it first and treat it as best-effort. + * fetches and caches it when empty, so ask for it first, best-effort. */ const requestCodexSkills = Effect.fn("requestCodexSkills")(function* (input: { readonly client: CodexClient.CodexAppServerClient["Service"]; From cb041a9f095f9a08ca633409080e570bdd5c46a4 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Tue, 10 Nov 2026 20:48:53 +0000 Subject: [PATCH 4/4] test(server): keep one Codex remote plugin skill probe test AI-assisted; verified with the tests and tools listed above. --- .../server/src/provider/CodexProvider.test.ts | 24 ------------------- 1 file changed, 24 deletions(-) diff --git a/apps/server/src/provider/CodexProvider.test.ts b/apps/server/src/provider/CodexProvider.test.ts index b58cec787daae..1665c9f2232a5 100644 --- a/apps/server/src/provider/CodexProvider.test.ts +++ b/apps/server/src/provider/CodexProvider.test.ts @@ -7,7 +7,6 @@ import * as Path from "effect/Path"; import { applyPreferredCodexDefaultModel, - checkCodexProviderStatus, mapCodexModelCapabilities, probeCodexSkillsForCwd, } from "./CodexProvider.ts"; @@ -65,29 +64,6 @@ it.live.skipIf(windowsHost)("lists remote marketplace plugin skills for a worksp }).pipe(Effect.scoped, Effect.provide(NodeServices.layer)), ); -it.live.skipIf(windowsHost)("reports remote marketplace plugin skills in the Codex snapshot", () => - Effect.gen(function* () { - const fixture = yield* makeRemotePluginCodexFixture(); - const provider = yield* checkCodexProviderStatus( - { - enabled: true, - binaryPath: fixture.binaryPath, - homePath: "", - shadowHomePath: "", - launchArgs: "", - customModels: [], - }, - undefined, - fixture.environment, - ); - - assert.deepStrictEqual( - provider.skills.map((skill) => skill.name), - ["impeccable:impeccable"], - ); - }).pipe(Effect.scoped, Effect.provide(NodeServices.layer)), -); - it("maps current Codex model capability fields", () => { const capabilities = mapCodexModelCapabilities({ additionalSpeedTiers: [],