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

推荐订阅源

J
Java Code Geeks
小众软件
小众软件
博客园 - 叶小钗
宝玉的分享
宝玉的分享
博客园_首页
Hugging Face - Blog
Hugging Face - Blog
人人都是产品经理
人人都是产品经理
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
S
SegmentFault 最新的问题
B
Blog RSS Feed
Engineering at Meta
Engineering at Meta
N
Netflix TechBlog - Medium
Google DeepMind News
Google DeepMind News
U
Unit 42
F
Fortinet All Blogs
IT之家
IT之家
Y
Y Combinator Blog
Martin Fowler
Martin Fowler
T
The Blog of Author Tim Ferriss
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
The GitHub Blog
The GitHub Blog
Stack Overflow Blog
Stack Overflow Blog
Blog — PlanetScale
Blog — PlanetScale
酷 壳 – CoolShell
酷 壳 – CoolShell

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
refactor: add transcript update identity contract (#89912...
jalehman · 2026-06-23 · via Recent Commits to openclaw:main

@@ -3,6 +3,7 @@ import fs from "node:fs/promises";

33

import os from "node:os";

44

import path from "node:path";

55

import type { DatabaseSync } from "node:sqlite";

6+

import { emitSessionTranscriptUpdate } from "openclaw/plugin-sdk/agent-harness-runtime";

67

import {

78

resolveSessionTranscriptsDirForAgent,

89

type OpenClawConfig,

@@ -33,6 +34,25 @@ type SyncParams = {

3334

progress?: (update: MemorySyncProgressUpdate) => void;

3435

};

353637+

type MemorySessionTranscriptUpdate = {

38+

agentId?: string;

39+

sessionFile?: string;

40+

sessionKey?: string;

41+

target?: {

42+

agentId: string;

43+

sessionId: string;

44+

sessionKey: string;

45+

};

46+

};

47+48+

type MemoryTranscriptUpdateSubscriber = (

49+

listener: (update: MemorySessionTranscriptUpdate) => void,

50+

) => () => void;

51+52+

const MEMORY_CORE_TRANSCRIPT_UPDATE_SUBSCRIBER_KEY = Symbol.for(

53+

"openclaw.memoryCore.sessionTranscriptUpdateSubscriber",

54+

);

55+3656

type SourceStateRow = { path: string; hash: string; mtime: number; size: number };

37573858

class SessionStartupCatchupHarness extends MemoryManagerSyncOps {

@@ -111,10 +131,27 @@ class SessionStartupCatchupHarness extends MemoryManagerSyncOps {

111131

return Array.from(this.sessionsDirtyFiles);

112132

}

113133134+

getPendingSessionTargets(): MemorySyncParams["sessions"] {

135+

return Array.from(this.sessionPendingTargets.values());

136+

}

137+138+

getPendingSessionFiles(): string[] {

139+

return Array.from(this.sessionPendingFiles);

140+

}

141+114142

isSessionsDirty(): boolean {

115143

return this.sessionsDirty;

116144

}

117145146+

startTranscriptListener(): void {

147+

this.ensureSessionListener();

148+

}

149+150+

stopTranscriptListener(): void {

151+

this.sessionUnsubscribe?.();

152+

this.sessionUnsubscribe = null;

153+

}

154+118155

protected computeProviderKey(): string {

119156

return "test";

120157

}

@@ -162,6 +199,8 @@ describe("session startup catch-up", () => {

162199

});

163200164201

afterEach(async () => {

202+

vi.clearAllTimers();

203+

vi.useRealTimers();

165204

vi.unstubAllEnvs();

166205

await fs.rm(stateDir, { recursive: true, force: true });

167206

});

@@ -356,4 +395,84 @@ describe("session startup catch-up", () => {

356395357396

expect(harness.indexedPaths).toEqual([]);

358397

});

398+399+

it("queues transcript update identity without requiring a session file", async () => {

400+

vi.useFakeTimers();

401+

const harness = new SessionStartupCatchupHarness([]);

402+

const originalSubscriber = (globalThis as Record<symbol, unknown>)[

403+

MEMORY_CORE_TRANSCRIPT_UPDATE_SUBSCRIBER_KEY

404+

];

405+

let transcriptListener: ((update: MemorySessionTranscriptUpdate) => void) | undefined;

406+

(globalThis as Record<symbol, unknown>)[MEMORY_CORE_TRANSCRIPT_UPDATE_SUBSCRIBER_KEY] = ((

407+

listener,

408+

) => {

409+

transcriptListener = listener;

410+

return () => {

411+

if (transcriptListener === listener) {

412+

transcriptListener = undefined;

413+

}

414+

};

415+

}) satisfies MemoryTranscriptUpdateSubscriber;

416+

harness.startTranscriptListener();

417+418+

try {

419+

transcriptListener?.({

420+

target: {

421+

agentId: "main",

422+

sessionId: "thread",

423+

sessionKey: "agent:main:thread",

424+

},

425+

});

426+427+

expect(harness.getPendingSessionTargets()).toEqual([

428+

{ agentId: "main", sessionId: "thread", sessionKey: "agent:main:thread" },

429+

]);

430+

} finally {

431+

harness.stopTranscriptListener();

432+

if (originalSubscriber === undefined) {

433+

delete (globalThis as Record<symbol, unknown>)[

434+

MEMORY_CORE_TRANSCRIPT_UPDATE_SUBSCRIBER_KEY

435+

];

436+

} else {

437+

(globalThis as Record<symbol, unknown>)[MEMORY_CORE_TRANSCRIPT_UPDATE_SUBSCRIBER_KEY] =

438+

originalSubscriber;

439+

}

440+

}

441+

});

442+443+

it("keeps canonical path transcript update compatibility", async () => {

444+

vi.useFakeTimers();

445+

const session = await writeSessionFile("thread.jsonl");

446+

const harness = new SessionStartupCatchupHarness([]);

447+

harness.startTranscriptListener();

448+449+

emitSessionTranscriptUpdate({

450+

sessionFile: session.filePath,

451+

sessionKey: "agent:main:thread",

452+

});

453+454+

expect(harness.getPendingSessionFiles()).toEqual([session.filePath]);

455+

expect(harness.getPendingSessionTargets()).toEqual([]);

456+

harness.stopTranscriptListener();

457+

});

458+459+

it("prefers transcript update path compatibility before identity", async () => {

460+

vi.useFakeTimers();

461+

const session = await writeSessionFile("thread.jsonl");

462+

const harness = new SessionStartupCatchupHarness([]);

463+

harness.startTranscriptListener();

464+465+

emitSessionTranscriptUpdate({

466+

sessionFile: session.filePath,

467+

target: {

468+

agentId: "main",

469+

sessionId: "identity-target",

470+

sessionKey: "agent:main:identity-target",

471+

},

472+

});

473+474+

expect(harness.getPendingSessionFiles()).toEqual([session.filePath]);

475+

expect(harness.getPendingSessionTargets()).toEqual([]);

476+

harness.stopTranscriptListener();

477+

});

359478

});