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

推荐订阅源

U
Unit 42
T
The Blog of Author Tim Ferriss
H
Help Net Security
博客园 - 叶小钗
云风的 BLOG
云风的 BLOG
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
D
DataBreaches.Net
博客园 - 聂微东
A
About on SuperTechFans
大猫的无限游戏
大猫的无限游戏
P
Proofpoint News Feed
Martin Fowler
Martin Fowler
博客园 - 【当耐特】
S
SegmentFault 最新的问题
Blog — PlanetScale
Blog — PlanetScale
酷 壳 – CoolShell
酷 壳 – CoolShell
G
Google Developers Blog
I
InfoQ
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
GbyAI
GbyAI
B
Blog
Engineering at Meta
Engineering at Meta
V
V2EX
Hugging Face - Blog
Hugging Face - 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: avoid compaction checkpoint transcript copies (#8666...
steipete · 2026-05-26 · via Recent Commits to openclaw:main

@@ -433,6 +433,33 @@ function cloneCheckpointSessionEntry(params: {

433433

};

434434

}

435435436+

function resolveCheckpointForkSource(

437+

checkpoint: NonNullable<ReturnType<typeof getSessionCompactionCheckpoint>>,

438+

): { sourceFile: string; sourceLeafId?: string; totalTokens?: number } | null {

439+

const preCompactionFile = checkpoint.preCompaction.sessionFile?.trim();

440+

if (preCompactionFile) {

441+

return {

442+

sourceFile: preCompactionFile,

443+

sourceLeafId: checkpoint.preCompaction.leafId,

444+

totalTokens: checkpoint.tokensBefore,

445+

};

446+

}

447+

const postCompactionFile = checkpoint.postCompaction.sessionFile?.trim();

448+

if (!postCompactionFile) {

449+

return null;

450+

}

451+

const postCompactionLeafId =

452+

checkpoint.postCompaction.leafId ?? checkpoint.postCompaction.entryId;

453+

if (!postCompactionLeafId) {

454+

return null;

455+

}

456+

return {

457+

sourceFile: postCompactionFile,

458+

sourceLeafId: postCompactionLeafId,

459+

totalTokens: checkpoint.tokensAfter,

460+

};

461+

}

462+436463

function isAgentMainSessionKey(cfg: OpenClawConfig, sessionKey: string): boolean {

437464

const parsed = parseAgentSessionKey(sessionKey);

438465

if (!parsed) {

@@ -1555,7 +1582,8 @@ export const sessionsHandlers: GatewayRequestHandlers = {

15551582

return;

15561583

}

15571584

const checkpoint = getSessionCompactionCheckpoint({ entry, checkpointId });

1558-

if (!checkpoint?.preCompaction.sessionFile) {

1585+

const forkSource = checkpoint ? resolveCheckpointForkSource(checkpoint) : null;

1586+

if (!checkpoint || !forkSource) {

15591587

respond(

15601588

false,

15611589

undefined,

@@ -1564,8 +1592,9 @@ export const sessionsHandlers: GatewayRequestHandlers = {

15641592

return;

15651593

}

15661594

const branchedSession = await forkCompactionCheckpointTranscriptAsync({

1567-

sourceFile: checkpoint.preCompaction.sessionFile,

1568-

sessionDir: path.dirname(checkpoint.preCompaction.sessionFile),

1595+

sourceFile: forkSource.sourceFile,

1596+

sourceLeafId: forkSource.sourceLeafId,

1597+

sessionDir: path.dirname(forkSource.sourceFile),

15691598

});

15701599

if (!branchedSession?.sessionFile) {

15711600

respond(

@@ -1583,7 +1612,7 @@ export const sessionsHandlers: GatewayRequestHandlers = {

15831612

nextSessionFile: branchedSession.sessionFile,

15841613

label,

15851614

parentSessionKey: canonicalKey,

1586-

totalTokens: checkpoint.tokensBefore,

1615+

totalTokens: forkSource.totalTokens,

15871616

});

1588161715891618

await updateSessionStore(target.storePath, (store) => {

@@ -1654,7 +1683,8 @@ export const sessionsHandlers: GatewayRequestHandlers = {

16541683

return;

16551684

}

16561685

const checkpoint = getSessionCompactionCheckpoint({ entry, checkpointId });

1657-

if (!checkpoint?.preCompaction.sessionFile) {

1686+

const forkSource = checkpoint ? resolveCheckpointForkSource(checkpoint) : null;

1687+

if (!checkpoint || !forkSource) {

16581688

respond(

16591689

false,

16601690

undefined,

@@ -1677,8 +1707,9 @@ export const sessionsHandlers: GatewayRequestHandlers = {

16771707

}

1678170816791709

const restoredSession = await forkCompactionCheckpointTranscriptAsync({

1680-

sourceFile: checkpoint.preCompaction.sessionFile,

1681-

sessionDir: path.dirname(checkpoint.preCompaction.sessionFile),

1710+

sourceFile: forkSource.sourceFile,

1711+

sourceLeafId: forkSource.sourceLeafId,

1712+

sessionDir: path.dirname(forkSource.sourceFile),

16821713

});

16831714

if (!restoredSession?.sessionFile) {

16841715

respond(

@@ -1692,7 +1723,7 @@ export const sessionsHandlers: GatewayRequestHandlers = {

16921723

currentEntry: entry,

16931724

nextSessionId: restoredSession.sessionId,

16941725

nextSessionFile: restoredSession.sessionFile,

1695-

totalTokens: checkpoint.tokensBefore,

1726+

totalTokens: forkSource.totalTokens,

16961727

preserveCompactionCheckpoints: true,

16971728

});

16981729