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

推荐订阅源

罗磊的独立博客
U
Unit 42
N
Netflix TechBlog - Medium
人人都是产品经理
人人都是产品经理
Hugging Face - Blog
Hugging Face - Blog
腾讯CDC
小众软件
小众软件
V
Visual Studio Blog
T
Tailwind CSS Blog
Engineering at Meta
Engineering at Meta
博客园 - 叶小钗
GbyAI
GbyAI
爱范儿
爱范儿
雷峰网
雷峰网
Microsoft Azure Blog
Microsoft Azure Blog
D
DataBreaches.Net
博客园_首页
D
Docker
A
About on SuperTechFans
G
Google Developers Blog
I
InfoQ
T
The Blog of Author Tim Ferriss
V
V2EX
博客园 - Franky

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(outbound): add real-queue integration test for unkno...
rosenlo · 2026-06-25 · via Recent Commits to openclaw:main
1+

// Integration test: real SQLite delivery queue + mock adapter.

2+

// Verifies the patch end-to-end at the queue layer: when a required-mode

3+

// batch send fails mid-batch after an earlier payload already succeeded,

4+

// the queue entry advances to recovery_state=unknown_after_send (not left

5+

// in send_attempt_started), so reconnect-drain routes it through

6+

// reconcileUnknownQueuedDelivery instead of blind replay.

7+

import { describe, expect, it, vi, beforeAll, beforeEach } from "vitest";

8+

import type { OpenClawConfig } from "../../config/config.js";

9+

import { installDeliveryQueueTmpDirHooks, readQueuedEntry } from "./delivery-queue.test-helpers.js";

10+11+

let deliverOutboundPayloads: typeof import("./deliver.js").deliverOutboundPayloads;

12+13+

describe("deliverOutboundPayloads queue integration: mid-batch failure with send evidence", () => {

14+

const fixtures = installDeliveryQueueTmpDirHooks();

15+

let tmpDir: string;

16+17+

beforeAll(async () => {

18+

({ deliverOutboundPayloads } = await import("./deliver.js"));

19+

});

20+21+

beforeEach(() => {

22+

tmpDir = fixtures.tmpDir();

23+

});

24+25+

it("advances queued entry to unknown_after_send when a later payload fails after an earlier one succeeded", async () => {

26+

process.env.OPENCLAW_STATE_DIR = tmpDir;

27+

// First payload succeeds (send evidence), second payload throws.

28+

const sendMatrix = vi

29+

.fn()

30+

.mockResolvedValueOnce({ messageId: "m1" })

31+

.mockRejectedValueOnce(new Error("second payload send failed"));

32+33+

await expect(

34+

deliverOutboundPayloads({

35+

cfg: {} as OpenClawConfig,

36+

channel: "matrix",

37+

to: "!room:example",

38+

payloads: [{ text: "first" }, { text: "second" }],

39+

deps: { matrix: sendMatrix },

40+

queuePolicy: "required",

41+

}),

42+

).rejects.toThrow("second payload send failed");

43+44+

// The entry must exist in the real SQLite queue and be in unknown_after_send.

45+

const entries = await import("./delivery-queue.js").then((m) =>

46+

m.loadPendingDeliveries(tmpDir),

47+

);

48+

expect(entries).toHaveLength(1);

49+

const entry = entries[0]!;

50+

expect(entry.recoveryState).toBe("unknown_after_send");

51+

expect(entry.retryCount).toBe(0);

52+

expect(entry.lastError).toBeUndefined();

53+

// Sanity: the send actually happened for the first payload.

54+

expect(sendMatrix).toHaveBeenCalledTimes(2);

55+

});

56+57+

it("leaves entry for retry (failDelivery, recovery_state stays null) when no send evidence", async () => {

58+

process.env.OPENCLAW_STATE_DIR = tmpDir;

59+

// First (and only) payload fails immediately — no send evidence.

60+

const sendMatrix = vi.fn().mockRejectedValueOnce(new Error("first payload send failed"));

61+62+

await expect(

63+

deliverOutboundPayloads({

64+

cfg: {} as OpenClawConfig,

65+

channel: "matrix",

66+

to: "!room:example",

67+

payloads: [{ text: "first" }],

68+

deps: { matrix: sendMatrix },

69+

queuePolicy: "required",

70+

}),

71+

).rejects.toThrow("first payload send failed");

72+73+

const entries = await import("./delivery-queue.js").then((m) =>

74+

m.loadPendingDeliveries(tmpDir),

75+

);

76+

expect(entries).toHaveLength(1);

77+

const entry = entries[0]!;

78+

// No send evidence -> failDelivery path: retryCount bumped, recovery_state not advanced.

79+

expect(entry.retryCount).toBe(1);

80+

expect(entry.recoveryState).toBe("send_attempt_started");

81+

expect(String(entry.lastError ?? "")).toContain("first payload send failed");

82+

});

83+

});