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

推荐订阅源

罗磊的独立博客
L
LangChain Blog
aimingoo的专栏
aimingoo的专栏
IT之家
IT之家
B
Blog
博客园_首页
博客园 - 司徒正美
有赞技术团队
有赞技术团队
博客园 - 聂微东
I
InfoQ
美团技术团队
GbyAI
GbyAI
阮一峰的网络日志
阮一峰的网络日志
H
Help Net Security
大猫的无限游戏
大猫的无限游戏
MyScale Blog
MyScale Blog
WordPress大学
WordPress大学
The GitHub Blog
The GitHub Blog
A
About on SuperTechFans
人人都是产品经理
人人都是产品经理
Microsoft Azure Blog
Microsoft Azure Blog
Engineering at Meta
Engineering at Meta
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
The Cloudflare 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(trajectory): report malformed export rows · openclaw/...
vincentkoc · 2026-05-16 · via Recent Commits to openclaw:main

@@ -317,17 +317,35 @@ describe("exportTrajectoryBundle", () => {

317317

writeSimpleSessionFile(sessionFile);

318318

fs.writeFileSync(

319319

runtimeFile,

320-

`${JSON.stringify({})}\n${JSON.stringify({

321-

traceSchema: "openclaw-trajectory",

322-

schemaVersion: 1,

323-

traceId: "session-1",

324-

source: "runtime",

325-

type: "session.started",

326-

ts: "2026-04-22T08:00:00.000Z",

327-

seq: 1,

328-

sourceSeq: 1,

329-

sessionId: "session-1",

330-

})}\n`,

320+

[

321+

"",

322+

JSON.stringify({}),

323+

"",

324+

JSON.stringify({

325+

traceSchema: "openclaw-trajectory",

326+

schemaVersion: 1,

327+

traceId: "session-1",

328+

source: "runtime",

329+

type: "bad-data",

330+

ts: "2026-04-22T08:00:00.000Z",

331+

seq: 1,

332+

sourceSeq: 1,

333+

sessionId: "session-1",

334+

data: [],

335+

}),

336+

'{"traceSchema":',

337+

JSON.stringify({

338+

traceSchema: "openclaw-trajectory",

339+

schemaVersion: 1,

340+

traceId: "session-1",

341+

source: "runtime",

342+

type: "session.started",

343+

ts: "2026-04-22T08:00:00.000Z",

344+

seq: 1,

345+

sourceSeq: 1,

346+

sessionId: "session-1",

347+

}),

348+

].join("\n") + "\n",

331349

"utf8",

332350

);

333351

@@ -340,6 +358,95 @@ describe("exportTrajectoryBundle", () => {

340358341359

expect(bundle.manifest.runtimeEventCount).toBe(1);

342360

expect(eventTypes(bundle.events)).toContain("session.started");

361+

expect(bundle.manifest.warnings).toEqual([

362+

{

363+

source: "runtime",

364+

code: "invalid-runtime-event",

365+

count: 2,

366+

rows: [2, 4],

367+

message: "Skipped a runtime trajectory JSONL row that does not match the session schema.",

368+

},

369+

{

370+

source: "runtime",

371+

code: "invalid-runtime-json",

372+

count: 1,

373+

rows: [5],

374+

message: "Skipped a runtime trajectory JSONL row that is not valid JSON.",

375+

},

376+

]);

377+

});

378+379+

it("skips and reports malformed session jsonl rows without poisoning transcript export", async () => {

380+

const tmpDir = makeTempDir();

381+

const sessionFile = path.join(tmpDir, "session.jsonl");

382+

const outputDir = path.join(tmpDir, "bundle");

383+

const header = {

384+

type: "session",

385+

version: 3,

386+

id: "session-1",

387+

timestamp: "2026-04-01T05:46:39.000Z",

388+

cwd: tmpDir,

389+

};

390+

const userEntry = {

391+

type: "message",

392+

id: "entry-user",

393+

parentId: null,

394+

timestamp: "2026-04-01T05:46:40.000Z",

395+

message: userMessage("hello"),

396+

};

397+

const assistantEntry = {

398+

type: "message",

399+

id: "entry-assistant",

400+

parentId: "entry-user",

401+

timestamp: "2026-04-01T05:46:41.000Z",

402+

message: assistantMessage([{ type: "text", text: "done" }]),

403+

};

404+

fs.writeFileSync(

405+

sessionFile,

406+

[

407+

JSON.stringify(header),

408+

"null",

409+

'{"type":',

410+

JSON.stringify({

411+

type: "message",

412+

id: "entry-corrupt",

413+

parentId: null,

414+

timestamp: "2026-04-01T05:46:39.500Z",

415+

}),

416+

JSON.stringify(userEntry),

417+

JSON.stringify(assistantEntry),

418+

].join("\n") + "\n",

419+

"utf8",

420+

);

421+422+

const bundle = await exportTrajectoryBundle({

423+

outputDir,

424+

sessionFile,

425+

sessionId: "session-1",

426+

workspaceDir: tmpDir,

427+

});

428+429+

expect(bundle.manifest.transcriptEventCount).toBe(2);

430+

expect(eventTypes(bundle.events)).toEqual(["user.message", "assistant.message"]);

431+

expect(bundle.manifest.warnings).toEqual([

432+

{

433+

source: "session",

434+

code: "invalid-session-row",

435+

count: 2,

436+

rows: [2, 4],

437+

message: "Skipped a session JSONL row that is not a session entry object.",

438+

},

439+

{

440+

source: "session",

441+

code: "invalid-session-json",

442+

count: 1,

443+

rows: [3],

444+

message: "Skipped a session JSONL row that is not valid JSON.",

445+

},

446+

]);

447+

expect(

448+

JSON.parse(fs.readFileSync(path.join(outputDir, "manifest.json"), "utf8")).warnings,

449+

).toEqual(bundle.manifest.warnings);

343450

});

344451345452

it("uses the recorded runtime pointer before current environment overrides", async () => {

@@ -550,6 +657,7 @@ describe("exportTrajectoryBundle", () => {

550657551658

expect(bundle.manifest.runtimeEventCount).toBe(0);

552659

expect(eventTypes(bundle.events)).not.toContain("other-runtime");

660+

expect(bundle.manifest.warnings).toBeUndefined();

553661

});

554662555663

it("redacts non-workspace paths in strings that also contain workspace paths", async () => {