We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a41ff81 commit 4ae8475Copy full SHA for 4ae8475
1 file changed
lib/state/state.ts
@@ -111,14 +111,11 @@ export async function ensureSessionInitialized(
111
}
112
113
function findLastCompactionTimestamp(messages: WithParts[]): number {
114
- let lastTimestamp = 0
115
- for (const msg of messages) {
+ for (let i = messages.length - 1; i >= 0; i--) {
+ const msg = messages[i]
116
if (msg.info.role === "assistant" && msg.info.summary === true) {
117
- const created = msg.info.time.created
118
- if (created > lastTimestamp) {
119
- lastTimestamp = created
120
- }
+ return msg.info.time.created
121
122
123
- return lastTimestamp
+ return 0
124
0 commit comments