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

推荐订阅源

Apple Machine Learning Research
Apple Machine Learning Research
J
Java Code Geeks
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Last Week in AI
Last Week in AI
雷峰网
雷峰网
博客园_首页
小众软件
小众软件
美团技术团队
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
腾讯CDC
P
Proofpoint News Feed
MongoDB | Blog
MongoDB | Blog
Google DeepMind News
Google DeepMind News
MyScale Blog
MyScale Blog
U
Unit 42
The Cloudflare Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Microsoft Security Blog
Microsoft Security Blog
大猫的无限游戏
大猫的无限游戏
Engineering at Meta
Engineering at Meta
N
Netflix TechBlog - Medium
Microsoft Azure Blog
Microsoft Azure 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 silent success for non-deliverable Bedrock Telegram t...
joshavant · 2026-05-17 · via Recent Commits to openclaw:main

@@ -0,0 +1,172 @@

1+

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

2+

import {

3+

NON_DELIVERABLE_TERMINAL_TURN_REASON,

4+

resolveAttemptTrajectoryTerminal,

5+

resolveTerminalAssistantTexts,

6+

type ResolveAttemptTrajectoryTerminalParams,

7+

} from "./attempt-trajectory-status.js";

8+9+

function baseParams(

10+

overrides: Partial<ResolveAttemptTrajectoryTerminalParams> = {},

11+

): ResolveAttemptTrajectoryTerminalParams {

12+

return {

13+

aborted: false,

14+

timedOut: false,

15+

assistantTexts: [],

16+

toolMetas: [],

17+

didSendViaMessagingTool: false,

18+

didSendDeterministicApprovalPrompt: false,

19+

messagingToolSentTexts: [],

20+

messagingToolSentMediaUrls: [],

21+

messagingToolSentTargets: [],

22+

successfulCronAdds: 0,

23+

synthesizedPayloadCount: 0,

24+

...overrides,

25+

};

26+

}

27+28+

describe("attempt trajectory status", () => {

29+

it("marks a terminal turn without visible text, tools, or delivery as an error", () => {

30+

expect(resolveAttemptTrajectoryTerminal(baseParams())).toEqual({

31+

status: "error",

32+

terminalError: NON_DELIVERABLE_TERMINAL_TURN_REASON,

33+

});

34+

});

35+36+

it("keeps visible assistant text as success", () => {

37+

expect(

38+

resolveAttemptTrajectoryTerminal(baseParams({ assistantTexts: ["Visible answer."] })),

39+

).toEqual({ status: "success" });

40+

});

41+42+

it("keeps committed messaging tool delivery as success even without assistant text", () => {

43+

expect(

44+

resolveAttemptTrajectoryTerminal(

45+

baseParams({

46+

didSendViaMessagingTool: true,

47+

messagingToolSentTargets: [{ channel: "telegram" }],

48+

}),

49+

),

50+

).toEqual({ status: "success" });

51+

});

52+53+

it("does not treat an uncommitted messaging tool attempt as delivery", () => {

54+

expect(

55+

resolveAttemptTrajectoryTerminal(

56+

baseParams({

57+

didSendViaMessagingTool: true,

58+

messagingToolSentTexts: [" "],

59+

messagingToolSentMediaUrls: [" "],

60+

}),

61+

),

62+

).toEqual({

63+

status: "error",

64+

terminalError: NON_DELIVERABLE_TERMINAL_TURN_REASON,

65+

});

66+

});

67+68+

it("does not treat tool metadata alone as terminal progress", () => {

69+

expect(

70+

resolveAttemptTrajectoryTerminal(

71+

baseParams({

72+

toolMetas: [{ toolName: "read" }],

73+

}),

74+

),

75+

).toEqual({

76+

status: "error",

77+

terminalError: NON_DELIVERABLE_TERMINAL_TURN_REASON,

78+

});

79+

});

80+81+

it("keeps synthesized terminal payloads as success", () => {

82+

expect(resolveAttemptTrajectoryTerminal(baseParams({ synthesizedPayloadCount: 1 }))).toEqual({

83+

status: "success",

84+

});

85+

});

86+87+

it("keeps heartbeat responses as success", () => {

88+

expect(

89+

resolveAttemptTrajectoryTerminal(

90+

baseParams({

91+

heartbeatToolResponse: { notify: false, summary: "ok" },

92+

}),

93+

),

94+

).toEqual({

95+

status: "success",

96+

});

97+

});

98+99+

it("does not treat expected silent turns as non-deliverable failures", () => {

100+

expect(resolveAttemptTrajectoryTerminal(baseParams({ silentExpected: true }))).toEqual({

101+

status: "success",

102+

});

103+

});

104+105+

it("does not treat eligible empty silent replies as non-deliverable failures", () => {

106+

expect(

107+

resolveAttemptTrajectoryTerminal(baseParams({ emptyAssistantReplyIsSilent: true })),

108+

).toEqual({

109+

status: "success",

110+

});

111+

});

112+113+

it("does not let the raw silent policy hide ineligible empty failures", () => {

114+

expect(

115+

resolveAttemptTrajectoryTerminal(baseParams({ emptyAssistantReplyIsSilent: false })),

116+

).toEqual({

117+

status: "error",

118+

terminalError: NON_DELIVERABLE_TERMINAL_TURN_REASON,

119+

});

120+

});

121+122+

it("uses safe last-assistant fallback text for terminal delivery status", () => {

123+

expect(

124+

resolveTerminalAssistantTexts({

125+

assistantTexts: [],

126+

lastAssistantStopReason: "stop",

127+

lastAssistantVisibleText: "Fallback answer.",

128+

}),

129+

).toEqual(["Fallback answer."]);

130+

expect(

131+

resolveTerminalAssistantTexts({

132+

assistantTexts: [],

133+

lastAssistantStopReason: "error",

134+

lastAssistantVisibleText: "Raw provider error",

135+

}),

136+

).toEqual([]);

137+

});

138+139+

it("marks terminal tool-use attempts as non-deliverable without explicit delivery", () => {

140+

expect(

141+

resolveAttemptTrajectoryTerminal(

142+

baseParams({

143+

assistantTexts: ["I will update that file."],

144+

toolMetas: [{ toolName: "write" }],

145+

lastAssistantStopReason: "toolUse",

146+

}),

147+

),

148+

).toEqual({

149+

status: "error",

150+

terminalError: NON_DELIVERABLE_TERMINAL_TURN_REASON,

151+

});

152+

expect(

153+

resolveAttemptTrajectoryTerminal(

154+

baseParams({

155+

assistantTexts: ["I sent the reply."],

156+

didSendViaMessagingTool: true,

157+

messagingToolSentTexts: ["sent"],

158+

lastAssistantStopReason: "toolUse",

159+

}),

160+

),

161+

).toEqual({ status: "success" });

162+

});

163+164+

it("preserves prompt errors and interrupts", () => {

165+

expect(

166+

resolveAttemptTrajectoryTerminal(baseParams({ promptError: new Error("boom") })),

167+

).toEqual({ status: "error" });

168+

expect(resolveAttemptTrajectoryTerminal(baseParams({ timedOut: true }))).toEqual({

169+

status: "interrupted",

170+

});

171+

});

172+

});