We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 73a0d35 commit bb5a230Copy full SHA for bb5a230
backend/src/util/messages.ts
@@ -296,9 +296,15 @@ export function expireMessages(
296
endOf: 'agentStep' | 'userPrompt',
297
): CodebuffMessage[] {
298
return messages.filter(
299
- (m) =>
300
- (m.timeToLive === undefined && true) ||
301
- (m.timeToLive === 'userPrompt' && endOf === 'agentStep') ||
302
- (m.timeToLive === 'agentStep' && false),
+ (m) => {
+ // Keep messages with no timeToLive
+ if (m.timeToLive === undefined) return true
+
303
+ // Remove messages that have expired
304
+ if (m.timeToLive === 'agentStep') return false
305
+ if (m.timeToLive === 'userPrompt' && endOf === 'agentStep') return false
306
307
+ return true
308
+ },
309
)
310
}
0 commit comments