Skip to content

Commit 93554d1

Browse files
committed
Fix janitor including ignored DCP summary messages in analysis context
1 parent b7b88ae commit 93554d1

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

lib/prompt.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,16 @@ function minimizeMessages(messages: any[], alreadyPrunedIds?: string[], protecte
2525
})
2626
.map((part: any) => {
2727
// For text parts, keep the text content (needed for user intent & retention requests)
28-
if (part.type === 'text') {
29-
return {
30-
type: 'text',
31-
text: part.text
32-
}
33-
}
28+
if (part.type === 'text') {
29+
// Filter out ignored messages (e.g., DCP summary UI messages)
30+
if (part.ignored) {
31+
return null
32+
}
33+
return {
34+
type: 'text',
35+
text: part.text
36+
}
37+
}
3438

3539
// For tool parts, keep what's needed for pruning decisions
3640
if (part.type === 'tool') {
@@ -88,6 +92,9 @@ function minimizeMessages(messages: any[], alreadyPrunedIds?: string[], protecte
8892
}
8993

9094
return minimized
95+
}).filter(msg => {
96+
// Filter out messages that have no parts (e.g., only contained ignored messages)
97+
return msg.parts && msg.parts.length > 0
9198
})
9299
}
93100

0 commit comments

Comments
 (0)