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

推荐订阅源

Apple Machine Learning Research
Apple Machine Learning Research
J
Java Code Geeks
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Last Week in AI
Last Week in AI
雷峰网
雷峰网
博客园_首页
小众软件
小众软件
美团技术团队
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
腾讯CDC
P
Proofpoint News Feed
MongoDB | Blog
MongoDB | Blog
Google DeepMind News
Google DeepMind News
MyScale Blog
MyScale Blog
U
Unit 42
The Cloudflare Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Microsoft Security Blog
Microsoft Security Blog
大猫的无限游戏
大猫的无限游戏
Engineering at Meta
Engineering at Meta
N
Netflix TechBlog - Medium
Microsoft Azure Blog
Microsoft Azure 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
fix(agents): validate context engine assemble result shap...
Pluviobyte · 2026-06-01 · via Recent Commits to openclaw:main

@@ -113,6 +113,67 @@ describe("harness context engine lifecycle", () => {

113113

expect(afterTurnParams?.prePromptMessageCount).toBe(2);

114114

});

115115116+

describe("assembleHarnessContextEngine result validation", () => {

117+

// Regression for #75541: plugins that return a malformed assemble result

118+

// previously poisoned activeSession.messages with `undefined`, which then

119+

// crashed downstream with "Cannot read properties of undefined (reading

120+

// 'length')". The harness wrapper now throws a descriptive error so the

121+

// runner's existing assemble try/catch can log the engine id and fall

122+

// back to the pipeline messages instead of corrupting session state.

123+

const visibleUser = textMessage("user", "ping", 1);

124+125+

async function runAssembleWithEngineResult(result: unknown) {

126+

return assembleHarnessContextEngine({

127+

contextEngine: createContextEngine({

128+

info: { id: "broken-engine", name: "Broken engine" },

129+

assemble: vi.fn(async () => result as never),

130+

}),

131+

sessionId: sessionParams.sessionId,

132+

sessionKey: sessionParams.sessionKey,

133+

messages: [visibleUser],

134+

modelId: "gpt-test",

135+

});

136+

}

137+138+

it("passes through a well-formed AssembleResult unchanged", async () => {

139+

const wellFormed = { messages: [visibleUser], estimatedTokens: 0 };

140+

await expect(runAssembleWithEngineResult(wellFormed)).resolves.toBe(wellFormed);

141+

});

142+143+

it("rejects an undefined assemble result with the engine id", async () => {

144+

await expect(runAssembleWithEngineResult(undefined)).rejects.toThrow(

145+

/context engine "broken-engine"[\s\S]*messages/,

146+

);

147+

});

148+149+

it("rejects a null assemble result with the engine id", async () => {

150+

await expect(runAssembleWithEngineResult(null)).rejects.toThrow(

151+

/context engine "broken-engine"[\s\S]*messages/,

152+

);

153+

});

154+155+

it("rejects an assemble result missing the messages array (lossless-claw shape)", async () => {

156+

// Mirrors the malformed shape reported in #75541, where the plugin

157+

// returned an object that satisfied the truthy `if (!assembled)` guard

158+

// but omitted the required `messages` field.

159+

await expect(runAssembleWithEngineResult({ estimatedTokens: 0 })).rejects.toThrow(

160+

/assemble\(\) returned an invalid result[\s\S]*messages of type undefined/,

161+

);

162+

});

163+164+

it("rejects an assemble result whose messages field is not an array", async () => {

165+

await expect(

166+

runAssembleWithEngineResult({ messages: "all of them", estimatedTokens: 0 }),

167+

).rejects.toThrow(/messages of type string/);

168+

});

169+170+

it("rejects an assemble result whose messages field is null", async () => {

171+

await expect(

172+

runAssembleWithEngineResult({ messages: null, estimatedTokens: 0 }),

173+

).rejects.toThrow(/messages of type null/);

174+

});

175+

});

176+116177

it("keeps hidden runtime-context custom messages out of ingestBatch fallbacks", async () => {

117178

const beforePromptUser = textMessage("user", "old ask", 1);

118179

const beforePromptRuntimeContext = runtimeContextMessage("old hidden context", 2);