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

推荐订阅源

T
Tailwind CSS Blog
博客园 - Franky
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Y
Y Combinator Blog
Hugging Face - Blog
Hugging Face - Blog
博客园 - 聂微东
L
LangChain Blog
博客园_首页
Recent Announcements
Recent Announcements
月光博客
月光博客
酷 壳 – CoolShell
酷 壳 – CoolShell
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
H
Hackread – Cybersecurity News, Data Breaches, AI and More
爱范儿
爱范儿
博客园 - 叶小钗
博客园 - 【当耐特】
The Cloudflare Blog
J
Java Code Geeks
G
Google Developers Blog
云风的 BLOG
云风的 BLOG
Blog — PlanetScale
Blog — PlanetScale
博客园 - 司徒正美
aimingoo的专栏
aimingoo的专栏
A
About on SuperTechFans

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
test(telegram): reduce reply runtime imports · openclaw/o...
steipete · 2026-04-23 · via Recent Commits to openclaw:main

@@ -1,10 +1,5 @@

11

import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";

2-

import {

3-

createReplyDispatcher,

4-

resetInboundDedupe,

5-

type GetReplyOptions,

6-

type MsgContext,

7-

} from "openclaw/plugin-sdk/reply-runtime";

2+

import type { GetReplyOptions, MsgContext } from "openclaw/plugin-sdk/reply-runtime";

83

import type { MockFn } from "openclaw/plugin-sdk/testing";

94

import { beforeEach, vi } from "vitest";

105

import type { TelegramBotDeps } from "./bot-deps.js";

@@ -31,12 +26,6 @@ type ReplyPayloadLike = {

3126

replyToId?: string;

3227

};

332834-

const _EMPTY_REPLY_COUNTS: DispatchReplyWithBufferedBlockDispatcherResult["counts"] = {

35-

block: 0,

36-

final: 0,

37-

tool: 0,

38-

};

39-4029

const { sessionStorePath } = vi.hoisted(() => ({

4130

sessionStorePath: `/tmp/openclaw-telegram-${process.pid}-${process.env.VITEST_POOL_ID ?? "0"}.json`,

4231

}));

@@ -133,29 +122,22 @@ async function dispatchHarnessReplies(

133122

const reply = await runReply(params);

134123

const payloads: ReplyPayloadLike[] =

135124

reply === undefined ? [] : Array.isArray(reply) ? reply : [reply];

136-

const dispatcher = createReplyDispatcher({

137-

deliver: async (payload, info) => {

138-

await params.dispatcherOptions.deliver?.(payload, info);

139-

},

140-

responsePrefix: params.dispatcherOptions.responsePrefix,

141-

responsePrefixContextProvider: params.dispatcherOptions.responsePrefixContextProvider,

142-

responsePrefixContext: params.dispatcherOptions.responsePrefixContext,

143-

onHeartbeatStrip: params.dispatcherOptions.onHeartbeatStrip,

144-

onSkip: (payload, info) => {

145-

params.dispatcherOptions.onSkip?.(payload, info);

146-

},

147-

onError: (err, info) => {

148-

params.dispatcherOptions.onError?.(err, info);

149-

},

150-

});

151125

let finalCount = 0;

152126

for (const payload of payloads) {

153-

if (dispatcher.sendFinalReply(payload)) {

127+

const text =

128+

typeof payload.text === "string" &&

129+

params.dispatcherOptions.responsePrefix &&

130+

!payload.text.startsWith(params.dispatcherOptions.responsePrefix)

131+

? `${params.dispatcherOptions.responsePrefix} ${payload.text}`

132+

: payload.text;

133+

const finalPayload = text === payload.text ? payload : { ...payload, text };

134+

try {

135+

await params.dispatcherOptions.deliver?.(finalPayload, { kind: "final" });

154136

finalCount += 1;

137+

} catch (err) {

138+

params.dispatcherOptions.onError?.(err, { kind: "final" });

155139

}

156140

}

157-

dispatcher.markComplete();

158-

await dispatcher.waitForIdle();

159141

return {

160142

queuedFinal: finalCount > 0,

161143

counts: {

@@ -472,7 +454,6 @@ export function makeForumGroupMessageCtx(params?: {

472454

}

473455474456

beforeEach(() => {

475-

resetInboundDedupe();

476457

loadConfig.mockReset();

477458

loadConfig.mockReturnValue(DEFAULT_TELEGRAM_TEST_CONFIG);

478459

sessionStoreEntries.value = {};