fix(format): filter out thinking_tokens system messages from step summary (#1479)

## Summary

Signed-off-by: anish <anishesg@users.noreply.github.com>
Co-authored-by: anish <anishesg@users.noreply.github.com>
This commit is contained in:
anish 2026-07-15 20:27:23 -07:00 committed by GitHub
parent 5bfa96a5b0
commit a1c0599a9c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 32 additions and 1 deletions

3
src/entrypoints/format-turns.ts Executable file → Normal file
View File

@ -268,7 +268,8 @@ export function groupTurnsNaturally(data: Turn[]): GroupedContent[] {
type: "system_init", type: "system_init",
tools_count: tools.length, tools_count: tools.length,
}); });
} else { } else if (subtype !== "thinking_tokens") {
// Skip thinking_tokens - internal progress events not meant for summary
groupedContent.push({ groupedContent.push({
type: "system_other", type: "system_other",
data: turn, data: turn,

View File

@ -484,4 +484,34 @@ describe("system_other handling", () => {
]); ]);
expect(markdown).toContain("## ⚙️ System Message"); expect(markdown).toContain("## ⚙️ System Message");
}); });
test("filters out thinking_tokens system messages", () => {
const data: Turn[] = [
{ type: "system", subtype: "init", tools: [{ name: "tool1" }] },
{ type: "system", subtype: "thinking_tokens" },
{ type: "system", subtype: "thinking_tokens" },
{ type: "system", subtype: "other_subtype" },
];
const grouped = groupTurnsNaturally(data);
// Should have init and other_subtype, but not thinking_tokens
expect(grouped).toHaveLength(2);
expect(grouped[0]?.type).toBe("system_init");
expect(grouped[1]?.type).toBe("system_other");
expect(grouped[1]?.data?.subtype).toBe("other_subtype");
});
test("thinking_tokens does not appear in formatted output", () => {
const data: Turn[] = [
{ type: "system", subtype: "init", tools: [] },
{ type: "system", subtype: "thinking_tokens" },
{ type: "system", subtype: "thinking_tokens" },
];
const result = formatTurnsFromData(data);
expect(result).not.toContain("thinking_tokens");
expect(result).toContain("## 🚀 System Initialization");
});
}); });