惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

罗磊的独立博客
L
LangChain Blog
aimingoo的专栏
aimingoo的专栏
IT之家
IT之家
B
Blog
博客园_首页
博客园 - 司徒正美
有赞技术团队
有赞技术团队
博客园 - 聂微东
I
InfoQ
美团技术团队
GbyAI
GbyAI
阮一峰的网络日志
阮一峰的网络日志
H
Help Net Security
大猫的无限游戏
大猫的无限游戏
MyScale Blog
MyScale Blog
WordPress大学
WordPress大学
The GitHub Blog
The GitHub Blog
A
About on SuperTechFans
人人都是产品经理
人人都是产品经理
Microsoft Azure Blog
Microsoft Azure Blog
Engineering at Meta
Engineering at Meta
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
The Cloudflare Blog

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix: prefer OpenAI media for Codex defaults · openclaw/op...
steipete · 2026-04-28 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -14,6 +14,7 @@ Docs: https://docs.openclaw.ai

1414

### Fixes

1515
1616

- Agents/media: register detached `video_generate` and `music_generate` tool run contexts until terminal status, so Discord-backed provider jobs stay live in `/tasks` instead of becoming `lost` when the parent chat run context disappears. Thanks @vincentkoc.

17+

- Agents/media: prefer OpenAI image and video providers when the default model uses the OpenAI Codex auth alias, so auto media generation no longer falls through to Fal before GPT Image or Sora. Thanks @vincentkoc.

1718

- Tasks/media: infer agent ownership for session-scoped task records so `/tasks` agent-local fallback includes session-backed `video_generate` and other async media jobs even when the current chat session has no linked rows. Thanks @vincentkoc.

1819

- Agents/media: keep long-running `video_generate` and `music_generate` tasks fresh while provider jobs are still pending, so task maintenance does not mark active Discord media renders lost before completion. Thanks @vincentkoc.

1920

- CLI/status: treat scope-limited gateway probes as reachable-but-degraded in shared status scans, so `openclaw status --all` no longer reports a live gateway as unreachable after `missing scope: operator.read`. Fixes #49180; supersedes #47981. Thanks @openjay.

Original file line numberDiff line numberDiff line change

@@ -194,6 +194,7 @@ describe("openai image generation provider", () => {

194194

const provider = buildOpenAIImageGenerationProvider();

195195
196196

expect(provider.defaultModel).toBe("gpt-image-2");

197+

expect(provider.aliases).toContain("openai-codex");

197198

expect(provider.models).toEqual([

198199

"gpt-image-2",

199200

"gpt-image-1.5",

Original file line numberDiff line numberDiff line change

@@ -537,6 +537,7 @@ function createOpenAIImageGenerationProviderBase(params: {

537537

}): ImageGenerationProvider {

538538

return {

539539

id: params.id,

540+

aliases: ["openai-codex"],

540541

label: params.label,

541542

defaultModel: DEFAULT_OPENAI_IMAGE_MODEL,

542543

models: [...OPENAI_IMAGE_MODELS],

Original file line numberDiff line numberDiff line change

@@ -17,6 +17,12 @@ beforeAll(async () => {

1717

installProviderHttpMockCleanup();

1818
1919

describe("openai video generation provider", () => {

20+

it("declares the openai-codex alias for default-model ordering", () => {

21+

const provider = buildOpenAIVideoGenerationProvider();

22+
23+

expect(provider.aliases).toContain("openai-codex");

24+

});

25+
2026

it("declares explicit mode capabilities", () => {

2127

expectExplicitVideoGenerationCapabilities(buildOpenAIVideoGenerationProvider());

2228

});

Original file line numberDiff line numberDiff line change

@@ -180,6 +180,7 @@ async function downloadOpenAIVideo(params: {

180180

export function buildOpenAIVideoGenerationProvider(): VideoGenerationProvider {

181181

return {

182182

id: "openai",

183+

aliases: ["openai-codex"],

183184

label: "OpenAI",

184185

defaultModel: DEFAULT_OPENAI_VIDEO_MODEL,

185186

models: [DEFAULT_OPENAI_VIDEO_MODEL, "sora-2-pro"],

Original file line numberDiff line numberDiff line change

@@ -339,6 +339,55 @@ describe("createImageGenerateTool", () => {

339339

});

340340

});

341341
342+

it("prefers OpenAI image generation when the default model uses its Codex provider alias", () => {

343+

vi.spyOn(imageGenerationRuntime, "listRuntimeImageGenerationProviders").mockReturnValue([

344+

{

345+

id: "fal",

346+

defaultModel: "fal-ai/flux/dev",

347+

models: ["fal-ai/flux/dev"],

348+

isConfigured: () => true,

349+

capabilities: {

350+

generate: { maxCount: 4 },

351+

edit: { enabled: true, maxInputImages: 1 },

352+

},

353+

generateImage: vi.fn(async () => {

354+

throw new Error("not used");

355+

}),

356+

},

357+

{

358+

id: "openai",

359+

aliases: ["openai-codex"],

360+

defaultModel: "gpt-image-2",

361+

models: ["gpt-image-2"],

362+

isConfigured: () => true,

363+

capabilities: {

364+

generate: { maxCount: 4 },

365+

edit: { enabled: true, maxInputImages: 5 },

366+

},

367+

generateImage: vi.fn(async () => {

368+

throw new Error("not used");

369+

}),

370+

},

371+

]);

372+
373+

expect(

374+

resolveImageGenerationModelConfigForTool({

375+

cfg: {

376+

agents: {

377+

defaults: {

378+

model: {

379+

primary: "openai-codex/gpt-5.5",

380+

},

381+

},

382+

},

383+

},

384+

}),

385+

).toEqual({

386+

primary: "openai/gpt-image-2",

387+

fallbacks: ["fal/fal-ai/flux/dev"],

388+

});

389+

});

390+
342391

it("prefers the primary model provider when multiple image providers have auth", () => {

343392

stubImageGenerationProviders();

344393

vi.stubEnv("OPENAI_API_KEY", "openai-test");

Original file line numberDiff line numberDiff line change

@@ -192,7 +192,7 @@ export function resolveCapabilityModelCandidatesForTool(params: {

192192

agentDir?: string;

193193

providers: CapabilityProvider[];

194194

}): string[] {

195-

const providerDefaults = new Map<string, string>();

195+

const providerDefaults = new Map<string, { ref: string; aliases: string[] }>();

196196

for (const provider of params.providers) {

197197

const providerId = provider.id.trim();

198198

const modelId = provider.defaultModel?.trim();

@@ -209,25 +209,36 @@ export function resolveCapabilityModelCandidatesForTool(params: {

209209

) {

210210

continue;

211211

}

212-

providerDefaults.set(providerId, `${providerId}/${modelId}`);

212+

const aliases = (provider.aliases ?? []).flatMap((alias) => {

213+

const normalized = normalizeProviderId(alias);

214+

return normalized ? [normalized] : [];

215+

});

216+

providerDefaults.set(providerId, { ref: `${providerId}/${modelId}`, aliases });

213217

}

214218
215219

const primaryProvider = resolveDefaultModelRef(params.cfg).provider;

220+

const normalizedPrimaryProvider = normalizeProviderId(primaryProvider);

221+

const providerIds = [...providerDefaults.keys()].toSorted();

222+

const matchesPrimaryProvider = (providerId: string): boolean => {

223+

const entry = providerDefaults.get(providerId);

224+

return (

225+

normalizeProviderId(providerId) === normalizedPrimaryProvider ||

226+

(entry?.aliases ?? []).includes(normalizedPrimaryProvider)

227+

);

228+

};

216229

const orderedProviders = [

217-

primaryProvider,

218-

...[...providerDefaults.keys()]

219-

.filter((providerId) => providerId !== primaryProvider)

220-

.toSorted(),

230+

...providerIds.filter(matchesPrimaryProvider),

231+

...providerIds.filter((providerId) => !matchesPrimaryProvider(providerId)),

221232

];

222233

const orderedRefs: string[] = [];

223234

const seen = new Set<string>();

224235

for (const providerId of orderedProviders) {

225-

const ref = providerDefaults.get(providerId);

226-

if (!ref || seen.has(ref)) {

236+

const entry = providerDefaults.get(providerId);

237+

if (!entry || seen.has(entry.ref)) {

227238

continue;

228239

}

229-

seen.add(ref);

230-

orderedRefs.push(ref);

240+

seen.add(entry.ref);

241+

orderedRefs.push(entry.ref);

231242

}

232243

return orderedRefs;

233244

}

Original file line numberDiff line numberDiff line change

@@ -5,7 +5,10 @@ import * as mediaStore from "../../media/store.js";

55

import * as webMedia from "../../media/web-media.js";

66

import * as videoGenerationRuntime from "../../video-generation/runtime.js";

77

import * as videoGenerateBackground from "./video-generate-background.js";

8-

import { createVideoGenerateTool } from "./video-generate-tool.js";

8+

import {

9+

createVideoGenerateTool,

10+

resolveVideoGenerationModelConfigForTool,

11+

} from "./video-generate-tool.js";

912
1013

const taskRuntimeInternalMocks = vi.hoisted(() => ({

1114

listTasksForOwnerKey: vi.fn(),

@@ -110,6 +113,45 @@ describe("createVideoGenerateTool", () => {

110113

).not.toBeNull();

111114

});

112115
116+

it("orders auto-detected provider defaults by canonical aliases", () => {

117+

vi.spyOn(videoGenerationRuntime, "listRuntimeVideoGenerationProviders").mockReturnValue([

118+

{

119+

id: "fal",

120+

defaultModel: "fal-ai/minimax/video-01-live",

121+

models: ["fal-ai/minimax/video-01-live"],

122+

capabilities: {},

123+

isConfigured: () => true,

124+

generateVideo: vi.fn(async () => ({ videos: [] })),

125+

},

126+

{

127+

id: "openai",

128+

aliases: ["openai-codex"],

129+

defaultModel: "sora-2",

130+

models: ["sora-2"],

131+

capabilities: {},

132+

isConfigured: () => true,

133+

generateVideo: vi.fn(async () => ({ videos: [] })),

134+

},

135+

]);

136+
137+

expect(

138+

resolveVideoGenerationModelConfigForTool({

139+

cfg: asConfig({

140+

agents: {

141+

defaults: {

142+

model: {

143+

primary: "openai-codex/gpt-5.5",

144+

},

145+

},

146+

},

147+

}),

148+

}),

149+

).toEqual({

150+

primary: "openai/sora-2",

151+

fallbacks: ["fal/fal-ai/minimax/video-01-live"],

152+

});

153+

});

154+
113155

it("generates videos, saves them, and emits MEDIA paths without a session-backed detach", async () => {

114156

taskExecutorMocks.createRunningTaskRun.mockReturnValue({

115157

taskId: "task-123",

Original file line numberDiff line numberDiff line change

@@ -95,6 +95,40 @@ describe("media-generation runtime shared candidates", () => {

9595

]);

9696

});

9797
98+

it("orders auto-detected provider defaults by canonical aliases", () => {

99+

const candidates = resolveCapabilityModelCandidates({

100+

cfg: {

101+

agents: {

102+

defaults: {

103+

model: {

104+

primary: "openai-codex/gpt-5.5",

105+

},

106+

},

107+

},

108+

} as OpenClawConfig,

109+

modelConfig: undefined,

110+

parseModelRef,

111+

listProviders: () => [

112+

{

113+

id: "fal",

114+

defaultModel: "fal-ai/flux/dev",

115+

isConfigured: () => true,

116+

},

117+

{

118+

id: "openai",

119+

aliases: ["openai-codex"],

120+

defaultModel: "gpt-image-2",

121+

isConfigured: () => true,

122+

},

123+

],

124+

});

125+
126+

expect(candidates).toEqual([

127+

{ provider: "openai", model: "gpt-image-2" },

128+

{ provider: "fal", model: "fal-ai/flux/dev" },

129+

]);

130+

});

131+
98132

it("disables implicit provider expansion when mediaGenerationAutoProviderFallback=false", () => {

99133

const candidates = resolveCapabilityModelCandidates({

100134

cfg: {

Original file line numberDiff line numberDiff line change

@@ -62,6 +62,7 @@ const IMAGE_RESOLUTION_ORDER = ["1K", "2K", "4K"] as const;

6262
6363

type CapabilityProviderCandidate = {

6464

id: string;

65+

aliases?: readonly string[];

6566

defaultModel?: string | null;

6667

isConfigured?: (ctx: { cfg?: OpenClawConfig; agentDir?: string }) => boolean;

6768

};

@@ -122,7 +123,7 @@ function resolveAutoCapabilityFallbackRefs(params: {

122123

agentDir?: string;

123124

listProviders: (cfg?: OpenClawConfig) => CapabilityProviderCandidate[];

124125

}): string[] {

125-

const providerDefaults = new Map<string, string>();

126+

const providerDefaults = new Map<string, { ref: string; aliases: string[] }>();

126127

for (const provider of params.listProviders(params.cfg)) {

127128

const providerId = normalizeOptionalString(provider.id);

128129

const modelId = normalizeOptionalString(provider.defaultModel);

@@ -138,19 +139,26 @@ function resolveAutoCapabilityFallbackRefs(params: {

138139

) {

139140

continue;

140141

}

141-

providerDefaults.set(providerId, `${providerId}/${modelId}`);

142+

const aliases = (provider.aliases ?? []).flatMap((alias) => {

143+

const normalized = normalizeOptionalString(alias);

144+

return normalized ? [normalized] : [];

145+

});

146+

providerDefaults.set(providerId, { ref: `${providerId}/${modelId}`, aliases });

142147

}

143148
144149

const defaultProvider = resolveCurrentDefaultProviderId(params.cfg);

150+

const providerIds = [...providerDefaults.keys()].toSorted();

151+

const matchesDefaultProvider = (providerId: string): boolean => {

152+

const entry = providerDefaults.get(providerId);

153+

return providerId === defaultProvider || (entry?.aliases ?? []).includes(defaultProvider);

154+

};

145155

const orderedProviders = [

146-

defaultProvider,

147-

...[...providerDefaults.keys()]

148-

.filter((providerId) => providerId !== defaultProvider)

149-

.toSorted(),

156+

...providerIds.filter(matchesDefaultProvider),

157+

...providerIds.filter((providerId) => !matchesDefaultProvider(providerId)),

150158

];

151159

return orderedProviders.flatMap((providerId) => {

152-

const ref = providerDefaults.get(providerId);

153-

return ref ? [ref] : [];

160+

const entry = providerDefaults.get(providerId);

161+

return entry ? [entry.ref] : [];

154162

});

155163

}

156164