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

推荐订阅源

博客园_首页
N
Netflix TechBlog - Medium
V
Visual Studio Blog
博客园 - Franky
小众软件
小众软件
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Apple Machine Learning Research
Apple Machine Learning Research
博客园 - 三生石上(FineUI控件)
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
宝玉的分享
宝玉的分享
量子位
大猫的无限游戏
大猫的无限游戏
人人都是产品经理
人人都是产品经理
V
V2EX
The Cloudflare Blog
月光博客
月光博客
Last Week in AI
Last Week in AI
雷峰网
雷峰网
WordPress大学
WordPress大学
博客园 - 【当耐特】
博客园 - 聂微东
IT之家
IT之家
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻

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 process supervisor assertions · openclaw/op...
steipete · 2026-05-10 · via Recent Commits to openclaw:main

@@ -38,15 +38,37 @@ function createBackgroundSession(id: string, pid?: number) {

3838

});

3939

}

404041+

function requireRecord(value: unknown, label: string): Record<string, unknown> {

42+

if (!value || typeof value !== "object") {

43+

throw new Error(`expected ${label}`);

44+

}

45+

return value as Record<string, unknown>;

46+

}

47+4148

function expectSessionState(sessionId: string, expected: { exited?: boolean }) {

42-

expect(getSession(sessionId)).toMatchObject(expected);

49+

const session = requireRecord(getSession(sessionId), sessionId);

50+

if ("exited" in expected) {

51+

expect(session.exited).toBe(expected.exited);

52+

}

4353

}

44544555

function expectFinishedSessionState(

4656

sessionId: string,

4757

expected: { status?: string; exitSignal?: string | null },

4858

) {

49-

expect(getFinishedSession(sessionId)).toMatchObject(expected);

59+

const session = requireRecord(getFinishedSession(sessionId), sessionId);

60+

if ("status" in expected) {

61+

expect(session.status).toBe(expected.status);

62+

}

63+

if ("exitSignal" in expected) {

64+

expect(session.exitSignal).toBe(expected.exitSignal);

65+

}

66+

}

67+68+

function expectTextContent(value: unknown, text: string) {

69+

const content = requireRecord(value, "tool content");

70+

expect(content.type).toBe("text");

71+

expect(content.text).toBe(text);

5072

}

51735274

describe("process tool supervisor cancellation", () => {

@@ -85,10 +107,7 @@ describe("process tool supervisor cancellation", () => {

8510786108

expect(supervisorMock.cancel).toHaveBeenCalledWith("sess", "manual-cancel");

87109

expectSessionState("sess", { exited: false });

88-

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

89-

type: "text",

90-

text: "Termination requested for session sess.",

91-

});

110+

expectTextContent(result.content[0], "Termination requested for session sess.");

92111

});

9311294113

it("remove drops running session immediately when cancellation is requested", async () => {

@@ -107,10 +126,7 @@ describe("process tool supervisor cancellation", () => {

107126

expect(supervisorMock.cancel).toHaveBeenCalledWith("sess", "manual-cancel");

108127

expect(getSession("sess")).toBeUndefined();

109128

expect(getFinishedSession("sess")).toBeUndefined();

110-

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

111-

type: "text",

112-

text: "Removed session sess (termination requested).",

113-

});

129+

expectTextContent(result.content[0], "Removed session sess (termination requested).");

114130

});

115131116132

it("falls back to process-tree kill when supervisor record is missing", async () => {

@@ -126,10 +142,7 @@ describe("process tool supervisor cancellation", () => {

126142

expect(killProcessTreeMock).toHaveBeenCalledWith(4242);

127143

expect(getSession("sess-fallback")).toBeUndefined();

128144

expectFinishedSessionState("sess-fallback", { status: "failed", exitSignal: "SIGKILL" });

129-

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

130-

type: "text",

131-

text: "Killed session sess-fallback.",

132-

});

145+

expectTextContent(result.content[0], "Killed session sess-fallback.");

133146

});

134147135148

it("fails remove when no supervisor record and no pid is available", async () => {

@@ -144,10 +157,10 @@ describe("process tool supervisor cancellation", () => {

144157145158

expect(killProcessTreeMock).not.toHaveBeenCalled();

146159

expectSessionState("sess-no-pid", { exited: false });

147-

expect(result.details).toMatchObject({ status: "failed" });

148-

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

149-

type: "text",

150-

text: "Unable to remove session sess-no-pid: no active supervisor run or process id.",

151-

});

160+

expect(requireRecord(result.details, "result details").status).toBe("failed");

161+

expectTextContent(

162+

result.content[0],

163+

"Unable to remove session sess-no-pid: no active supervisor run or process id.",

164+

);

152165

});

153166

});