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

推荐订阅源

量子位
博客园_首页
Google DeepMind News
Google DeepMind News
博客园 - Franky
The GitHub Blog
The GitHub Blog
GbyAI
GbyAI
有赞技术团队
有赞技术团队
Microsoft Azure Blog
Microsoft Azure Blog
G
Google Developers Blog
Recent Announcements
Recent Announcements
A
About on SuperTechFans
博客园 - 【当耐特】
博客园 - 三生石上(FineUI控件)
酷 壳 – CoolShell
酷 壳 – CoolShell
美团技术团队
罗磊的独立博客
IT之家
IT之家
博客园 - 聂微东
Stack Overflow Blog
Stack Overflow Blog
Jina AI
Jina AI
腾讯CDC
P
Proofpoint News Feed
Hugging Face - Blog
Hugging Face - Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com

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(reply): preserve pending thread evidence when reconci...
yetval · 2026-06-16 · via Recent Commits to openclaw:main
1+

import { afterEach, describe, expect, it } from "vitest";

2+

import { getMatchingMessagingToolReplyTargets } from "../auto-reply/reply/reply-payloads-dedupe.js";

3+

import { setActivePluginRegistry } from "../plugins/runtime.js";

4+

import { createChannelTestPluginBase, createTestRegistry } from "../test-utils/channel-plugins.js";

5+

import {

6+

extractMessagingToolSend,

7+

extractMessagingToolSendResult,

8+

} from "./embedded-agent-subscribe.tools.js";

9+10+

const PARTIAL_RESULT_PROVIDER = "partialthreadprovider";

11+12+

function createPartialResultPlugin(): unknown {

13+

return {

14+

...createChannelTestPluginBase({ id: PARTIAL_RESULT_PROVIDER }),

15+

actions: {

16+

extractToolSend: ({ args }: { args: Record<string, unknown> }) =>

17+

args.action === "send" && typeof args.to === "string"

18+

? { to: args.to, threadImplicit: true }

19+

: null,

20+

extractToolSendResult: ({ result }: { result: unknown }) => {

21+

const toolSend = (result as { details?: { toolSend?: Record<string, unknown> } })?.details

22+

?.toolSend;

23+

const to = typeof toolSend?.to === "string" ? toolSend.to : undefined;

24+

if (!to) {

25+

return null;

26+

}

27+

const threadId = typeof toolSend?.threadId === "string" ? toolSend.threadId : undefined;

28+

return {

29+

to,

30+

...(threadId ? { threadId } : {}),

31+

...(toolSend?.threadImplicit === true ? { threadImplicit: true } : {}),

32+

...(toolSend?.threadSuppressed === true ? { threadSuppressed: true } : {}),

33+

};

34+

},

35+

},

36+

threading: {

37+

resolveAutoThreadId: ({ toolContext }: { toolContext?: { currentThreadTs?: string } }) =>

38+

toolContext?.currentThreadTs,

39+

},

40+

};

41+

}

42+43+

function registerPartialResultProvider(): void {

44+

setActivePluginRegistry(

45+

createTestRegistry([

46+

{ pluginId: PARTIAL_RESULT_PROVIDER, source: "test", plugin: createPartialResultPlugin() },

47+

]),

48+

);

49+

}

50+51+

describe("extractMessagingToolSendResult thread evidence", () => {

52+

afterEach(() => {

53+

setActivePluginRegistry(createTestRegistry());

54+

});

55+56+

it("preserves implicit thread evidence when the provider result omits it", () => {

57+

registerPartialResultProvider();

58+59+

const pending = extractMessagingToolSend(

60+

"message",

61+

{ action: "send", provider: PARTIAL_RESULT_PROVIDER, to: "channel:abc", message: "answer" },

62+

{

63+

currentChannelId: "channel:abc",

64+

currentMessagingTarget: "channel:abc",

65+

currentThreadId: "root-1",

66+

replyToMode: "all",

67+

},

68+

);

69+

expect(pending?.threadImplicit).toBe(true);

70+

expect(pending?.threadId).toBe("root-1");

71+72+

const confirmed = extractMessagingToolSendResult(pending!, {

73+

details: { toolSend: { to: "channel:abc" } },

74+

});

75+

expect(confirmed.threadImplicit).toBe(true);

76+

expect(confirmed.threadId).toBe("root-1");

77+78+

const matches = getMatchingMessagingToolReplyTargets({

79+

messageProvider: PARTIAL_RESULT_PROVIDER,

80+

originatingTo: "channel:abc",

81+

originatingThreadId: "root-1",

82+

messagingToolSentTargets: [confirmed],

83+

});

84+

expect(matches).toHaveLength(1);

85+

});

86+87+

it("lets an explicit provider-reported thread override pending implicit evidence", () => {

88+

registerPartialResultProvider();

89+90+

const confirmed = extractMessagingToolSendResult(

91+

{

92+

tool: "message",

93+

provider: PARTIAL_RESULT_PROVIDER,

94+

to: "channel:abc",

95+

threadImplicit: true,

96+

},

97+

{ details: { toolSend: { to: "channel:abc", threadId: "root-9" } } },

98+

);

99+

expect(confirmed.threadId).toBe("root-9");

100+

expect(confirmed.threadImplicit).toBeUndefined();

101+

});

102+103+

it.each([

104+

{

105+

name: "provider suppression replaces pending implicit evidence",

106+

pending: {

107+

threadId: "root-1",

108+

threadImplicit: true,

109+

},

110+

result: {

111+

threadSuppressed: true,

112+

},

113+

expected: {

114+

threadId: undefined,

115+

threadImplicit: undefined,

116+

threadSuppressed: true,

117+

},

118+

},

119+

{

120+

name: "provider implicit evidence replaces pending suppression",

121+

pending: {

122+

threadSuppressed: true,

123+

},

124+

result: {

125+

threadImplicit: true,

126+

},

127+

expected: {

128+

threadId: undefined,

129+

threadImplicit: true,

130+

threadSuppressed: undefined,

131+

},

132+

},

133+

{

134+

name: "a partial result preserves pending suppression",

135+

pending: {

136+

threadSuppressed: true,

137+

},

138+

result: {},

139+

expected: {

140+

threadId: undefined,

141+

threadImplicit: undefined,

142+

threadSuppressed: true,

143+

},

144+

},

145+

])("$name", ({ pending, result, expected }) => {

146+

registerPartialResultProvider();

147+148+

const confirmed = extractMessagingToolSendResult(

149+

{

150+

tool: "message",

151+

provider: PARTIAL_RESULT_PROVIDER,

152+

to: "channel:abc",

153+

...pending,

154+

},

155+

{ details: { toolSend: { to: "channel:abc", ...result } } },

156+

);

157+158+

expect({

159+

threadId: confirmed.threadId,

160+

threadImplicit: confirmed.threadImplicit,

161+

threadSuppressed: confirmed.threadSuppressed,

162+

}).toEqual(expected);

163+

});

164+

});