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

推荐订阅源

Apple Machine Learning Research
Apple Machine Learning Research
J
Java Code Geeks
博客园 - 聂微东
Microsoft Azure Blog
Microsoft Azure Blog
量子位
T
Tailwind CSS Blog
Vercel News
Vercel News
I
InfoQ
Stack Overflow Blog
Stack Overflow Blog
U
Unit 42
Engineering at Meta
Engineering at Meta
L
LangChain Blog
大猫的无限游戏
大猫的无限游戏
D
Docker
博客园_首页
P
Proofpoint News Feed
月光博客
月光博客
T
The Blog of Author Tim Ferriss
MyScale Blog
MyScale Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Martin Fowler
Martin Fowler
腾讯CDC
N
Netflix TechBlog - Medium
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

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(auto-reply): guard missing dispatcher getFailedCounts...
clawsweeper · 2026-06-02 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -1575,7 +1575,7 @@ export async function handleFeishuMessage(params: {

15751575

turnResult.dispatched &&

15761576

shouldSendNoVisibleReplyFallback({

15771577

...turnResult.dispatchResult,

1578-

failedCounts: dispatcher.getFailedCounts(),

1578+

failedCounts: dispatcher.getFailedCounts?.() ?? { tool: 0, block: 0, final: 0 },

15791579

})

15801580

) {

15811581

await ensureNoVisibleReplyFallback("broadcast-dispatch-complete-no-visible-reply");

@@ -1771,7 +1771,7 @@ export async function handleFeishuMessage(params: {

17711771

if (

17721772

shouldSendNoVisibleReplyFallback({

17731773

...dispatchResult,

1774-

failedCounts: dispatcher.getFailedCounts(),

1774+

failedCounts: dispatcher.getFailedCounts?.() ?? { tool: 0, block: 0, final: 0 },

17751775

})

17761776

) {

17771777

await ensureNoVisibleReplyFallback("dispatch-complete-no-visible-reply");

Original file line numberDiff line numberDiff line change

@@ -16,6 +16,7 @@ import type { FinalizedMsgContext } from "../templating.js";

1616

import type { ReplyPayload } from "../types.js";

1717

import { waitForReplyDispatcherIdle } from "./reply-dispatcher.js";

1818

import type { ReplyDispatchKind, ReplyDispatcher } from "./reply-dispatcher.types.js";

19+

import { readDispatcherFailedCounts } from "./reply-dispatcher.types.js";

1920

import { resolveRoutedDeliveryThreadId } from "./routed-delivery-thread.js";

2021
2122

const routeReplyRuntimeLoader = createLazyImportLoader(() => import("./route-reply.runtime.js"));

@@ -257,7 +258,7 @@ export function createAcpDispatchDeliveryCoordinator(params: {

257258

state.settledDirectVisibleText = true;

258259

hasPendingDirectBlockReplyDelivery = false;

259260

await params.dispatcher.waitForIdle();

260-

const failedCounts = params.dispatcher.getFailedCounts();

261+

const failedCounts = readDispatcherFailedCounts(params.dispatcher);

261262

const failedVisibleCount = failedCounts.block + failedCounts.final;

262263

if (failedVisibleCount > 0) {

263264

state.failedVisibleTextDelivery = true;

Original file line numberDiff line numberDiff line change

@@ -0,0 +1,35 @@

1+

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

2+

import { getDispatcherFinalOutcomeCounts } from "./dispatch-from-config.js";

3+

import type { ReplyDispatcher } from "./reply-dispatcher.types.js";

4+
5+

describe("getDispatcherFinalOutcomeCounts (#89116)", () => {

6+

it("returns failed: 0 when the dispatcher does not implement getFailedCounts", () => {

7+

// Some ReplyDispatcher variants omit the optional count methods entirely; the

8+

// previous code called dispatcher.getFailedCounts() unguarded and threw

9+

// "TypeError: dispatcher.getFailedCounts is not a function".

10+

const dispatcher = {

11+

getCancelledCounts: () => ({ tool: 0, block: 0, final: 2 }),

12+

// getFailedCounts intentionally absent

13+

} as unknown as ReplyDispatcher;

14+
15+

expect(() => getDispatcherFinalOutcomeCounts(dispatcher)).not.toThrow();

16+

expect(getDispatcherFinalOutcomeCounts(dispatcher)).toEqual({ cancelled: 2, failed: 0 });

17+

});

18+
19+

it("returns cancelled: 0 when getCancelledCounts is absent (existing behavior preserved)", () => {

20+

const dispatcher = {

21+

getFailedCounts: () => ({ tool: 0, block: 1, final: 3 }),

22+

} as unknown as ReplyDispatcher;

23+
24+

expect(getDispatcherFinalOutcomeCounts(dispatcher)).toEqual({ cancelled: 0, failed: 3 });

25+

});

26+
27+

it("uses the real final counts when both methods are present", () => {

28+

const dispatcher = {

29+

getCancelledCounts: () => ({ tool: 0, block: 0, final: 1 }),

30+

getFailedCounts: () => ({ tool: 0, block: 0, final: 5 }),

31+

} as unknown as ReplyDispatcher;

32+
33+

expect(getDispatcherFinalOutcomeCounts(dispatcher)).toEqual({ cancelled: 1, failed: 5 });

34+

});

35+

});

Original file line numberDiff line numberDiff line change

@@ -132,7 +132,12 @@ import { withFullRuntimeReplyConfig } from "./get-reply-fast-path.js";

132132

import { claimInboundDedupe, commitInboundDedupe, releaseInboundDedupe } from "./inbound-dedupe.js";

133133

import { resolveOriginMessageProvider } from "./origin-routing.js";

134134

import { waitForReplyDispatcherIdle } from "./reply-dispatcher.js";

135-

import type { ReplyDispatchKind, ReplyDispatcher } from "./reply-dispatcher.types.js";

135+

import type {

136+

DispatcherOutcomeCountsView,

137+

ReplyDispatchKind,

138+

ReplyDispatcher,

139+

} from "./reply-dispatcher.types.js";

140+

import { readDispatcherFailedCounts } from "./reply-dispatcher.types.js";

136141

import { replyRunRegistry, type ReplyOperation } from "./reply-run-registry.js";

137142

import { isReplyProfilerEnabled } from "./reply-timing-tracker.js";

138143

import { admitReplyTurn, resolveReplyTurnKind } from "./reply-turn-admission.js";

@@ -774,13 +779,13 @@ async function mirrorInternalSourceReplyToTranscript(params: {

774779

}

775780

}

776781
777-

function getDispatcherFinalOutcomeCounts(dispatcher: ReplyDispatcher): {

782+

export function getDispatcherFinalOutcomeCounts(dispatcher: DispatcherOutcomeCountsView): {

778783

cancelled: number;

779784

failed: number;

780785

} {

781786

return {

782787

cancelled: dispatcher.getCancelledCounts?.().final ?? 0,

783-

failed: dispatcher.getFailedCounts().final,

788+

failed: readDispatcherFailedCounts(dispatcher).final,

784789

};

785790

}

786791

@@ -903,7 +908,7 @@ function createAbortAwareDispatcher(params: {

903908

sendFinalReply: sendIfActive(params.dispatcher.sendFinalReply),

904909

waitForIdle: () => params.dispatcher.waitForIdle(),

905910

getQueuedCounts: () => params.dispatcher.getQueuedCounts(),

906-

getFailedCounts: () => params.dispatcher.getFailedCounts(),

911+

getFailedCounts: () => readDispatcherFailedCounts(params.dispatcher),

907912

markComplete: () => {

908913

if (!params.isAborted()) {

909914

params.dispatcher.markComplete();

Original file line numberDiff line numberDiff line change

@@ -18,3 +18,21 @@ export type ReplyDispatcher = {

1818

getFailedCounts: () => Record<ReplyDispatchKind, number>;

1919

markComplete: () => void;

2020

};

21+
22+

/**

23+

* Internal view for defensive outcome-count accounting. Some non-conforming

24+

* runtime dispatcher variants (for example plugin-provided dispatchers) may omit

25+

* these readers even though the public ReplyDispatcher contract requires

26+

* getFailedCounts. Read the counters through this view so the guards stay

27+

* type-correct without weakening the SDK-visible ReplyDispatcher type.

28+

*/

29+

export type DispatcherOutcomeCountsView = {

30+

getCancelledCounts?: () => Record<ReplyDispatchKind, number>;

31+

getFailedCounts?: () => Record<ReplyDispatchKind, number>;

32+

};

33+
34+

export function readDispatcherFailedCounts(

35+

dispatcher: DispatcherOutcomeCountsView,

36+

): Record<ReplyDispatchKind, number> {

37+

return dispatcher.getFailedCounts?.() ?? { tool: 0, block: 0, final: 0 };

38+

}