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

推荐订阅源

The GitHub Blog
The GitHub Blog
阮一峰的网络日志
阮一峰的网络日志
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Apple Machine Learning Research
Apple Machine Learning Research
小众软件
小众软件
博客园 - 司徒正美
Last Week in AI
Last Week in AI
爱范儿
爱范儿
罗磊的独立博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园_首页
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
The Cloudflare Blog
雷峰网
雷峰网
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
WordPress大学
WordPress大学
Jina AI
Jina AI
人人都是产品经理
人人都是产品经理
量子位
V
V2EX
博客园 - 叶小钗
宝玉的分享
宝玉的分享
T
Tailwind CSS 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(e2e): stream OpenAI web search request logs · opencla...
vincentkoc · 2026-05-28 · via Recent Commits to openclaw:main

@@ -2,6 +2,97 @@ import fs from "node:fs";

2233

const command = process.argv[2];

445+

const ERROR_DETAIL_TAIL_BYTES = 64 * 1024;

6+

const REQUEST_LOG_SCAN_CHUNK_BYTES = 64 * 1024;

7+

const RESPONSE_PREVIEW_BYTES = 8 * 1024;

8+

const RESPONSE_PREVIEW_COUNT = 5;

9+10+

function tailText(text, maxBytes = ERROR_DETAIL_TAIL_BYTES) {

11+

if (Buffer.byteLength(text, "utf8") <= maxBytes) {

12+

return text;

13+

}

14+

return Buffer.from(text, "utf8").subarray(-maxBytes).toString("utf8");

15+

}

16+17+

function readTextFileTail(file, maxBytes = ERROR_DETAIL_TAIL_BYTES) {

18+

let stat;

19+

try {

20+

stat = fs.statSync(file);

21+

} catch {

22+

return "";

23+

}

24+

if (!stat.isFile() || stat.size <= 0) {

25+

return "";

26+

}

27+28+

const length = Math.min(maxBytes, stat.size);

29+

const start = stat.size - length;

30+

const fd = fs.openSync(file, "r");

31+

try {

32+

const buffer = Buffer.alloc(length);

33+

const bytesRead = fs.readSync(fd, buffer, 0, length, start);

34+

return buffer.subarray(0, bytesRead).toString("utf8");

35+

} finally {

36+

fs.closeSync(fd);

37+

}

38+

}

39+40+

function scanTextFileLines(file, onLine) {

41+

const fd = fs.openSync(file, "r");

42+

try {

43+

const buffer = Buffer.alloc(REQUEST_LOG_SCAN_CHUNK_BYTES);

44+

let carry = "";

45+

let lineNumber = 1;

46+

while (true) {

47+

const bytesRead = fs.readSync(fd, buffer, 0, buffer.length, null);

48+

if (bytesRead <= 0) {

49+

break;

50+

}

51+

const text = carry + buffer.subarray(0, bytesRead).toString("utf8");

52+

const lines = text.split(/\r?\n/u);

53+

carry = lines.pop() ?? "";

54+

for (const line of lines) {

55+

onLine(line, lineNumber);

56+

lineNumber += 1;

57+

}

58+

}

59+

if (carry.length > 0) {

60+

onLine(carry, lineNumber);

61+

}

62+

} finally {

63+

fs.closeSync(fd);

64+

}

65+

}

66+67+

function scanSuccessRequest(logPath) {

68+

let responseCount = 0;

69+

let success;

70+

const recentResponses = [];

71+

scanTextFileLines(logPath, (line, lineNumber) => {

72+

const trimmed = line.trim();

73+

if (!trimmed) {

74+

return;

75+

}

76+

const entry = JSON.parse(trimmed);

77+

if (entry.path !== "/v1/responses") {

78+

return;

79+

}

80+

responseCount += 1;

81+

const bodyText = JSON.stringify(entry.body);

82+

if (recentResponses.length >= RESPONSE_PREVIEW_COUNT) {

83+

recentResponses.shift();

84+

}

85+

recentResponses.push({

86+

line: lineNumber,

87+

bodyTail: tailText(bodyText, RESPONSE_PREVIEW_BYTES),

88+

});

89+

if (!success && bodyText.includes("OPENCLAW_SCHEMA_E2E_OK")) {

90+

success = entry;

91+

}

92+

});

93+

return { responseCount, success, recentResponses };

94+

}

95+596

function assertPatchBehavior() {

697

return import("../../../../dist/extensions/openai/native-web-search.js").then(

798

({ patchOpenAINativeWebSearchPayload }) => {

@@ -40,21 +131,16 @@ function assertPatchBehavior() {

4013141132

function assertSuccessRequest() {

42133

const logPath = process.argv[3];

43-

const entries = fs

44-

.readFileSync(logPath, "utf8")

45-

.trim()

46-

.split(/\n+/u)

47-

.filter(Boolean)

48-

.map((line) => JSON.parse(line));

49-

const responseEntries = entries.filter((entry) => entry.path === "/v1/responses");

50-

if (responseEntries.length < 1) {

51-

throw new Error(`mock OpenAI /v1/responses was not used. Requests: ${JSON.stringify(entries)}`);

134+

const { responseCount, success, recentResponses } = scanSuccessRequest(logPath);

135+

if (responseCount < 1) {

136+

throw new Error(

137+

`mock OpenAI /v1/responses was not used. Request log tail: ${readTextFileTail(logPath)}`,

138+

);

52139

}

53-

const success = responseEntries.find((entry) =>

54-

JSON.stringify(entry.body).includes("OPENCLAW_SCHEMA_E2E_OK"),

55-

);

56140

if (!success) {

57-

throw new Error(`missing success request. Requests: ${JSON.stringify(responseEntries)}`);

141+

throw new Error(

142+

`missing success request. Recent /v1/responses: ${JSON.stringify(recentResponses)}`,

143+

);

58144

}

59145

const tools = Array.isArray(success.body.tools) ? success.body.tools : [];

60146

const hasWebSearch = tools.some(