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

推荐订阅源

aimingoo的专栏
aimingoo的专栏
腾讯CDC
Y
Y Combinator Blog
L
LangChain Blog
B
Blog
U
Unit 42
P
Proofpoint News Feed
G
Google Developers Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 【当耐特】
WordPress大学
WordPress大学
月光博客
月光博客
Vercel News
Vercel News
雷峰网
雷峰网
T
The Blog of Author Tim Ferriss
MyScale Blog
MyScale Blog
大猫的无限游戏
大猫的无限游戏
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
酷 壳 – CoolShell
酷 壳 – CoolShell
Blog — PlanetScale
Blog — PlanetScale
博客园 - 司徒正美
云风的 BLOG
云风的 BLOG
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 叶小钗

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: stabilize transcript cache and CLI env isolation · o...
shakkernerd · 2026-06-16 · via Recent Commits to openclaw:main

@@ -613,14 +613,31 @@ function rememberAppendedSessionEntry(

613613

beforeAppendSnapshot: SessionFileSnapshot | undefined,

614614

serializedAppend: string,

615615

cacheOwnedAppend: boolean,

616-

): { snapshot: SessionFileSnapshot | undefined; cacheAdvanced: boolean } {

616+

publishOwnedAppend: boolean,

617+

): {

618+

snapshot: SessionFileSnapshot | undefined;

619+

cacheAdvanced: boolean;

620+

ownedAppendVerified: boolean;

621+

} {

617622

const resolvedPath = resolve(filePath);

623+

const appendedByteLength = BigInt(Buffer.byteLength(serializedAppend, "utf8"));

624+

const isVerifiedOwnedAppend = (snapshot: SessionFileSnapshot | undefined) =>

625+

Boolean(

626+

publishOwnedAppend &&

627+

beforeAppendSnapshot &&

628+

snapshot &&

629+

snapshot.dev === beforeAppendSnapshot.dev &&

630+

snapshot.ino === beforeAppendSnapshot.ino &&

631+

snapshot.size === beforeAppendSnapshot.size + appendedByteLength,

632+

);

618633

if (!cacheOwnedAppend) {

619634

sessionEntriesCache.delete(resolvedPath);

620635

invalidateSessionFileRepairCache(resolvedPath);

636+

const snapshot = readSessionFileSnapshotIfExists(resolvedPath);

621637

return {

622-

snapshot: readSessionFileSnapshotIfExists(resolvedPath),

638+

snapshot,

623639

cacheAdvanced: false,

640+

ownedAppendVerified: isVerifiedOwnedAppend(snapshot),

624641

};

625642

}

626643

if (

@@ -633,6 +650,7 @@ function rememberAppendedSessionEntry(

633650

return {

634651

snapshot: readSessionFileSnapshotIfExists(resolvedPath),

635652

cacheAdvanced: false,

653+

ownedAppendVerified: false,

636654

};

637655

}

638656

@@ -641,8 +659,7 @@ function rememberAppendedSessionEntry(

641659

// Owned transcript writes serialize appenders under the session lock. Full

642660

// rewrites refresh the cache explicitly, so identity and size are sufficient

643661

// to advance this append-only snapshot without reading the whole file.

644-

const expectedSize =

645-

beforeAppendSnapshot.size + BigInt(Buffer.byteLength(serializedAppend, "utf8"));

662+

const expectedSize = beforeAppendSnapshot.size + appendedByteLength;

646663

if (

647664

!snapshot ||

648665

!cached ||

@@ -655,11 +672,11 @@ function rememberAppendedSessionEntry(

655672

) {

656673

sessionEntriesCache.delete(resolvedPath);

657674

invalidateSessionFileRepairCache(resolvedPath);

658-

return { snapshot, cacheAdvanced: false };

675+

return { snapshot, cacheAdvanced: false, ownedAppendVerified: false };

659676

}

660677

if (snapshot.size > MAX_CACHED_SESSION_BYTES) {

661678

sessionEntriesCache.delete(resolvedPath);

662-

return { snapshot, cacheAdvanced: false };

679+

return { snapshot, cacheAdvanced: false, ownedAppendVerified: true };

663680

}

664681665682

const persistedEntry = JSON.parse(

@@ -671,7 +688,7 @@ function rememberAppendedSessionEntry(

671688

sessionEntriesCache.delete(resolvedPath);

672689

sessionEntriesCache.set(resolvedPath, cached);

673690

trimSessionEntriesCache();

674-

return { snapshot, cacheAdvanced: true };

691+

return { snapshot, cacheAdvanced: true, ownedAppendVerified: true };

675692

}

676693677694

function publishRememberedSessionFileSnapshot(

@@ -688,6 +705,15 @@ function publishRememberedSessionFileSnapshot(

688705

}

689706

}

690707708+

function canIncrementallyCacheAppendedEntry(entry: SessionEntry): boolean {

709+

return !(

710+

entry.type === "custom" ||

711+

entry.type === "custom_message" ||

712+

entry.type === "compaction" ||

713+

entry.type === "branch_summary"

714+

);

715+

}

716+691717

function readSessionFileSnapshotIfExists(filePath: string): SessionFileSnapshot | undefined {

692718

try {

693719

return readSessionFileSnapshot(filePath);

@@ -1328,13 +1354,16 @@ export class SessionManager {

13281354

// prefix state that immediately precedes the exact bytes being appended.

13291355

const serializedEntry = serializeJsonlEntry(entry);

13301356

const beforeAppendSnapshot = readSessionFileSnapshotIfExists(this.sessionFile);

1331-

const cacheOwnedAppend = Boolean(

1357+

const canPublishOwnedAppend = Boolean(

13321358

beforeAppendSnapshot &&

13331359

canAdvanceOwnedSessionEntryCache({

13341360

sessionFile: this.sessionFile,

13351361

snapshot: beforeAppendSnapshot,

13361362

}),

13371363

);

1364+

// Extension/detail-bearing entries can run arbitrary toJSON code while

1365+

// serializing, so stat-only append validation is too weak for them.

1366+

const cacheOwnedAppend = canPublishOwnedAppend && canIncrementallyCacheAppendedEntry(entry);

13381367

const serializedAppend = appendSerializedJsonlEntrySync(this.sessionFile, serializedEntry, {

13391368

prefixNewline: sessionFileNeedsAppendSeparator(this.sessionFile, beforeAppendSnapshot),

13401369

});

@@ -1344,9 +1373,10 @@ export class SessionManager {

13441373

beforeAppendSnapshot,

13451374

serializedAppend,

13461375

cacheOwnedAppend,

1376+

canPublishOwnedAppend,

13471377

);

13481378

this.sessionFileSnapshot = rememberedAppend.snapshot;

1349-

if (rememberedAppend.cacheAdvanced) {

1379+

if (rememberedAppend.ownedAppendVerified) {

13501380

publishRememberedSessionFileSnapshot(this.sessionFile, rememberedAppend.snapshot);

13511381

}

13521382

}