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

推荐订阅源

G
Google Developers Blog
有赞技术团队
有赞技术团队
WordPress大学
WordPress大学
博客园 - 司徒正美
D
Docker
B
Blog
V
Visual Studio Blog
Blog — PlanetScale
Blog — PlanetScale
U
Unit 42
S
SegmentFault 最新的问题
小众软件
小众软件
J
Java Code Geeks
美团技术团队
腾讯CDC
MyScale Blog
MyScale Blog
爱范儿
爱范儿
H
Help Net Security
宝玉的分享
宝玉的分享
Microsoft Azure Blog
Microsoft Azure Blog
A
About on SuperTechFans
Google DeepMind News
Google DeepMind News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
博客园 - 【当耐特】

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(e2e): bound image auth mock bodies · openclaw/opencla...
vincentkoc · 2026-06-03 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -1,12 +1,15 @@

11

import http from "node:http";

22

import type { AddressInfo } from "node:net";

3+

import path from "node:path";

4+

import { fileURLToPath } from "node:url";

5+

import { isRequestBodyTooLargeError, readBody } from "./lib/mock-openai-http.mjs";

36
47

const DIRECT_IMAGE_BYTES = Buffer.from("docker-direct-image");

58

const CODEX_IMAGE_BYTES = Buffer.from("docker-codex-image");

69

const DIRECT_TOKEN = "sk-openclaw-image-auth-e2e";

710

const CODEX_TOKEN = "docker-codex-oauth-token";

811
9-

type RequestRecord = {

12+

export type RequestRecord = {

1013

method?: string;

1114

url?: string;

1215

authorization?: string;

@@ -21,18 +24,6 @@ function assert(condition: unknown, message: string): asserts condition {

2124

}

2225

}

2326
24-

function readBody(req: http.IncomingMessage): Promise<string> {

25-

return new Promise((resolve, reject) => {

26-

let body = "";

27-

req.setEncoding("utf8");

28-

req.on("data", (chunk) => {

29-

body += chunk;

30-

});

31-

req.on("end", () => resolve(body));

32-

req.on("error", reject);

33-

});

34-

}

35-
3627

function writeJson(res: http.ServerResponse, status: number, body: unknown): void {

3728

res.writeHead(status, { "content-type": "application/json" });

3829

res.end(JSON.stringify(body));

@@ -63,14 +54,23 @@ function writeCodexSse(res: http.ServerResponse): void {

6354

res.end("data: [DONE]\n\n");

6455

}

6556
66-

async function startMockServer(records: RequestRecord[]): Promise<{

57+

export async function startMockServer(records: RequestRecord[]): Promise<{

6758

baseUrl: string;

6859

close: () => Promise<void>;

6960

}> {

7061

const server = http.createServer((req, res) => {

7162

void (async () => {

7263

try {

73-

const body = await readBody(req);

64+

let body: string;

65+

try {

66+

body = await readBody(req);

67+

} catch (error) {

68+

if (isRequestBodyTooLargeError(error)) {

69+

writeJson(res, 413, { error: { message: error.message } });

70+

return;

71+

}

72+

throw error;

73+

}

7474

records.push({

7575

method: req.method,

7676

url: req.url,

@@ -164,7 +164,7 @@ function createCodexOAuthStore() {

164164

} as const;

165165

}

166166
167-

async function main() {

167+

export async function main() {

168168

assert(

169169

process.env.OPENAI_API_KEY === DIRECT_TOKEN,

170170

"Docker lane must expose the direct OpenAI API key",

@@ -246,4 +246,6 @@ async function main() {

246246

}

247247

}

248248
249-

await main();

249+

if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {

250+

await main();

251+

}