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

推荐订阅源

量子位
雷峰网
雷峰网
博客园 - 三生石上(FineUI控件)
月光博客
月光博客
有赞技术团队
有赞技术团队
阮一峰的网络日志
阮一峰的网络日志
Last Week in AI
Last Week in AI
G
Google Developers Blog
腾讯CDC
B
Blog
Microsoft Azure Blog
Microsoft Azure Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Microsoft Security Blog
Microsoft Security Blog
人人都是产品经理
人人都是产品经理
博客园_首页
T
Tailwind CSS Blog
C
Check Point Blog
博客园 - 【当耐特】
MongoDB | Blog
MongoDB | Blog
A
About on SuperTechFans
Y
Y Combinator Blog
L
LangChain Blog
Engineering at Meta
Engineering at Meta
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
fix(qa-lab): wake stale cursor long polls · openclaw/open...
vincentkoc · 2026-05-17 · via Recent Commits to openclaw:main

@@ -1,7 +1,8 @@

11

import { Agent, createServer, request } from "node:http";

2-

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

3-

import { closeQaHttpServer, handleQaBusRequest } from "./bus-server.js";

2+

import { afterEach, describe, expect, it } from "vitest";

3+

import { closeQaHttpServer, handleQaBusRequest, startQaBusServer } from "./bus-server.js";

44

import { createQaBusState } from "./bus-state.js";

5+

import type { QaBusPollResult } from "./runtime-api.js";

5667

async function listenOnLoopback(server: ReturnType<typeof createServer>): Promise<number> {

78

await new Promise<void>((resolve, reject) => {

@@ -35,6 +36,29 @@ async function requestOnce(params: { port: number; agent: Agent }): Promise<void

3536

});

3637

}

373839+

async function pollQaBus(params: {

40+

baseUrl: string;

41+

accountId: string;

42+

cursor: number;

43+

timeoutMs: number;

44+

}): Promise<QaBusPollResult> {

45+

const response = await fetch(`${params.baseUrl}/v1/poll`, {

46+

method: "POST",

47+

headers: {

48+

"content-type": "application/json",

49+

},

50+

body: JSON.stringify({

51+

accountId: params.accountId,

52+

cursor: params.cursor,

53+

timeoutMs: params.timeoutMs,

54+

}),

55+

});

56+

if (!response.ok) {

57+

throw new Error(`qa-bus request failed: ${response.status}`);

58+

}

59+

return (await response.json()) as QaBusPollResult;

60+

}

61+3862

describe("closeQaHttpServer", () => {

3963

it("closes idle keep-alive sockets so suite processes can exit", async () => {

4064

const server = createServer((_req, res) => {

@@ -59,6 +83,54 @@ describe("closeQaHttpServer", () => {

5983

});

6084

});

618586+

describe("qa-bus server", () => {

87+

const stops: Array<() => Promise<void>> = [];

88+89+

afterEach(async () => {

90+

await Promise.all(stops.splice(0).map((stop) => stop()));

91+

});

92+93+

it("wakes stale-cursor long polls as soon as matching account traffic arrives", async () => {

94+

const state = createQaBusState();

95+

const bus = await startQaBusServer({ state });

96+

stops.push(bus.stop);

97+98+

const pending = pollQaBus({

99+

baseUrl: bus.baseUrl,

100+

accountId: "acct-a",

101+

cursor: 999,

102+

timeoutMs: 500,

103+

});

104+105+

setTimeout(() => {

106+

state.addInboundMessage({

107+

accountId: "acct-a",

108+

conversation: { id: "target", kind: "direct" },

109+

senderId: "acct-a-user",

110+

text: "fresh event",

111+

});

112+

}, 20);

113+114+

const result = await Promise.race([

115+

pending,

116+

new Promise<"timed-out">((resolve) => {

117+

setTimeout(() => resolve("timed-out"), 150);

118+

}),

119+

]);

120+121+

expect(result).not.toBe("timed-out");

122+

if (result === "timed-out") {

123+

throw new Error("stale-cursor long poll did not wake before timeout window");

124+

}

125+

expect(result.events).toHaveLength(1);

126+

expect(result.events[0]).toMatchObject({

127+

accountId: "acct-a",

128+

cursor: 1,

129+

kind: "inbound-message",

130+

});

131+

});

132+

});

133+62134

describe("handleQaBusRequest", () => {

63135

it("returns a controlled error when a v1 POST body exceeds the limit", async () => {

64136

const req = {