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

推荐订阅源

P
Proofpoint News Feed
V
V2EX
WordPress大学
WordPress大学
Google DeepMind News
Google DeepMind News
Martin Fowler
Martin Fowler
小众软件
小众软件
Blog — PlanetScale
Blog — PlanetScale
月光博客
月光博客
The Cloudflare Blog
T
Tailwind CSS Blog
H
Help Net Security
腾讯CDC
爱范儿
爱范儿
人人都是产品经理
人人都是产品经理
H
Hackread – Cybersecurity News, Data Breaches, AI and More
The GitHub Blog
The GitHub Blog
Microsoft Security Blog
Microsoft Security Blog
Stack Overflow Blog
Stack Overflow Blog
D
DataBreaches.Net
C
Check Point Blog
量子位
酷 壳 – CoolShell
酷 壳 – CoolShell
美团技术团队
让小产品的独立变现更简单 - 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(telegram): fail closed on missing topic threads (#833...
steipete · 2026-05-18 · via Recent Commits to openclaw:main

@@ -10,19 +10,6 @@ import { normalizeTelegramReplyToMessageId } from "./outbound-params.js";

10101111

const TELEGRAM_STREAM_MAX_CHARS = 4096;

1212

const DEFAULT_THROTTLE_MS = 1000;

13-

const THREAD_NOT_FOUND_RE = /400:\s*Bad Request:\s*message thread not found/i;

14-15-

type TelegramSendMessageParams = Parameters<Bot["api"]["sendMessage"]>[2];

16-17-

function hasNumericMessageThreadId(

18-

params: TelegramSendMessageParams | undefined,

19-

): params is TelegramSendMessageParams & { message_thread_id: number } {

20-

return (

21-

typeof params === "object" &&

22-

params !== null &&

23-

typeof (params as { message_thread_id?: unknown }).message_thread_id === "number"

24-

);

25-

}

26132714

export type TelegramDraftStream = {

2815

update: (text: string) => void;

@@ -109,7 +96,6 @@ export function createTelegramDraftStream(params: {

10996

const minInitialChars = params.minInitialChars;

11097

const chatId = params.chatId;

11198

const threadParams = buildTelegramThreadParams(params.thread);

112-

const allowThreadlessRetry = params.thread?.scope !== "dm";

11399

const replyToMessageId = normalizeTelegramReplyToMessageId(params.replyToMessageId);

114100

const replyParams =

115101

replyToMessageId != null

@@ -136,39 +122,17 @@ export function createTelegramDraftStream(params: {

136122

renderedParseMode: "HTML" | undefined;

137123

sendGeneration: number;

138124

};

139-

const sendRenderedMessageWithThreadFallback = async (sendArgs: {

125+

const sendRenderedMessage = async (sendArgs: {

140126

renderedText: string;

141127

renderedParseMode: "HTML" | undefined;

142-

fallbackWarnMessage: string;

143128

}) => {

144129

const sendParams = sendArgs.renderedParseMode

145130

? {

146131

...replyParams,

147132

parse_mode: sendArgs.renderedParseMode,

148133

}

149134

: replyParams;

150-

const usedThreadParams = hasNumericMessageThreadId(sendParams);

151-

try {

152-

return {

153-

sent: await params.api.sendMessage(chatId, sendArgs.renderedText, sendParams),

154-

usedThreadParams,

155-

};

156-

} catch (err) {

157-

if (!allowThreadlessRetry || !usedThreadParams || !THREAD_NOT_FOUND_RE.test(String(err))) {

158-

throw err;

159-

}

160-

const threadlessParams: TelegramSendMessageParams = { ...sendParams };

161-

delete threadlessParams.message_thread_id;

162-

params.warn?.(sendArgs.fallbackWarnMessage);

163-

return {

164-

sent: await params.api.sendMessage(

165-

chatId,

166-

sendArgs.renderedText,

167-

Object.keys(threadlessParams).length > 0 ? threadlessParams : undefined,

168-

),

169-

usedThreadParams: false,

170-

};

171-

}

135+

return await params.api.sendMessage(chatId, sendArgs.renderedText, sendParams);

172136

};

173137

const sendMessageTransportPreview = async ({

174138

renderedText,

@@ -187,14 +151,12 @@ export function createTelegramDraftStream(params: {

187151

return true;

188152

}

189153

messageSendAttempted = true;

190-

let sent: Awaited<ReturnType<typeof sendRenderedMessageWithThreadFallback>>["sent"];

154+

let sent: Awaited<ReturnType<typeof sendRenderedMessage>>;

191155

try {

192-

({ sent } = await sendRenderedMessageWithThreadFallback({

156+

sent = await sendRenderedMessage({

193157

renderedText,

194158

renderedParseMode,

195-

fallbackWarnMessage:

196-

"telegram stream preview send failed with message_thread_id, retrying without thread",

197-

}));

159+

});

198160

} catch (err) {

199161

if (isSafeToRetrySendError(err) || isTelegramClientRejection(err)) {

200162

messageSendAttempted = false;