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

推荐订阅源

The GitHub Blog
The GitHub Blog
A
About on SuperTechFans
The Cloudflare Blog
G
Google Developers Blog
博客园_首页
Martin Fowler
Martin Fowler
Apple Machine Learning Research
Apple Machine Learning Research
L
LangChain Blog
D
Docker
C
Check Point Blog
T
Tailwind CSS Blog
博客园 - 司徒正美
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Hugging Face - Blog
Hugging Face - Blog
Microsoft Security Blog
Microsoft Security Blog
V
V2EX
博客园 - 叶小钗
T
The Blog of Author Tim Ferriss
酷 壳 – CoolShell
酷 壳 – CoolShell
IT之家
IT之家
M
MIT News - Artificial intelligence
Microsoft Azure Blog
Microsoft Azure Blog
博客园 - 【当耐特】
GbyAI
GbyAI

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: tighten gateway node event assertions · openclaw/op...
steipete · 2026-05-11 · via Recent Commits to openclaw:main

@@ -182,6 +182,28 @@ function buildCtx(): NodeEventContext {

182182

};

183183

}

184184185+

function expectFields(value: unknown, expected: Record<string, unknown>): void {

186+

expect(value).toBeTypeOf("object");

187+

expect(value).not.toBeNull();

188+

const record = value as Record<string, unknown>;

189+

for (const [key, expectedValue] of Object.entries(expected)) {

190+

expect(record[key], key).toEqual(expectedValue);

191+

}

192+

}

193+194+

function expectPresencePersistCall(

195+

mock: ReturnType<typeof vi.fn>,

196+

deviceId: string,

197+

reason: string,

198+

): void {

199+

expect(mock).toHaveBeenCalledTimes(1);

200+

const [actualDeviceId, metadata] = mock.mock.calls[0] ?? [];

201+

expect(actualDeviceId).toBe(deviceId);

202+

expectFields(metadata, { lastSeenReason: reason });

203+

const lastSeenAtMs = (metadata as { lastSeenAtMs?: unknown } | undefined)?.lastSeenAtMs;

204+

expect(typeof lastSeenAtMs).toBe("number");

205+

}

206+185207

describe("node exec events", () => {

186208

beforeEach(() => {

187209

resetNodeEventDeduplicationForTests();

@@ -588,22 +610,25 @@ describe("voice transcript events", () => {

588610589611

expect(agentCommandMock).toHaveBeenCalledTimes(1);

590612

const [opts] = agentCommandMock.mock.calls[0] ?? [];

591-

expect(opts).toMatchObject({

613+

expectFields(opts, {

592614

message: "check provenance",

593615

deliver: false,

594616

messageChannel: "node",

595-

inputProvenance: {

596-

kind: "external_user",

597-

sourceChannel: "voice",

598-

sourceTool: "gateway.voice.transcript",

599-

},

600617

});

601-

expect(typeof opts.runId).toBe("string");

602-

expect(opts.runId).not.toBe(opts.sessionId);

603-

expect(addChatRun).toHaveBeenCalledWith(

604-

opts.runId,

605-

expect.objectContaining({ clientRunId: expect.stringMatching(/^voice-/) }),

606-

);

618+

const optsRecord = opts as Record<string, unknown>;

619+

expectFields(optsRecord.inputProvenance, {

620+

kind: "external_user",

621+

sourceChannel: "voice",

622+

sourceTool: "gateway.voice.transcript",

623+

});

624+

expect(typeof optsRecord.runId).toBe("string");

625+

expect(optsRecord.runId).not.toBe(optsRecord.sessionId);

626+

expect(addChatRun).toHaveBeenCalledTimes(1);

627+

const [runId, runMetadata] = addChatRun.mock.calls[0] ?? [];

628+

expect(runId).toBe(optsRecord.runId);

629+

const clientRunId = (runMetadata as { clientRunId?: unknown } | undefined)?.clientRunId;

630+

expect(typeof clientRunId).toBe("string");

631+

expect(clientRunId).toMatch(/^voice-/);

607632

});

608633609634

it("does not block agent dispatch when session-store touch fails", async () => {

@@ -622,7 +647,8 @@ describe("voice transcript events", () => {

622647

await Promise.resolve();

623648624649

expect(agentCommandMock).toHaveBeenCalledTimes(1);

625-

expect(warn).toHaveBeenCalledWith(expect.stringContaining("voice session-store update failed"));

650+

expect(warn).toHaveBeenCalledTimes(1);

651+

expect(String(warn.mock.calls[0]?.[0])).toContain("voice session-store update failed");

626652

});

627653628654

it("preserves existing session metadata when touching the store for voice transcripts", async () => {

@@ -669,17 +695,15 @@ describe("voice transcript events", () => {

669695

});

670696

await Promise.resolve();

671697672-

expect(updatedStore).toMatchObject({

673-

"voice-preserve-session": {

674-

sessionId: "sess-preserve",

675-

label: "existing label",

676-

spawnedBy: "agent:main:parent",

677-

parentSessionKey: "agent:main:parent",

678-

lastChannel: "discord",

679-

lastTo: "thread-1",

680-

lastAccountId: "acct-1",

681-

lastThreadId: 42,

682-

},

698+

expectFields(updatedStore?.["voice-preserve-session"], {

699+

sessionId: "sess-preserve",

700+

label: "existing label",

701+

spawnedBy: "agent:main:parent",

702+

parentSessionKey: "agent:main:parent",

703+

lastChannel: "discord",

704+

lastTo: "thread-1",

705+

lastAccountId: "acct-1",

706+

lastThreadId: 42,

683707

});

684708

});

685709

});

@@ -904,15 +928,16 @@ describe("agent request events", () => {

904928905929

expect(agentCommandMock).toHaveBeenCalledTimes(1);

906930

const [opts] = agentCommandMock.mock.calls[0] ?? [];

907-

expect(opts).toMatchObject({

931+

expectFields(opts, {

908932

message: "summarize this",

909933

sessionKey: "agent:main:main",

910934

deliver: false,

911935

channel: undefined,

912936

to: undefined,

913937

});

914-

expect(warn).toHaveBeenCalledWith(

915-

expect.stringContaining("agent delivery disabled node=node-route-miss"),

938+

expect(warn).toHaveBeenCalledTimes(1);

939+

expect(String(warn.mock.calls[0]?.[0])).toContain(

940+

"agent delivery disabled node=node-route-miss",

916941

);

917942

});

918943

@@ -938,7 +963,7 @@ describe("agent request events", () => {

938963939964

expect(agentCommandMock).toHaveBeenCalledTimes(1);

940965

const [opts] = agentCommandMock.mock.calls[0] ?? [];

941-

expect(opts).toMatchObject({

966+

expectFields(opts, {

942967

message: "route on session",

943968

sessionKey: "agent:main:main",

944969

deliver: true,

@@ -982,11 +1007,11 @@ describe("agent request events", () => {

9821007

}),

9831008

});

9841009985-

expect(parseMessageWithAttachmentsMock).toHaveBeenCalledWith(

986-

"describe",

987-

expect.any(Array),

988-

expect.objectContaining({ supportsInlineImages: false }),

989-

);

1010+

expect(parseMessageWithAttachmentsMock).toHaveBeenCalledTimes(1);

1011+

const parseCall = parseMessageWithAttachmentsMock.mock.calls[0];

1012+

expect(parseCall?.[0]).toBe("describe");

1013+

expect(Array.isArray(parseCall?.[1])).toBe(true);

1014+

expectFields(parseCall?.[2], { supportsInlineImages: false });

9901015

});

99110169921017

it("declines non-image attachments cleanly when parse throws UnsupportedAttachmentError", async () => {

@@ -1052,14 +1077,8 @@ describe("agent request events", () => {

10521077

handled: true,

10531078

reason: "persisted",

10541079

});

1055-

expect(updatePairedNodeMetadataMock).toHaveBeenCalledWith("ios-node", {

1056-

lastSeenAtMs: expect.any(Number),

1057-

lastSeenReason: "bg_app_refresh",

1058-

});

1059-

expect(updatePairedDeviceMetadataMock).toHaveBeenCalledWith("ios-node", {

1060-

lastSeenAtMs: expect.any(Number),

1061-

lastSeenReason: "bg_app_refresh",

1062-

});

1080+

expectPresencePersistCall(updatePairedNodeMetadataMock, "ios-node", "bg_app_refresh");

1081+

expectPresencePersistCall(updatePairedDeviceMetadataMock, "ios-node", "bg_app_refresh");

10631082

expect(getRecentNodePresencePersistCountForTests()).toBe(1);

10641083

});

10651084

@@ -1093,14 +1112,8 @@ describe("agent request events", () => {

10931112

{ deviceId: "ios-node" },

10941113

);

109511141096-

expect(updatePairedNodeMetadataMock).toHaveBeenCalledWith("ios-node", {

1097-

lastSeenAtMs: expect.any(Number),

1098-

lastSeenReason: "background",

1099-

});

1100-

expect(updatePairedDeviceMetadataMock).toHaveBeenCalledWith("ios-node", {

1101-

lastSeenAtMs: expect.any(Number),

1102-

lastSeenReason: "background",

1103-

});

1115+

expectPresencePersistCall(updatePairedNodeMetadataMock, "ios-node", "background");

1116+

expectPresencePersistCall(updatePairedDeviceMetadataMock, "ios-node", "background");

11041117

});

1105111811061119

it("does not throttle unknown node presence alive identities", async () => {