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

推荐订阅源

腾讯CDC
Microsoft Azure Blog
Microsoft Azure Blog
L
LangChain Blog
Y
Y Combinator Blog
Microsoft Security Blog
Microsoft Security Blog
宝玉的分享
宝玉的分享
B
Blog RSS Feed
MongoDB | Blog
MongoDB | Blog
Jina AI
Jina AI
D
Docker
B
Blog
Engineering at Meta
Engineering at Meta
Last Week in AI
Last Week in AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
I
InfoQ
G
Google Developers Blog
博客园 - Franky
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
The GitHub Blog
The GitHub Blog
T
The Blog of Author Tim Ferriss
大猫的无限游戏
大猫的无限游戏
阮一峰的网络日志
阮一峰的网络日志
U
Unit 42

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
test(gateway): authorize trajectory export live command ·...
vincentkoc · 2026-06-14 · via Recent Commits to openclaw:main

@@ -31,8 +31,13 @@ const DEFAULT_CODEX_MODEL = "openai/gpt-5.5";

31313232

type TrajectoryExportApprovalEntry = {

3333

id?: string;

34+

command?: string;

35+

commandText?: string;

36+

commandPreview?: string;

3437

request?: {

3538

command?: string;

39+

commandText?: string;

40+

commandPreview?: string;

3641

};

3742

};

3843

@@ -91,6 +96,7 @@ async function writeLiveGatewayConfig(params: {

9196

port: params.port,

9297

auth: { mode: "token", token: params.token },

9398

},

99+

commands: { ownerAllowFrom: ["*"] },

94100

plugins: { allow: ["codex"] },

95101

agents: {

96102

list: [{ id: "dev", default: true, tools: { exec: { host: "node" } } }],

@@ -203,8 +209,21 @@ function extractAssistantTexts(messages: unknown[]): string[] {

203209

return texts;

204210

}

205211212+

function getTrajectoryExportApprovalCommands(entry: TrajectoryExportApprovalEntry): string[] {

213+

return [

214+

entry.request?.command,

215+

entry.request?.commandText,

216+

entry.request?.commandPreview,

217+

entry.command,

218+

entry.commandText,

219+

entry.commandPreview,

220+

].filter((value): value is string => typeof value === "string" && value.trim().length > 0);

221+

}

222+206223

function isTrajectoryExportApproval(entry: TrajectoryExportApprovalEntry): boolean {

207-

return Boolean(entry.request?.command?.includes("sessions export-trajectory"));

224+

return getTrajectoryExportApprovalCommands(entry).some((command) =>

225+

command.includes("sessions export-trajectory"),

226+

);

208227

}

209228210229

function summarizeTrajectoryExportApproval(

@@ -230,6 +249,8 @@ async function waitForTrajectoryExportInstructionText(params: {

230249

}): Promise<string> {

231250

const deadline = Date.now() + params.timeoutMs;

232251

let finalTexts: string[] = [];

252+

let assistantTexts: string[] = [];

253+

let nextHistoryPollAt = 0;

233254

while (Date.now() < deadline) {

234255

const newEvents = params.events.slice(params.eventStartIndex);

235256

finalTexts = newEvents

@@ -239,25 +260,33 @@ async function waitForTrajectoryExportInstructionText(params: {

239260

if (matchedText) {

240261

return matchedText;

241262

}

263+

if (Date.now() >= nextHistoryPollAt) {

264+

try {

265+

const history = (await params.client.request(

266+

"chat.history",

267+

{

268+

sessionKey: params.sessionKey,

269+

limit: 24,

270+

},

271+

{ timeoutMs: 10_000 },

272+

)) as { messages?: unknown[] };

273+

assistantTexts = extractAssistantTexts(history.messages ?? []);

274+

const matchedHistoryText = assistantTexts.find((text) =>

275+

text.includes(params.expectedText),

276+

);

277+

if (matchedHistoryText) {

278+

return matchedHistoryText;

279+

}

280+

} catch {

281+

assistantTexts = [];

282+

}

283+

nextHistoryPollAt = Date.now() + 2_000;

284+

}

242285

await new Promise((resolve) => {

243286

setTimeout(resolve, 500);

244287

});

245288

}

246-

let assistantTexts: string[];

247289

let approvalSummaries: TrajectoryExportApprovalSummary[];

248-

try {

249-

const history = (await params.client.request(

250-

"chat.history",

251-

{

252-

sessionKey: params.sessionKey,

253-

limit: 24,

254-

},

255-

{ timeoutMs: 10_000 },

256-

)) as { messages?: unknown[] };

257-

assistantTexts = extractAssistantTexts(history.messages ?? []);

258-

} catch {

259-

assistantTexts = [];

260-

}

261290

try {

262291

const approvals = (await params.client.request(

263292

"exec.approval.list",

@@ -348,7 +377,9 @@ async function approveTrajectoryExport(client: GatewayClient): Promise<string> {

348377

`expected trajectory export approval id; approvals=${JSON.stringify(lastApprovalSummaries)}`,

349378

);

350379

}

351-

expect(approval.request?.command).toContain("sessions export-trajectory");

380+

expect(getTrajectoryExportApprovalCommands(approval).join("\n")).toContain(

381+

"sessions export-trajectory",

382+

);

352383

await client.request(

353384

"exec.approval.resolve",

354385

{ id: approval.id, decision: "allow-once" },