Skip to content

Commit b0468d7

Browse files
committed
fix(summary): skip thinking callback for summary assistant messages
1 parent 0a582da commit b0468d7

2 files changed

Lines changed: 26 additions & 1 deletion

File tree

src/summary/aggregator.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,10 @@ class SummaryAggregator {
304304
this.messageCount++;
305305
this.startTypingIndicator();
306306

307+
const isSummaryMessage = (info as { summary?: boolean }).summary === true;
308+
307309
// Notify that agent started thinking
308-
if (this.onThinkingCallback) {
310+
if (!isSummaryMessage && this.onThinkingCallback) {
309311
const callback = this.onThinkingCallback;
310312
setImmediate(() => {
311313
if (typeof callback === "function") {

tests/summary/aggregator.test.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,29 @@ describe("summary/aggregator", () => {
159159
expect(onThinking).toHaveBeenCalledWith("session-1");
160160
});
161161

162+
it("does not send thinking callback for summary assistant messages", async () => {
163+
const onThinking = vi.fn();
164+
summaryAggregator.setOnThinking(onThinking);
165+
summaryAggregator.setSession("session-1");
166+
167+
summaryAggregator.processEvent({
168+
type: "message.updated",
169+
properties: {
170+
info: {
171+
id: "message-summary",
172+
sessionID: "session-1",
173+
role: "assistant",
174+
summary: true,
175+
time: { created: Date.now() },
176+
},
177+
},
178+
} as unknown as Event);
179+
180+
await new Promise<void>((resolve) => setImmediate(resolve));
181+
182+
expect(onThinking).not.toHaveBeenCalled();
183+
});
184+
162185
it("sends apply_patch payload as tool file", () => {
163186
const onToolFile = vi.fn();
164187
summaryAggregator.setOnToolFile(onToolFile);

0 commit comments

Comments
 (0)