fix: persist direct chat transcript before Goosed escalation
Prevent portal direct-chat history from being lost when snapshot cache is invalidated on Goosed submit by writing non-empty messages to DB first, and stop caching empty Goose placeholder messages in snapshots. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -67,6 +67,8 @@ function resolveDisplayTitle(session, messages) {
|
||||
return deriveTitleFromMessages(messages);
|
||||
}
|
||||
|
||||
import { filterNonemptyUserVisibleMessages } from './conversation-transcript-persist.mjs';
|
||||
|
||||
async function syncConversationMemory({
|
||||
memoryV2 = null,
|
||||
conversationMemoryService = null,
|
||||
@@ -279,9 +281,8 @@ export function createSessionSnapshotService(pool, options = {}) {
|
||||
});
|
||||
if (!res.ok) return;
|
||||
const gooseSession = await res.json();
|
||||
// Store raw userVisible messages — same as write-through path.
|
||||
const messages = (gooseSession.conversation ?? [])
|
||||
.filter((m) => m.metadata?.userVisible);
|
||||
// Store userVisible messages with content — skip empty Goose placeholders.
|
||||
const messages = filterNonemptyUserVisibleMessages(gooseSession.conversation ?? []);
|
||||
await save(sessionId, userId, gooseSession, messages);
|
||||
} catch (err) {
|
||||
console.warn('[snapshot] refresh failed:', sessionId, err instanceof Error ? err.message : err);
|
||||
|
||||
Reference in New Issue
Block a user