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

推荐订阅源

OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
The Cloudflare Blog
有赞技术团队
有赞技术团队
H
Help Net Security
V
Visual Studio Blog
F
Fortinet All Blogs
Apple Machine Learning Research
Apple Machine Learning Research
博客园 - 司徒正美
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
腾讯CDC
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Stack Overflow Blog
Stack Overflow Blog
I
InfoQ
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
L
LangChain Blog
N
Netflix TechBlog - Medium
罗磊的独立博客
The GitHub Blog
The GitHub Blog
云风的 BLOG
云风的 BLOG
Hugging Face - Blog
Hugging Face - Blog
A
About on SuperTechFans
aimingoo的专栏
aimingoo的专栏
Recent Announcements
Recent Announcements

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): allow trajectory export instruction latenc...
vincentkoc · 2026-06-14 · via Recent Commits to openclaw:main

@@ -25,8 +25,22 @@ const describeLive = LIVE && CODEX_HARNESS_LIVE ? describe : describe.skip;

2525

const LIVE_TIMEOUT_MS = 420_000;

2626

const GATEWAY_CONNECT_TIMEOUT_MS = 60_000;

2727

const AGENT_REQUEST_TIMEOUT_MS = 180_000;

28+

// Keep this below LIVE_TIMEOUT_MS so timeout diagnostics win over Vitest's generic cap.

29+

const TRAJECTORY_EXPORT_INSTRUCTION_TIMEOUT_MS = 120_000;

2830

const DEFAULT_CODEX_MODEL = "openai/gpt-5.5";

293132+

type TrajectoryExportApprovalEntry = {

33+

id?: string;

34+

request?: {

35+

command?: string;

36+

};

37+

};

38+39+

type TrajectoryExportApprovalSummary = {

40+

id?: string;

41+

hasTrajectoryExportCommand: boolean;

42+

};

43+3044

function logLiveStep(step: string, details?: Record<string, unknown>): void {

3145

if (!CODEX_HARNESS_DEBUG) {

3246

return;

@@ -189,6 +203,22 @@ function extractAssistantTexts(messages: unknown[]): string[] {

189203

return texts;

190204

}

191205206+

function isTrajectoryExportApproval(entry: TrajectoryExportApprovalEntry): boolean {

207+

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

208+

}

209+210+

function summarizeTrajectoryExportApproval(

211+

entry: TrajectoryExportApprovalEntry,

212+

): TrajectoryExportApprovalSummary {

213+

const summary: TrajectoryExportApprovalSummary = {

214+

hasTrajectoryExportCommand: isTrajectoryExportApproval(entry),

215+

};

216+

if (entry.id) {

217+

summary.id = entry.id;

218+

}

219+

return summary;

220+

}

221+192222

async function waitForTrajectoryExportInstructionText(params: {

193223

client: GatewayClient;

194224

events: EventFrame[];

@@ -214,6 +244,7 @@ async function waitForTrajectoryExportInstructionText(params: {

214244

});

215245

}

216246

let assistantTexts: string[];

247+

let approvalSummaries: TrajectoryExportApprovalSummary[];

217248

try {

218249

const history = (await params.client.request(

219250

"chat.history",

@@ -227,9 +258,19 @@ async function waitForTrajectoryExportInstructionText(params: {

227258

} catch {

228259

assistantTexts = [];

229260

}

261+

try {

262+

const approvals = (await params.client.request(

263+

"exec.approval.list",

264+

{},

265+

{ timeoutMs: 10_000 },

266+

)) as TrajectoryExportApprovalEntry[];

267+

approvalSummaries = approvals.map(summarizeTrajectoryExportApproval);

268+

} catch {

269+

approvalSummaries = [];

270+

}

230271

throw new Error(

231272

`timed out waiting for trajectory export instruction text for ${params.runId}; ` +

232-

`events=${params.events.length}; finalTexts=${formatTextPreview(finalTexts)}; assistantTexts=${formatTextPreview(assistantTexts)}`,

273+

`events=${params.events.length}; finalTexts=${formatTextPreview(finalTexts)}; assistantTexts=${formatTextPreview(assistantTexts)}; approvals=${JSON.stringify(approvalSummaries)}`,

233274

);

234275

}

235276

@@ -285,35 +326,16 @@ function extractVisibleMessageText(message: unknown): string | undefined {

285326286327

async function approveTrajectoryExport(client: GatewayClient): Promise<string> {

287328

const startedAt = Date.now();

288-

let approval:

289-

| {

290-

id?: string;

291-

request?: {

292-

command?: string;

293-

};

294-

}

295-

| undefined;

296-

let lastApprovalSummaries: Array<{ id?: string; hasTrajectoryExportCommand: boolean }> = [];

329+

let approval: TrajectoryExportApprovalEntry | undefined;

330+

let lastApprovalSummaries: TrajectoryExportApprovalSummary[] = [];

297331

while (Date.now() - startedAt < 60_000) {

298332

const approvals = (await client.request(

299333

"exec.approval.list",

300334

{},

301335

{ timeoutMs: 10_000 },

302-

)) as Array<{

303-

id?: string;

304-

request?: {

305-

command?: string;

306-

};

307-

}>;

308-

lastApprovalSummaries = approvals.map((entry) => ({

309-

...(entry.id ? { id: entry.id } : {}),

310-

hasTrajectoryExportCommand: Boolean(

311-

entry.request?.command?.includes("sessions export-trajectory"),

312-

),

313-

}));

314-

approval = approvals.find((entry) =>

315-

entry.request?.command?.includes("sessions export-trajectory"),

316-

);

336+

)) as TrajectoryExportApprovalEntry[];

337+

lastApprovalSummaries = approvals.map(summarizeTrajectoryExportApproval);

338+

approval = approvals.find(isTrajectoryExportApproval);

317339

if (approval) {

318340

break;

319341

}

@@ -461,7 +483,7 @@ describeLive("gateway live trajectory export", () => {

461483

expectedText: "Trajectory exports can include",

462484

runId: exportRunId,

463485

sessionKey,

464-

timeoutMs: 60_000,

486+

timeoutMs: TRAJECTORY_EXPORT_INSTRUCTION_TIMEOUT_MS,

465487

});

466488

expect(finalText).toContain("Trajectory exports can include");

467489

expect(finalText).toContain("through exec approval");