From 526a8bdc3ff3f7239daf14b7d6ef7c0527c0803b Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Wed, 22 Apr 2026 23:51:55 -0700 Subject: [PATCH] fix(codex): refresh live discovery config --- CHANGELOG.md | 1 + extensions/codex/provider.test.ts | 46 +++++++++++++++++++++++++++++++ extensions/codex/provider.ts | 12 +++++--- 3 files changed, 55 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c14252a5ef5..e84868f6a4d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -114,6 +114,7 @@ Docs: https://docs.openclaw.ai - Ollama: re-read plugin discovery config from the live runtime snapshot, so toggling `plugins.entries.ollama.config.discovery.enabled` takes effect without a restart. Thanks @vincentkoc. - OpenAI: re-read the plugin prompt-overlay personality from live runtime config, so GPT-5 system prompt contributions update without a restart when `plugins.entries.openai.config.personality` changes. Thanks @vincentkoc. - Amazon Bedrock: re-read live discovery and guardrail plugin config, so toggling `plugins.entries.amazon-bedrock.config.discovery` or `plugins.entries.amazon-bedrock.config.guardrail` takes effect without a restart. Thanks @vincentkoc. +- Codex: re-read the plugin discovery config from the live runtime snapshot, so toggling `plugins.entries.codex.config.discovery` takes effect without a restart. Thanks @vincentkoc. - Agents/subagents: drop bare `NO_REPLY` from the parent turn when the session still has pending spawned children, so direct-conversation surfaces such as Telegram DMs no longer rewrite the sentinel into visible fallback chatter while waiting for the child completion event. (#69942) Thanks @neeravmakwana. - Plugins/install: keep bundled plugin dependencies off npm install while repairing them when plugins activate from a packaged install, including Feishu/Lark, Browser, and direct bundled channel setup-entry loads. - CLI/channels: skip and cache bundled channel plugin, setup, and secrets load failures during read-only discovery, so one broken unused bundled channel cannot crash `openclaw status` or bootstrap secret scans. diff --git a/extensions/codex/provider.test.ts b/extensions/codex/provider.test.ts index 44c75b11dc5..773cc569c7e 100644 --- a/extensions/codex/provider.test.ts +++ b/extensions/codex/provider.test.ts @@ -91,6 +91,52 @@ describe("codex provider", () => { expectStaticFallbackCatalog(result); }); + it("uses live plugin config to re-enable discovery after startup disable", async () => { + const listModels = vi.fn(async () => ({ + models: [ + { + id: "gpt-5.4", + model: "gpt-5.4", + displayName: "gpt-5.4", + hidden: false, + inputModalities: ["text", "image"], + supportedReasoningEfforts: ["low", "medium", "high", "xhigh"], + }, + ], + })); + const provider = buildCodexProvider({ + pluginConfig: { discovery: { enabled: false } }, + listModels, + }); + + const result = await provider.catalog?.run({ + config: { + plugins: { + entries: { + codex: { + config: { + discovery: { + enabled: true, + timeoutMs: 4321, + }, + }, + }, + }, + }, + }, + env: {}, + } as never); + + expect(listModels).toHaveBeenCalledWith( + expect.objectContaining({ limit: 100, timeoutMs: 4321, sharedClient: false }), + ); + expect(result).toMatchObject({ + provider: { + models: [{ id: "gpt-5.4" }], + }, + }); + }); + it("keeps a static fallback catalog when live discovery is explicitly disabled by env", async () => { const listModels = vi.fn(); diff --git a/extensions/codex/provider.ts b/extensions/codex/provider.ts index 59e3cb45356..6e8e1b40a1f 100644 --- a/extensions/codex/provider.ts +++ b/extensions/codex/provider.ts @@ -1,3 +1,4 @@ +import { resolvePluginConfigObject } from "openclaw/plugin-sdk/config-runtime"; import type { ProviderRuntimeModel } from "openclaw/plugin-sdk/plugin-entry"; import { normalizeModelCompat, @@ -52,12 +53,15 @@ export function buildCodexProvider(options: BuildCodexProviderOptions = {}): Pro auth: [], catalog: { order: "late", - run: async (ctx) => - buildCodexProviderCatalog({ + run: async (ctx) => { + const runtimePluginConfig = resolvePluginConfigObject(ctx.config, CODEX_PROVIDER_ID); + const pluginConfig = runtimePluginConfig ?? (ctx.config ? undefined : options.pluginConfig); + return await buildCodexProviderCatalog({ env: ctx.env, - pluginConfig: options.pluginConfig, + pluginConfig, listModels: options.listModels, - }), + }); + }, }, staticCatalog: { order: "late",