Skip to content

Commit b1e101b

Browse files
authored
Merge pull request #57 from rynfar/fix/resume-delta-only
fix: only send new messages on resume, not full history
2 parents b0c4162 + 5dcbae3 commit b1e101b

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

src/proxy/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ function storeSession(
118118
if (fp) fingerprintCache.set(fp, state)
119119
// Shared file store (cross-proxy resume)
120120
const key = opencodeSessionId || fp
121-
if (key) storeSharedSession(key, claudeSessionId)
121+
if (key) storeSharedSession(key, claudeSessionId, state.messageCount)
122122
}
123123

124124
/** Extract only the last user message (for resume — SDK already has history) */

src/proxy/sessionStore.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export interface StoredSession {
1818
claudeSessionId: string
1919
createdAt: number
2020
lastUsedAt: number
21+
messageCount: number
2122
}
2223

2324
const SESSION_TTL_MS = 24 * 60 * 60 * 1000 // 24 hours
@@ -73,13 +74,14 @@ export function lookupSharedSession(key: string): StoredSession | undefined {
7374
return session
7475
}
7576

76-
export function storeSharedSession(key: string, claudeSessionId: string): void {
77+
export function storeSharedSession(key: string, claudeSessionId: string, messageCount?: number): void {
7778
const store = readStore()
7879
const existing = store[key]
7980
store[key] = {
8081
claudeSessionId,
8182
createdAt: existing?.createdAt || Date.now(),
8283
lastUsedAt: Date.now(),
84+
messageCount: messageCount ?? existing?.messageCount ?? 0,
8385
}
8486
writeStore(store)
8587
}

0 commit comments

Comments
 (0)