mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-24 11:25:50 -06:00
fix(channels): honor queued replies without receipts (#127667)
Restore compatibility-aware visible dispatch detection when legacy prepared runners return queued counters without a settled receipt. Preserve settled-receipt authority. Co-authored-by: Marvinthebored <peter@lindsey.jp>
This commit is contained in:
@@ -9,7 +9,7 @@ import { isRecentOutboundMessageIdentity } from "../message/outbound-echo.js";
|
||||
import { recordChannelBotPairLoopAndCheckSuppression } from "./bot-loop-protection.js";
|
||||
import {
|
||||
EMPTY_CHANNEL_TURN_DISPATCH_COUNTS,
|
||||
hasVisibleChannelTurnDispatchFromReceipt as hasVisibleChannelTurnDispatch,
|
||||
hasVisibleChannelTurnDispatch,
|
||||
type ChannelTurnDispatchResultLike,
|
||||
type ChannelTurnVisibleDeliverySignals,
|
||||
} from "./dispatch-result.js";
|
||||
|
||||
@@ -945,6 +945,43 @@ describe("channel turn pipeline", () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it.each([
|
||||
{
|
||||
name: "accepts compatibility counters when no receipt exists",
|
||||
dispatchResult: { queuedFinal: true, counts: { tool: 0, block: 0, final: 1 } },
|
||||
warns: false,
|
||||
},
|
||||
{
|
||||
name: "keeps a non-visible settled receipt authoritative",
|
||||
dispatchResult: {
|
||||
queuedFinal: true,
|
||||
counts: { tool: 0, block: 0, final: 1 },
|
||||
settledReceipt: {
|
||||
anyVisibleDelivered: false,
|
||||
counts: { final: { delivered: 0, failedAfterSend: 0 } },
|
||||
},
|
||||
},
|
||||
warns: true,
|
||||
},
|
||||
])("$name", async ({ dispatchResult, warns }) => {
|
||||
const log = vi.fn();
|
||||
|
||||
await runPreparedChannelTurn({
|
||||
channel: "test",
|
||||
routeSessionKey: "agent:main:test:peer",
|
||||
storePath: "/tmp/sessions.json",
|
||||
ctxPayload: createCtx(),
|
||||
recordInboundSession: createRecordInboundSession(),
|
||||
runDispatch: vi.fn(async () => dispatchResult),
|
||||
log,
|
||||
messageId: "msg-compat",
|
||||
});
|
||||
|
||||
expect(log.mock.calls.some(([event]) => event.reason === "zero-count-visible-dispatch")).toBe(
|
||||
warns,
|
||||
);
|
||||
});
|
||||
|
||||
it("does not warn for observed-path deliveries with zero queued counts", async () => {
|
||||
const events: string[] = [];
|
||||
const log = vi.fn();
|
||||
|
||||
Reference in New Issue
Block a user