Skip to content

Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.

test(openclaw): restore tool placeholder capture contract (#2747)

Mingjian Queac208dd18453
diff --git a/examples/openclaw-plugin/tests/ut/text-utils.test.ts b/examples/openclaw-plugin/tests/ut/text-utils.test.ts
index 29c9b0ff5..de052ed19 100644
--- a/examples/openclaw-plugin/tests/ut/text-utils.test.ts
+++ b/examples/openclaw-plugin/tests/ut/text-utils.test.ts
@@ -223,7 +223,7 @@ describe("extractNewTurnTexts", () => {
});
describe("extractNewTurnMessages", () => {
- it("keeps assistant toolCall messages that have no text block", () => {
+ it("drops assistant toolCall messages that have no text block", () => {
const messages = [
{
role: "assistant",
@@ -237,15 +237,10 @@ describe("extractNewTurnMessages", () => {
const { messages: extracted, newCount } = extractNewTurnMessages(messages, 0);
expect(newCount).toBe(1);
- expect(extracted).toEqual([
- {
- role: "assistant",
- parts: [{ type: "text", text: "[tool: read_file]" }],
- },
- ]);
+ expect(extracted).toEqual([]);
});
- it("keeps assistant toolUse messages that have no text block", () => {
+ it("drops assistant toolUse messages that have no text block", () => {
const messages = [
{
role: "assistant",
@@ -259,15 +254,10 @@ describe("extractNewTurnMessages", () => {
const { messages: extracted, newCount } = extractNewTurnMessages(messages, 0);
expect(newCount).toBe(1);
- expect(extracted).toEqual([
- {
- role: "assistant",
- parts: [{ type: "text", text: "[tool: grep]" }],
- },
- ]);
+ expect(extracted).toEqual([]);
});
- it("keeps multiple textless assistant tool calls in one placeholder", () => {
+ it("does not synthesize placeholders for multiple textless assistant tool calls", () => {
const messages = [
{
role: "assistant",
@@ -280,12 +270,7 @@ describe("extractNewTurnMessages", () => {
const { messages: extracted } = extractNewTurnMessages(messages, 0);
- expect(extracted).toEqual([
- {
- role: "assistant",
- parts: [{ type: "text", text: "[tool: read_file, grep]" }],
- },
- ]);
+ expect(extracted).toEqual([]);
});
it("does not create a placeholder for textless assistant messages without tool calls", () => {