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

推荐订阅源

U
Unit 42
Google DeepMind News
Google DeepMind News
Stack Overflow Blog
Stack Overflow Blog
H
Help Net Security
MongoDB | Blog
MongoDB | Blog
I
InfoQ
N
Netflix TechBlog - Medium
T
Tailwind CSS Blog
量子位
博客园 - 叶小钗
月光博客
月光博客
IT之家
IT之家
G
Google Developers Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
小众软件
小众软件
S
SegmentFault 最新的问题
Engineering at Meta
Engineering at Meta
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
aimingoo的专栏
aimingoo的专栏
云风的 BLOG
云风的 BLOG
Vercel News
Vercel News
爱范儿
爱范儿
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
宝玉的分享
宝玉的分享

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(minimax): bound video control response reads (#96889)...
Alix-007 · 2026-06-28 · via Recent Commits to openclaw:main

@@ -61,6 +61,24 @@ function streamedVideoResponse(bytes: string): Response {

6161

);

6262

}

636364+

function jsonResponse(payload: unknown): Response {

65+

return new Response(JSON.stringify(payload), {

66+

headers: { "content-type": "application/json" },

67+

});

68+

}

69+70+

function oversizedJsonResponse(): Response {

71+

return new Response(

72+

new ReadableStream({

73+

pull(controller) {

74+

controller.enqueue(new Uint8Array(1024 * 1024).fill(0x20));

75+

},

76+

cancel: vi.fn(),

77+

}),

78+

{ headers: { "content-type": "application/json" } },

79+

);

80+

}

81+6482

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

6583

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

6684

const provider = buildMinimaxVideoGenerationProvider();

@@ -71,24 +89,22 @@ describe("minimax video generation provider", () => {

71897290

it("creates a task, polls status, and downloads the generated video", async () => {

7391

postJsonRequestMock.mockResolvedValue({

74-

response: {

75-

json: async () => ({

76-

task_id: "task-123",

77-

base_resp: { status_code: 0 },

78-

}),

79-

},

92+

response: jsonResponse({

93+

task_id: "task-123",

94+

base_resp: { status_code: 0 },

95+

}),

8096

release: vi.fn(async () => {}),

8197

});

8298

fetchWithTimeoutMock

83-

.mockResolvedValueOnce({

84-

json: async () => ({

99+

.mockResolvedValueOnce(

100+

jsonResponse({

85101

task_id: "task-123",

86102

status: "Success",

87103

video_url: "https://example.com/out.mp4",

88104

file_id: "file-1",

89105

base_resp: { status_code: 0 },

90106

}),

91-

})

107+

)

92108

.mockResolvedValueOnce({

93109

headers: new Headers({ "content-type": "video/webm" }),

94110

arrayBuffer: async () => Buffer.from("webm-bytes"),

@@ -117,23 +133,21 @@ describe("minimax video generation provider", () => {

117133118134

it("rejects generated video downloads that exceed the configured media cap", async () => {

119135

postJsonRequestMock.mockResolvedValue({

120-

response: {

121-

json: async () => ({

122-

task_id: "task-too-large",

123-

base_resp: { status_code: 0 },

124-

}),

125-

},

136+

response: jsonResponse({

137+

task_id: "task-too-large",

138+

base_resp: { status_code: 0 },

139+

}),

126140

release: vi.fn(async () => {}),

127141

});

128142

fetchWithTimeoutMock

129-

.mockResolvedValueOnce({

130-

json: async () => ({

143+

.mockResolvedValueOnce(

144+

jsonResponse({

131145

task_id: "task-too-large",

132146

status: "Success",

133147

video_url: "https://example.com/too-large.mp4",

134148

base_resp: { status_code: 0 },

135149

}),

136-

})

150+

)

137151

.mockResolvedValueOnce(streamedVideoResponse("too-large"));

138152139153

const provider = buildMinimaxVideoGenerationProvider();

@@ -149,33 +163,31 @@ describe("minimax video generation provider", () => {

149163150164

it("downloads via file_id when the status response omits video_url", async () => {

151165

postJsonRequestMock.mockResolvedValue({

152-

response: {

153-

json: async () => ({

154-

task_id: "task-456",

155-

base_resp: { status_code: 0 },

156-

}),

157-

},

166+

response: jsonResponse({

167+

task_id: "task-456",

168+

base_resp: { status_code: 0 },

169+

}),

158170

release: vi.fn(async () => {}),

159171

});

160172

fetchWithTimeoutMock

161-

.mockResolvedValueOnce({

162-

json: async () => ({

173+

.mockResolvedValueOnce(

174+

jsonResponse({

163175

task_id: "task-456",

164176

status: "Success",

165177

file_id: "file-9",

166178

base_resp: { status_code: 0 },

167179

}),

168-

})

169-

.mockResolvedValueOnce({

170-

json: async () => ({

180+

)

181+

.mockResolvedValueOnce(

182+

jsonResponse({

171183

file: {

172184

file_id: "file-9",

173185

filename: "output_aigc.mp4",

174186

download_url: "https://example.com/download.mp4",

175187

},

176188

base_resp: { status_code: 0 },

177189

}),

178-

})

190+

)

179191

.mockResolvedValueOnce({

180192

headers: new Headers({ "content-type": "video/mp4" }),

181193

arrayBuffer: async () => Buffer.from("mp4-bytes"),

@@ -197,25 +209,60 @@ describe("minimax video generation provider", () => {

197209

expect(result.metadata?.videoUrl).toBeUndefined();

198210

});

199211200-

it("routes portal video generation through minimax-portal auth and HTTP config", async () => {

212+

it("rejects oversized file_id metadata JSON before downloading", async () => {

201213

postJsonRequestMock.mockResolvedValue({

202-

response: {

203-

json: async () => ({

204-

task_id: "task-portal",

214+

response: new Response(

215+

JSON.stringify({

216+

task_id: "task-metadata-too-large",

205217

base_resp: { status_code: 0 },

206218

}),

207-

},

219+

),

208220

release: vi.fn(async () => {}),

209221

});

210222

fetchWithTimeoutMock

211-

.mockResolvedValueOnce({

212-

json: async () => ({

223+

.mockResolvedValueOnce(

224+

new Response(

225+

JSON.stringify({

226+

task_id: "task-metadata-too-large",

227+

status: "Success",

228+

file_id: "file-too-large",

229+

base_resp: { status_code: 0 },

230+

}),

231+

),

232+

)

233+

.mockResolvedValueOnce(oversizedJsonResponse());

234+235+

const provider = buildMinimaxVideoGenerationProvider();

236+

await expect(

237+

provider.generateVideo({

238+

provider: "minimax",

239+

model: "MiniMax-Hailuo-2.3",

240+

prompt: "A fox sprints across snowy hills",

241+

cfg: {},

242+

}),

243+

).rejects.toThrow("MiniMax generated video metadata: JSON response exceeds 16777216 bytes");

244+245+

expectMinimaxFetchCall(1, "https://api.minimax.io/v1/files/retrieve?file_id=file-too-large");

246+

expect(fetchWithTimeoutMock).toHaveBeenCalledTimes(2);

247+

});

248+249+

it("routes portal video generation through minimax-portal auth and HTTP config", async () => {

250+

postJsonRequestMock.mockResolvedValue({

251+

response: jsonResponse({

252+

task_id: "task-portal",

253+

base_resp: { status_code: 0 },

254+

}),

255+

release: vi.fn(async () => {}),

256+

});

257+

fetchWithTimeoutMock

258+

.mockResolvedValueOnce(

259+

jsonResponse({

213260

task_id: "task-portal",

214261

status: "Success",

215262

video_url: "https://example.com/portal.mp4",

216263

base_resp: { status_code: 0 },

217264

}),

218-

})

265+

)

219266

.mockResolvedValueOnce({

220267

headers: new Headers({ "content-type": "video/mp4" }),

221268

arrayBuffer: async () => Buffer.from("mp4-bytes"),