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

推荐订阅源

V
Visual Studio Blog
Recent Announcements
Recent Announcements
雷峰网
雷峰网
The GitHub Blog
The GitHub Blog
罗磊的独立博客
月光博客
月光博客
J
Java Code Geeks
A
About on SuperTechFans
Microsoft Security Blog
Microsoft Security Blog
D
Docker
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
F
Fortinet All Blogs
U
Unit 42
C
Check Point Blog
Martin Fowler
Martin Fowler
有赞技术团队
有赞技术团队
博客园 - 叶小钗
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
酷 壳 – CoolShell
酷 壳 – CoolShell
Blog — PlanetScale
Blog — PlanetScale
大猫的无限游戏
大猫的无限游戏
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
阮一峰的网络日志
阮一峰的网络日志
MyScale Blog
MyScale 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(gateway): read active transcript history branch · ope...
steipete · 2026-04-28 · via Recent Commits to openclaw:main

@@ -501,6 +501,74 @@ describe("readSessionMessages", () => {

501501

expect(typeof marker.timestamp).toBe("number");

502502

});

503503504+

test("reads only the active branch when transcript rewrites abandon older entries", () => {

505+

const sessionId = "test-session-active-branch";

506+

const sessionFile = path.join(tmpDir, `${sessionId}.jsonl`);

507+

const lines = [

508+

{

509+

type: "session",

510+

version: 3,

511+

id: sessionId,

512+

cwd: tmpDir,

513+

timestamp: "2026-04-27T00:00:00.000Z",

514+

},

515+

{

516+

type: "message",

517+

id: "original",

518+

parentId: null,

519+

timestamp: "2026-04-27T00:00:01.000Z",

520+

message: {

521+

role: "user",

522+

content: "Sender (untrusted metadata): webchat\n\noriginal wrapped prompt",

523+

timestamp: 1,

524+

},

525+

},

526+

{

527+

type: "message",

528+

id: "clean",

529+

parentId: null,

530+

timestamp: "2026-04-27T00:00:02.000Z",

531+

message: { role: "user", content: "clean prompt", timestamp: 2 },

532+

},

533+

{

534+

type: "message",

535+

id: "answer",

536+

parentId: "clean",

537+

timestamp: "2026-04-27T00:00:03.000Z",

538+

message: {

539+

role: "assistant",

540+

content: [{ type: "text", text: "clean answer" }],

541+

api: "chat",

542+

provider: "openclaw",

543+

model: "test",

544+

usage: {},

545+

stopReason: "stop",

546+

timestamp: 3,

547+

},

548+

},

549+

];

550+

fs.writeFileSync(sessionFile, lines.map((line) => JSON.stringify(line)).join("\n"), "utf-8");

551+

const rawTranscript = fs.readFileSync(sessionFile, "utf-8");

552+

expect(rawTranscript).toContain("original wrapped prompt");

553+

expect(rawTranscript).toContain("clean prompt");

554+555+

const out = readSessionMessages(sessionId, storePath, sessionFile);

556+

expect(out).toHaveLength(2);

557+

expect(out).toEqual([

558+

expect.objectContaining({

559+

role: "user",

560+

content: "clean prompt",

561+

__openclaw: expect.objectContaining({ seq: 1 }),

562+

}),

563+

expect.objectContaining({

564+

role: "assistant",

565+

content: [{ type: "text", text: "clean answer" }],

566+

__openclaw: expect.objectContaining({ seq: 2 }),

567+

}),

568+

]);

569+

expect(JSON.stringify(out)).not.toContain("original wrapped prompt");

570+

});

571+504572

test.each([

505573

{

506574

sessionId: "cross-agent-default-root",