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

推荐订阅源

freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
T
Tailwind CSS Blog
J
Java Code Geeks
Microsoft Azure Blog
Microsoft Azure Blog
GbyAI
GbyAI
爱范儿
爱范儿
量子位
Martin Fowler
Martin Fowler
V
V2EX
博客园 - 三生石上(FineUI控件)
I
InfoQ
MongoDB | Blog
MongoDB | Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
N
Netflix TechBlog - Medium
D
DataBreaches.Net
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Last Week in AI
Last Week in AI
U
Unit 42
Apple Machine Learning Research
Apple Machine Learning Research
H
Help Net Security
T
The Blog of Author Tim Ferriss
Hugging Face - Blog
Hugging Face - Blog
美团技术团队
Engineering at Meta
Engineering at Meta

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
refactor(gateway): remove unused pending work ack path · ...
vincentkoc · 2026-06-19 · via Recent Commits to openclaw:main

@@ -3,7 +3,6 @@

33

*/

44

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

55

import {

6-

acknowledgeNodePendingWork,

76

drainNodePendingWork,

87

enqueueNodePendingWork,

98

getNodePendingWorkStateCountForTests,

@@ -26,7 +25,7 @@ describe("node pending work", () => {

2625

expect(drained.hasMore).toBe(false);

2726

});

282729-

it("dedupes explicit work by type and removes acknowledged items", () => {

28+

it("dedupes explicit work by type until the node drains it", () => {

3029

const first = enqueueNodePendingWork({ nodeId: "node-2", type: "location.request" });

3130

const second = enqueueNodePendingWork({ nodeId: "node-2", type: "location.request" });

3231

@@ -36,15 +35,11 @@ describe("node pending work", () => {

36353736

const drained = drainNodePendingWork("node-2");

3837

expect(drained.items.map((item) => item.type)).toEqual(["location.request", "status.request"]);

38+

expect(getNodePendingWorkStateCountForTests()).toBe(0);

393940-

const acked = acknowledgeNodePendingWork({

41-

nodeId: "node-2",

42-

itemIds: [first.item.id, "baseline-status"],

43-

});

44-

expect(acked.removedItemIds).toEqual([first.item.id]);

45-46-

const afterAck = drainNodePendingWork("node-2");

47-

expect(afterAck.items.map((item) => item.id)).toEqual(["baseline-status"]);

40+

const afterDrain = enqueueNodePendingWork({ nodeId: "node-2", type: "location.request" });

41+

expect(afterDrain.deduped).toBe(false);

42+

expect(afterDrain.item.id).not.toBe(first.item.id);

4843

});

49445045

it("keeps hasMore true when the baseline status item is deferred by maxItems", () => {

@@ -54,36 +49,47 @@ describe("node pending work", () => {

54495550

expect(drained.items.map((item) => item.type)).toEqual(["location.request"]);

5651

expect(drained.hasMore).toBe(true);

52+

expect(getNodePendingWorkStateCountForTests()).toBe(0);

53+54+

const next = drainNodePendingWork("node-3", { maxItems: 1 });

55+

expect(next.items.map((item) => item.id)).toEqual(["baseline-status"]);

56+

expect(next.hasMore).toBe(false);

5757

});

585859-

it("does not allocate state for drain-only nodes with no queued work", () => {

60-

expect(getNodePendingWorkStateCountForTests()).toBe(0);

59+

it("keeps explicit work queued when maxItems defers it", () => {

60+

enqueueNodePendingWork({ nodeId: "node-4", type: "status.request", priority: "normal" });

61+

enqueueNodePendingWork({ nodeId: "node-4", type: "location.request", priority: "high" });

616262-

const drained = drainNodePendingWork("node-4");

63-

const acked = acknowledgeNodePendingWork({ nodeId: "node-4", itemIds: ["baseline-status"] });

63+

const firstDrain = drainNodePendingWork("node-4", { maxItems: 1 });

64+

expect(firstDrain.items.map((item) => item.type)).toEqual(["location.request"]);

65+

expect(firstDrain.hasMore).toBe(true);

66+

expect(getNodePendingWorkStateCountForTests()).toBe(1);

646765-

expect(drained.items.map((item) => item.id)).toEqual(["baseline-status"]);

66-

expect(acked).toEqual({ revision: 0, removedItemIds: [] });

68+

const secondDrain = drainNodePendingWork("node-4", { maxItems: 1 });

69+

expect(secondDrain.items.map((item) => item.type)).toEqual(["status.request"]);

70+

expect(secondDrain.items.map((item) => item.id)).not.toEqual(["baseline-status"]);

71+

expect(secondDrain.hasMore).toBe(false);

6772

expect(getNodePendingWorkStateCountForTests()).toBe(0);

6873

});

697470-

it("prunes the state entry once all explicit items are acknowledged", () => {

71-

const { item } = enqueueNodePendingWork({ nodeId: "node-5", type: "status.request" });

72-

expect(getNodePendingWorkStateCountForTests()).toBe(1);

75+

it("does not allocate state for drain-only nodes with no queued work", () => {

76+

expect(getNodePendingWorkStateCountForTests()).toBe(0);

77+78+

const drained = drainNodePendingWork("node-5");

737974-

acknowledgeNodePendingWork({ nodeId: "node-5", itemIds: [item.id] });

80+

expect(drained.items.map((item) => item.id)).toEqual(["baseline-status"]);

7581

expect(getNodePendingWorkStateCountForTests()).toBe(0);

7682

});

77837884

it("prunes the state entry when all items expire naturally via drain", () => {

7985

const queued = enqueueNodePendingWork({

80-

nodeId: "node-6",

86+

nodeId: "node-7",

8187

type: "location.request",

8288

expiresInMs: 5_000,

8389

});

8490

expect(getNodePendingWorkStateCountForTests()).toBe(1);

859186-

const drained = drainNodePendingWork("node-6", { nowMs: Date.now() + 60_000 });

92+

const drained = drainNodePendingWork("node-7", { nowMs: Date.now() + 60_000 });

87938894

expect(drained.revision).toBeGreaterThan(queued.revision);

8995

expect(getNodePendingWorkStateCountForTests()).toBe(0);