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

推荐订阅源

Recent Announcements
Recent Announcements
人人都是产品经理
人人都是产品经理
月光博客
月光博客
博客园 - 三生石上(FineUI控件)
GbyAI
GbyAI
博客园 - 司徒正美
美团技术团队
Vercel News
Vercel News
IT之家
IT之家
U
Unit 42
Y
Y Combinator Blog
罗磊的独立博客
Microsoft Security Blog
Microsoft Security Blog
MongoDB | Blog
MongoDB | Blog
Jina AI
Jina AI
V
Visual Studio Blog
B
Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
MyScale Blog
MyScale Blog
博客园 - 叶小钗
A
About on SuperTechFans
WordPress大学
WordPress大学
Hugging Face - Blog
Hugging Face - Blog
B
Blog RSS Feed

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: clear acp prompt prefix broad matchers · openclaw/o...
steipete · 2026-05-11 · via Recent Commits to openclaw:main

@@ -24,6 +24,15 @@ describe("acp prompt cwd prefix", () => {

2424

return {};

2525

});

262627+

function chatSendPayload(requestSpy: { mock: { calls: unknown[][] } }, index = 0) {

28+

const call = requestSpy.mock.calls[index];

29+

expect(call?.[0]).toBe("chat.send");

30+

expect(call?.[2]).toEqual({ timeoutMs: null });

31+

expect(typeof call?.[1]).toBe("object");

32+

expect(call?.[1]).not.toBeNull();

33+

return call?.[1] as Record<string, unknown>;

34+

}

35+2736

async function runPromptAndCaptureRequest(

2837

options: {

2938

cwd?: string;

@@ -78,79 +87,44 @@ describe("acp prompt cwd prefix", () => {

78877988

it("redacts home directory in prompt prefix", async () => {

8089

const requestSpy = await runPromptWithCwd(path.join(os.homedir(), "openclaw-test"));

81-

expect(requestSpy).toHaveBeenCalledWith(

82-

"chat.send",

83-

expect.objectContaining({

84-

message: expect.stringMatching(/\[Working directory: ~[\\/]openclaw-test\]/),

85-

}),

86-

{ timeoutMs: null },

87-

);

90+

const payload = chatSendPayload(requestSpy);

91+

expect(typeof payload.message).toBe("string");

92+

expect(payload.message).toMatch(/\[Working directory: ~[\\/]openclaw-test\]/);

8893

});

89949095

it("keeps backslash separators when cwd uses them", async () => {

9196

const requestSpy = await runPromptWithCwd(`${os.homedir()}\\openclaw-test`);

92-

expect(requestSpy).toHaveBeenCalledWith(

93-

"chat.send",

94-

expect.objectContaining({

95-

message: expect.stringContaining("[Working directory: ~\\openclaw-test]"),

96-

}),

97-

{ timeoutMs: null },

98-

);

97+

const payload = chatSendPayload(requestSpy);

98+

expect(payload.message).toContain("[Working directory: ~\\openclaw-test]");

9999

});

100100101101

it("injects system provenance metadata when enabled", async () => {

102102

const requestSpy = await runPromptAndCaptureRequest({ provenanceMode: "meta" });

103-

expect(requestSpy).toHaveBeenCalledWith(

104-

"chat.send",

105-

expect.objectContaining({

106-

systemInputProvenance: {

107-

kind: "external_user",

108-

originSessionId: TEST_SESSION_ID,

109-

sourceChannel: "acp",

110-

sourceTool: "openclaw_acp",

111-

},

112-

systemProvenanceReceipt: undefined,

113-

}),

114-

{ timeoutMs: null },

115-

);

103+

const payload = chatSendPayload(requestSpy);

104+

expect(payload.systemInputProvenance).toEqual({

105+

kind: "external_user",

106+

originSessionId: TEST_SESSION_ID,

107+

sourceChannel: "acp",

108+

sourceTool: "openclaw_acp",

109+

});

110+

expect(payload.systemProvenanceReceipt).toBeUndefined();

116111

});

117112118113

it("injects a system provenance receipt when requested", async () => {

119114

const requestSpy = await runPromptAndCaptureRequest({ provenanceMode: "meta+receipt" });

120-

expect(requestSpy).toHaveBeenCalledWith(

121-

"chat.send",

122-

expect.objectContaining({

123-

systemInputProvenance: {

124-

kind: "external_user",

125-

originSessionId: TEST_SESSION_ID,

126-

sourceChannel: "acp",

127-

sourceTool: "openclaw_acp",

128-

},

129-

systemProvenanceReceipt: expect.stringContaining("[Source Receipt]"),

130-

}),

131-

{ timeoutMs: null },

132-

);

133-

expect(requestSpy).toHaveBeenCalledWith(

134-

"chat.send",

135-

expect.objectContaining({

136-

systemProvenanceReceipt: expect.stringContaining("bridge=openclaw-acp"),

137-

}),

138-

{ timeoutMs: null },

139-

);

140-

expect(requestSpy).toHaveBeenCalledWith(

141-

"chat.send",

142-

expect.objectContaining({

143-

systemProvenanceReceipt: expect.stringContaining(`originSessionId=${TEST_SESSION_ID}`),

144-

}),

145-

{ timeoutMs: null },

146-

);

147-

expect(requestSpy).toHaveBeenCalledWith(

148-

"chat.send",

149-

expect.objectContaining({

150-

systemProvenanceReceipt: expect.stringContaining(`targetSession=${TEST_SESSION_KEY}`),

151-

}),

152-

{ timeoutMs: null },

153-

);

115+

const payload = chatSendPayload(requestSpy);

116+

expect(payload.systemInputProvenance).toEqual({

117+

kind: "external_user",

118+

originSessionId: TEST_SESSION_ID,

119+

sourceChannel: "acp",

120+

sourceTool: "openclaw_acp",

121+

});

122+

expect(typeof payload.systemProvenanceReceipt).toBe("string");

123+

const receipt = payload.systemProvenanceReceipt as string;

124+

expect(receipt).toContain("[Source Receipt]");

125+

expect(receipt).toContain("bridge=openclaw-acp");

126+

expect(receipt).toContain(`originSessionId=${TEST_SESSION_ID}`);

127+

expect(receipt).toContain(`targetSession=${TEST_SESSION_KEY}`);

154128

});

155129156130

it("retries without provenance when the gateway rejects admin-only provenance fields", async () => {

@@ -180,28 +154,17 @@ describe("acp prompt cwd prefix", () => {

180154181155

await expect(agent.prompt(TEST_PROMPT)).rejects.toThrow("stop-after-send");

182156

expect(requestSpy).toHaveBeenCalledTimes(2);

183-

expect(requestSpy).toHaveBeenNthCalledWith(

184-

1,

185-

"chat.send",

186-

expect.objectContaining({

187-

systemInputProvenance: {

188-

kind: "external_user",

189-

originSessionId: TEST_SESSION_ID,

190-

sourceChannel: "acp",

191-

sourceTool: "openclaw_acp",

192-

},

193-

systemProvenanceReceipt: expect.stringContaining("[Source Receipt]"),

194-

}),

195-

{ timeoutMs: null },

196-

);

197-

expect(requestSpy).toHaveBeenNthCalledWith(

198-

2,

199-

"chat.send",

200-

expect.not.objectContaining({

201-

systemInputProvenance: expect.anything(),

202-

systemProvenanceReceipt: expect.anything(),

203-

}),

204-

{ timeoutMs: null },

205-

);

157+

const firstPayload = chatSendPayload(requestSpy, 0);

158+

expect(firstPayload.systemInputProvenance).toEqual({

159+

kind: "external_user",

160+

originSessionId: TEST_SESSION_ID,

161+

sourceChannel: "acp",

162+

sourceTool: "openclaw_acp",

163+

});

164+

expect(firstPayload.systemProvenanceReceipt).toContain("[Source Receipt]");

165+166+

const retryPayload = chatSendPayload(requestSpy, 1);

167+

expect(retryPayload.systemInputProvenance).toBeUndefined();

168+

expect(retryPayload.systemProvenanceReceipt).toBeUndefined();

206169

});

207170

});