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

推荐订阅源

Blog — PlanetScale
Blog — PlanetScale
Y
Y Combinator Blog
G
Google Developers Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
L
LangChain Blog
S
SegmentFault 最新的问题
J
Java Code Geeks
V
Visual Studio Blog
H
Help Net Security
Stack Overflow Blog
Stack Overflow Blog
aimingoo的专栏
aimingoo的专栏
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
T
Tailwind CSS Blog
Microsoft Azure Blog
Microsoft Azure Blog
博客园_首页
H
Hackread – Cybersecurity News, Data Breaches, AI and More
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - Franky
B
Blog RSS Feed
The Cloudflare Blog
MyScale Blog
MyScale Blog
月光博客
月光博客
Microsoft Security Blog
Microsoft Security Blog
美团技术团队

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
perf(test): trim hot gateway and infra tests · openclaw/o...
steipete · 2026-04-23 · via Recent Commits to openclaw:main

@@ -1035,6 +1035,48 @@ describe("gateway server sessions", () => {

10351035

"sessions.compact",

10361036

]),

10371037

);

1038+

const sessionsHandlers = await getSessionsHandlers();

1039+

const directContext = {

1040+

broadcastToConnIds: vi.fn(),

1041+

getSessionEventSubscriberConnIds: () => new Set<string>(),

1042+

loadGatewayModelCatalog: async () => piSdkMock.models,

1043+

} as never;

1044+

async function directSessionReq<TPayload = unknown>(

1045+

method: keyof typeof sessionsHandlers,

1046+

params: Record<string, unknown>,

1047+

coercePayload?: (payload: unknown) => TPayload,

1048+

): Promise<{ ok: boolean; payload?: TPayload; error?: unknown }> {

1049+

let result:

1050+

| {

1051+

ok: boolean;

1052+

payload?: TPayload;

1053+

error?: unknown;

1054+

}

1055+

| undefined;

1056+

await sessionsHandlers[method]({

1057+

req: {} as never,

1058+

params,

1059+

respond: (ok, payload, error) => {

1060+

result = {

1061+

ok,

1062+

payload:

1063+

payload === undefined

1064+

? undefined

1065+

: coercePayload

1066+

? coercePayload(payload)

1067+

: (payload as TPayload),

1068+

error,

1069+

};

1070+

},

1071+

context: directContext,

1072+

client: null,

1073+

isWebchatConnect: () => false,

1074+

});

1075+

if (!result) {

1076+

throw new Error(`${method} did not respond`);

1077+

}

1078+

return result;

1079+

}

1038108010391081

const resolvedByKey = await rpcReq<{ ok: true; key: string }>(ws, "sessions.resolve", {

10401082

key: "main",

@@ -1047,8 +1089,9 @@ describe("gateway server sessions", () => {

10471089

});

10481090

expect(resolvedBySessionId.ok).toBe(true);

10491091

expect(resolvedBySessionId.payload?.key).toBe("agent:main:discord:group:dev");

1092+

ws.close();

105010931051-

const list1 = await rpcReq<{

1094+

const list1 = await directSessionReq<{

10521095

path: string;

10531096

defaults?: { model?: string | null; modelProvider?: string | null };

10541097

sessions: Array<{

@@ -1060,7 +1103,7 @@ describe("gateway server sessions", () => {

10601103

lastAccountId?: string;

10611104

deliveryContext?: { channel?: string; to?: string; accountId?: string };

10621105

}>;

1063-

}>(ws, "sessions.list", { includeGlobal: false, includeUnknown: false });

1106+

}>("sessions.list", { includeGlobal: false, includeUnknown: false });

1064110710651108

expect(list1.ok).toBe(true);

10661109

expect(list1.payload?.path).toBe(storePath);

@@ -1079,19 +1122,19 @@ describe("gateway server sessions", () => {

10791122

threadId: "1737500000.123456",

10801123

});

108111241082-

const active = await rpcReq<{

1125+

const active = await directSessionReq<{

10831126

sessions: Array<{ key: string }>;

1084-

}>(ws, "sessions.list", {

1127+

}>("sessions.list", {

10851128

includeGlobal: false,

10861129

includeUnknown: false,

10871130

activeMinutes: 5,

10881131

});

10891132

expect(active.ok).toBe(true);

10901133

expect(active.payload?.sessions.map((s) => s.key)).toEqual(["agent:main:main"]);

109111341092-

const limited = await rpcReq<{

1135+

const limited = await directSessionReq<{

10931136

sessions: Array<{ key: string }>;

1094-

}>(ws, "sessions.list", {

1137+

}>("sessions.list", {

10951138

includeGlobal: true,

10961139

includeUnknown: false,

10971140

limit: 1,

@@ -1100,7 +1143,7 @@ describe("gateway server sessions", () => {

11001143

expect(limited.payload?.sessions).toHaveLength(1);

11011144

expect(limited.payload?.sessions[0]?.key).toBe("global");

110211451103-

const patched = await rpcReq<{ ok: true; key: string }>(ws, "sessions.patch", {

1146+

const patched = await directSessionReq<{ ok: true; key: string }>("sessions.patch", {

11041147

key: "agent:main:main",

11051148

thinkingLevel: "medium",

11061149

verboseLevel: "off",

@@ -1109,30 +1152,30 @@ describe("gateway server sessions", () => {

11091152

expect(patched.payload?.ok).toBe(true);

11101153

expect(patched.payload?.key).toBe("agent:main:main");

111111541112-

const sendPolicyPatched = await rpcReq<{

1155+

const sendPolicyPatched = await directSessionReq<{

11131156

ok: true;

11141157

entry: { sendPolicy?: string };

1115-

}>(ws, "sessions.patch", { key: "agent:main:main", sendPolicy: "deny" });

1158+

}>("sessions.patch", { key: "agent:main:main", sendPolicy: "deny" });

11161159

expect(sendPolicyPatched.ok).toBe(true);

11171160

expect(sendPolicyPatched.payload?.entry.sendPolicy).toBe("deny");

111811611119-

const labelPatched = await rpcReq<{

1162+

const labelPatched = await directSessionReq<{

11201163

ok: true;

11211164

entry: { label?: string };

1122-

}>(ws, "sessions.patch", {

1165+

}>("sessions.patch", {

11231166

key: "agent:main:subagent:one",

11241167

label: "Briefing",

11251168

});

11261169

expect(labelPatched.ok).toBe(true);

11271170

expect(labelPatched.payload?.entry.label).toBe("Briefing");

112811711129-

const labelPatchedDuplicate = await rpcReq(ws, "sessions.patch", {

1172+

const labelPatchedDuplicate = await directSessionReq("sessions.patch", {

11301173

key: "agent:main:discord:group:dev",

11311174

label: "Briefing",

11321175

});

11331176

expect(labelPatchedDuplicate.ok).toBe(false);

113411771135-

const list2 = await rpcReq<{

1178+

const list2 = await directSessionReq<{

11361179

sessions: Array<{

11371180

key: string;

11381181

thinkingLevel?: string;

@@ -1141,7 +1184,7 @@ describe("gateway server sessions", () => {

11411184

label?: string;

11421185

displayName?: string;

11431186

}>;

1144-

}>(ws, "sessions.list", {});

1187+

}>("sessions.list", {});

11451188

expect(list2.ok).toBe(true);

11461189

const main2 = list2.payload?.sessions.find((s) => s.key === "agent:main:main");

11471190

expect(main2?.thinkingLevel).toBe("medium");

@@ -1151,63 +1194,63 @@ describe("gateway server sessions", () => {

11511194

expect(subagent?.label).toBe("Briefing");

11521195

expect(subagent?.displayName).toBe("Briefing");

115311961154-

const clearedVerbose = await rpcReq<{ ok: true; key: string }>(ws, "sessions.patch", {

1197+

const clearedVerbose = await directSessionReq<{ ok: true; key: string }>("sessions.patch", {

11551198

key: "agent:main:main",

11561199

verboseLevel: null,

11571200

});

11581201

expect(clearedVerbose.ok).toBe(true);

115912021160-

const list3 = await rpcReq<{

1203+

const list3 = await directSessionReq<{

11611204

sessions: Array<{

11621205

key: string;

11631206

verboseLevel?: string;

11641207

}>;

1165-

}>(ws, "sessions.list", {});

1208+

}>("sessions.list", {});

11661209

expect(list3.ok).toBe(true);

11671210

const main3 = list3.payload?.sessions.find((s) => s.key === "agent:main:main");

11681211

expect(main3?.verboseLevel).toBeUndefined();

116912121170-

const listByLabel = await rpcReq<{

1213+

const listByLabel = await directSessionReq<{

11711214

sessions: Array<{ key: string }>;

1172-

}>(ws, "sessions.list", {

1215+

}>("sessions.list", {

11731216

includeGlobal: false,

11741217

includeUnknown: false,

11751218

label: "Briefing",

11761219

});

11771220

expect(listByLabel.ok).toBe(true);

11781221

expect(listByLabel.payload?.sessions.map((s) => s.key)).toEqual(["agent:main:subagent:one"]);

117912221180-

const resolvedByLabel = await rpcReq<{ ok: true; key: string }>(ws, "sessions.resolve", {

1223+

const resolvedByLabel = await directSessionReq<{ ok: true; key: string }>("sessions.resolve", {

11811224

label: "Briefing",

11821225

agentId: "main",

11831226

});

11841227

expect(resolvedByLabel.ok).toBe(true);

11851228

expect(resolvedByLabel.payload?.key).toBe("agent:main:subagent:one");

118612291187-

const spawnedOnly = await rpcReq<{

1230+

const spawnedOnly = await directSessionReq<{

11881231

sessions: Array<{ key: string }>;

1189-

}>(ws, "sessions.list", {

1232+

}>("sessions.list", {

11901233

includeGlobal: true,

11911234

includeUnknown: true,

11921235

spawnedBy: "agent:main:main",

11931236

});

11941237

expect(spawnedOnly.ok).toBe(true);

11951238

expect(spawnedOnly.payload?.sessions.map((s) => s.key)).toEqual(["agent:main:subagent:one"]);

119612391197-

const spawnedPatched = await rpcReq<{

1240+

const spawnedPatched = await directSessionReq<{

11981241

ok: true;

11991242

entry: { spawnedBy?: string };

1200-

}>(ws, "sessions.patch", {

1243+

}>("sessions.patch", {

12011244

key: "agent:main:subagent:two",

12021245

spawnedBy: "agent:main:main",

12031246

});

12041247

expect(spawnedPatched.ok).toBe(true);

12051248

expect(spawnedPatched.payload?.entry.spawnedBy).toBe("agent:main:main");

120612491207-

const acpPatched = await rpcReq<{

1250+

const acpPatched = await directSessionReq<{

12081251

ok: true;

12091252

entry: { spawnedBy?: string; spawnDepth?: number };

1210-

}>(ws, "sessions.patch", {

1253+

}>("sessions.patch", {

12111254

key: "agent:main:acp:child",

12121255

spawnedBy: "agent:main:main",

12131256

spawnDepth: 1,

@@ -1216,15 +1259,15 @@ describe("gateway server sessions", () => {

12161259

expect(acpPatched.payload?.entry.spawnedBy).toBe("agent:main:main");

12171260

expect(acpPatched.payload?.entry.spawnDepth).toBe(1);

121812611219-

const spawnedPatchedInvalidKey = await rpcReq(ws, "sessions.patch", {

1262+

const spawnedPatchedInvalidKey = await directSessionReq("sessions.patch", {

12201263

key: "agent:main:main",

12211264

spawnedBy: "agent:main:main",

12221265

});

12231266

expect(spawnedPatchedInvalidKey.ok).toBe(false);

1224126712251268

piSdkMock.enabled = true;

12261269

piSdkMock.models = [{ id: "gpt-test-a", name: "A", provider: "openai" }];

1227-

const modelPatched = await rpcReq<{

1270+

const modelPatched = await directSessionReq<{

12281271

ok: true;

12291272

entry: {

12301273

modelOverride?: string;

@@ -1233,7 +1276,7 @@ describe("gateway server sessions", () => {

12331276

modelProvider?: string;

12341277

};

12351278

resolved?: { model?: string; modelProvider?: string };

1236-

}>(ws, "sessions.patch", {

1279+

}>("sessions.patch", {

12371280

key: "agent:main:main",

12381281

model: "openai/gpt-test-a",

12391282

});

@@ -1245,17 +1288,17 @@ describe("gateway server sessions", () => {

12451288

expect(modelPatched.payload?.resolved?.modelProvider).toBe("openai");

12461289

expect(modelPatched.payload?.resolved?.model).toBe("gpt-test-a");

124712901248-

const listAfterModelPatch = await rpcReq<{

1291+

const listAfterModelPatch = await directSessionReq<{

12491292

sessions: Array<{ key: string; modelProvider?: string; model?: string }>;

1250-

}>(ws, "sessions.list", {});

1293+

}>("sessions.list", {});

12511294

expect(listAfterModelPatch.ok).toBe(true);

12521295

const mainAfterModelPatch = listAfterModelPatch.payload?.sessions.find(

12531296

(session) => session.key === "agent:main:main",

12541297

);

12551298

expect(mainAfterModelPatch?.modelProvider).toBe("openai");

12561299

expect(mainAfterModelPatch?.model).toBe("gpt-test-a");

125713001258-

const compacted = await rpcReq<{ ok: true; compacted: boolean }>(ws, "sessions.compact", {

1301+

const compacted = await directSessionReq<{ ok: true; compacted: boolean }>("sessions.compact", {

12591302

key: "agent:main:main",

12601303

maxLines: 3,

12611304

});

@@ -1268,22 +1311,22 @@ describe("gateway server sessions", () => {

12681311

const filesAfterCompact = await fs.readdir(dir);

12691312

expect(filesAfterCompact.some((f) => f.startsWith("sess-main.jsonl.bak."))).toBe(true);

127013131271-

const deleted = await rpcReq<{ ok: true; deleted: boolean }>(ws, "sessions.delete", {

1314+

const deleted = await directSessionReq<{ ok: true; deleted: boolean }>("sessions.delete", {

12721315

key: "agent:main:discord:group:dev",

12731316

});

12741317

expect(deleted.ok).toBe(true);

12751318

expect(deleted.payload?.deleted).toBe(true);

1276-

const listAfterDelete = await rpcReq<{

1319+

const listAfterDelete = await directSessionReq<{

12771320

sessions: Array<{ key: string }>;

1278-

}>(ws, "sessions.list", {});

1321+

}>("sessions.list", {});

12791322

expect(listAfterDelete.ok).toBe(true);

12801323

expect(

12811324

listAfterDelete.payload?.sessions.some((s) => s.key === "agent:main:discord:group:dev"),

12821325

).toBe(false);

12831326

const filesAfterDelete = await fs.readdir(dir);

12841327

expect(filesAfterDelete.some((f) => f.startsWith("sess-group.jsonl.deleted."))).toBe(true);

128513281286-

const reset = await rpcReq<{

1329+

const reset = await directSessionReq<{

12871330

ok: true;

12881331

key: string;

12891332

entry: {

@@ -1293,7 +1336,7 @@ describe("gateway server sessions", () => {

12931336

lastAccountId?: string;

12941337

lastThreadId?: string | number;

12951338

};

1296-

}>(ws, "sessions.reset", { key: "agent:main:main" });

1339+

}>("sessions.reset", { key: "agent:main:main" });

12971340

expect(reset.ok).toBe(true);

12981341

expect(reset.payload?.key).toBe("agent:main:main");

12991342

expect(reset.payload?.entry.sessionId).not.toBe("sess-main");

@@ -1310,16 +1353,14 @@ describe("gateway server sessions", () => {

13101353

const filesAfterReset = await fs.readdir(dir);

13111354

expect(filesAfterReset.some((f) => f.startsWith("sess-main.jsonl.reset."))).toBe(true);

131213551313-

const badThinking = await rpcReq(ws, "sessions.patch", {

1356+

const badThinking = await directSessionReq("sessions.patch", {

13141357

key: "agent:main:main",

13151358

thinkingLevel: "banana",

13161359

});

13171360

expect(badThinking.ok).toBe(false);

13181361

expect((badThinking.error as { message?: unknown } | undefined)?.message ?? "").toMatch(

13191362

/invalid thinkinglevel/i,

13201363

);

1321-1322-

ws.close();

13231364

});

1324136513251366

test("sessions.compaction.* lists checkpoints and branches or restores from pre-compaction snapshots", async () => {