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

推荐订阅源

博客园_首页
H
Help Net Security
N
Netflix TechBlog - Medium
Apple Machine Learning Research
Apple Machine Learning Research
P
Proofpoint News Feed
A
About on SuperTechFans
V
V2EX
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
宝玉的分享
宝玉的分享
aimingoo的专栏
aimingoo的专栏
F
Fortinet All Blogs
博客园 - 【当耐特】
Microsoft Security Blog
Microsoft Security Blog
Martin Fowler
Martin Fowler
I
InfoQ
Google DeepMind News
Google DeepMind News
人人都是产品经理
人人都是产品经理
Engineering at Meta
Engineering at Meta
腾讯CDC
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
B
Blog RSS Feed
U
Unit 42
The Cloudflare Blog
Y
Y Combinator 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): carry transcript update sequence · openclaw...
samzong · 2026-05-14 · via Recent Commits to openclaw:main

@@ -55,6 +55,52 @@ function isUserAgentMessage(message: AgentMessage): message is UserAgentMessage

5555

return message.role === "user";

5656

}

575758+

type TranscriptSeqByEntryId = Map<string, number>;

59+60+

function resolveEntryTranscriptSeq(

61+

sessionManager: SessionManager,

62+

entryId: string | null | undefined,

63+

seqByEntryId: TranscriptSeqByEntryId,

64+

): number | undefined {

65+

if (!entryId) {

66+

return 0;

67+

}

68+

const cached = seqByEntryId.get(entryId);

69+

if (cached !== undefined) {

70+

return cached;

71+

}

72+

let seq = 0;

73+

for (const entry of sessionManager.getBranch(entryId)) {

74+

if (entry.type === "message" || entry.type === "compaction") {

75+

seq += 1;

76+

}

77+

seqByEntryId.set(entry.id, seq);

78+

}

79+

return seqByEntryId.get(entryId);

80+

}

81+82+

function resolveAppendedMessageSeq(params: {

83+

sessionManager: SessionManager;

84+

entryId: unknown;

85+

parentEntryId: string | null | undefined;

86+

seqByEntryId: TranscriptSeqByEntryId;

87+

}): number | undefined {

88+

if (typeof params.entryId !== "string") {

89+

return undefined;

90+

}

91+

const parentSeq = resolveEntryTranscriptSeq(

92+

params.sessionManager,

93+

params.parentEntryId,

94+

params.seqByEntryId,

95+

);

96+

if (parentSeq === undefined) {

97+

return undefined;

98+

}

99+

const messageSeq = parentSeq + 1;

100+

params.seqByEntryId.set(params.entryId, messageSeq);

101+

return messageSeq;

102+

}

103+58104

// `details` is runtime/UI metadata, not model-visible tool output. Keep the

59105

// session JSONL useful for debugging without letting metadata blobs dominate

60106

// disk, replay repair, transcript broadcasts, or future tooling that reads raw

@@ -536,8 +582,33 @@ export function installSessionToolResultGuard(

536582

const beforeWrite = opts?.beforeMessageWriteHook;

537583

const redactionConfig = opts?.redactLoggingConfig;

538584

const maxToolResultChars = resolveMaxToolResultChars(opts);

585+

const transcriptSeqByEntryId: TranscriptSeqByEntryId = new Map();

539586

let suppressNextUserMessagePersistence = opts?.suppressNextUserMessagePersistence === true;

540587588+

const getSessionFile = () =>

589+

(sessionManager as { getSessionFile?: () => string | null }).getSessionFile?.();

590+591+

const appendMessageAndCacheTranscriptSeq = (

592+

message: AgentMessage,

593+

): { entryId: string; messageSeq?: number; sessionFile?: string | null } => {

594+

const parentEntryId = sessionManager.getLeafId();

595+

const entryId = originalAppend(message as never);

596+

const sessionFile = getSessionFile();

597+

if (!sessionFile) {

598+

return { entryId, sessionFile };

599+

}

600+

return {

601+

entryId,

602+

sessionFile,

603+

messageSeq: resolveAppendedMessageSeq({

604+

sessionManager,

605+

entryId,

606+

parentEntryId,

607+

seqByEntryId: transcriptSeqByEntryId,

608+

}),

609+

};

610+

};

611+541612

/**

542613

* Run the before_message_write hook. Returns the (possibly modified) message,

543614

* or null if the message should be blocked.

@@ -575,8 +646,8 @@ export function installSessionToolResultGuard(

575646

}),

576647

);

577648

if (flushed) {

578-

originalAppend(

579-

capToolResultForPersistence(flushed, maxToolResultChars, redactionConfig) as never,

649+

appendMessageAndCacheTranscriptSeq(

650+

capToolResultForPersistence(flushed, maxToolResultChars, redactionConfig),

580651

);

581652

}

582653

}

@@ -629,9 +700,9 @@ export function installSessionToolResultGuard(

629700

if (!persisted) {

630701

return undefined;

631702

}

632-

return originalAppend(

633-

capToolResultForPersistence(persisted, maxToolResultChars, redactionConfig) as never,

634-

);

703+

return appendMessageAndCacheTranscriptSeq(

704+

capToolResultForPersistence(persisted, maxToolResultChars, redactionConfig),

705+

).entryId;

635706

}

636707637708

// Skip tool call extraction for aborted/errored assistant messages.

@@ -675,17 +746,18 @@ export function installSessionToolResultGuard(

675746

suppressNextUserMessagePersistence = false;

676747

return undefined;

677748

}

678-

const result = originalAppend(finalMessage as never);

679-680-

const sessionFile = (

681-

sessionManager as { getSessionFile?: () => string | null }

682-

).getSessionFile?.();

749+

const {

750+

entryId: result,

751+

messageSeq,

752+

sessionFile,

753+

} = appendMessageAndCacheTranscriptSeq(finalMessage);

683754

if (sessionFile) {

684755

emitSessionTranscriptUpdate({

685756

sessionFile,

686757

sessionKey: opts?.sessionKey,

687758

message: finalMessage,

688759

messageId: typeof result === "string" ? result : undefined,

760+

...(messageSeq !== undefined ? { messageSeq } : {}),

689761

});

690762

}

691763