fix(openai): refresh live prompt overlay config

This commit is contained in:
Vincent Koc
2026-04-22 23:36:22 -07:00
parent 938af16289
commit abb32e39b5
3 changed files with 48 additions and 6 deletions

View File

@@ -112,6 +112,7 @@ Docs: https://docs.openclaw.ai
- Active Memory: stop reviving removed live `active-memory` config from startup snapshots, so removing the plugin entry turns the hook off immediately instead of waiting for a restart. Thanks @vincentkoc.
- GitHub Copilot: re-read plugin discovery config from the live runtime snapshot, so toggling `plugins.entries.github-copilot.config.discovery.enabled` takes effect without a restart. Thanks @vincentkoc.
- 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.
- 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.

View File

@@ -563,6 +563,42 @@ describe("openai plugin", () => {
});
});
it("uses live plugin config for GPT-5 prompt overlay mode", async () => {
const { providers } = await registerOpenAIPluginWithHook({
pluginConfig: { personality: "off" },
});
const openaiProvider = requireRegisteredProvider(providers, "openai");
expect(
openaiProvider.resolveSystemPromptContribution?.({
config: {
plugins: {
entries: {
openai: {
config: {
personality: "friendly",
},
},
},
},
},
agentDir: undefined,
workspaceDir: undefined,
provider: "openai",
modelId: "gpt-5.4",
promptMode: "full",
runtimeChannel: undefined,
runtimeCapabilities: undefined,
agentId: undefined,
}),
).toEqual({
stablePrefix: OPENAI_GPT5_BEHAVIOR_CONTRACT,
sectionOverrides: {
interaction_style: OPENAI_FRIENDLY_PROMPT_OVERLAY,
},
});
});
it("treats on as an alias for the friendly prompt overlay", async () => {
const { providers } = await registerOpenAIPluginWithHook({
pluginConfig: { personality: "on" },

View File

@@ -1,3 +1,4 @@
import { resolvePluginConfigObject } from "openclaw/plugin-sdk/config-runtime";
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
import { buildProviderToolCompatFamilyHooks } from "openclaw/plugin-sdk/provider-tools";
import { buildOpenAICodexCliBackend } from "./cli-backend.js";
@@ -23,21 +24,25 @@ export default definePluginEntry({
name: "OpenAI Provider",
description: "Bundled OpenAI provider plugins",
register(api) {
const promptOverlayMode = resolveOpenAIPromptOverlayMode(api.pluginConfig);
const openAIToolCompatHooks = buildProviderToolCompatFamilyHooks("openai");
const buildProviderWithPromptContribution = <T extends ReturnType<typeof buildOpenAIProvider>>(
provider: T,
): T => ({
...provider,
...openAIToolCompatHooks,
resolveSystemPromptContribution: (ctx) =>
resolveOpenAISystemPromptContribution({
resolveSystemPromptContribution: (ctx) => {
const runtimePluginConfig = resolvePluginConfigObject(ctx.config, "openai");
const pluginConfig =
runtimePluginConfig ??
(ctx.config ? undefined : (api.pluginConfig as Record<string, unknown>));
return resolveOpenAISystemPromptContribution({
config: ctx.config,
legacyPluginConfig: api.pluginConfig,
mode: promptOverlayMode,
legacyPluginConfig: pluginConfig,
mode: resolveOpenAIPromptOverlayMode(pluginConfig),
modelProviderId: provider.id,
modelId: ctx.modelId,
}),
});
},
});
api.registerCliBackend(buildOpenAICodexCliBackend());
api.registerProvider(buildProviderWithPromptContribution(buildOpenAIProvider()));