You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: persist note nudge state to DB for cache-safe restart survival
Note nudge trigger and sticky state now lives in session_meta instead
of in-memory Maps. After restart, deferred triggers aren't lost and
delivered nudges replay at the same anchored message — no cache bust.
- Added DB persistence functions following sticky turn reminder pattern
- Trigger deferral: nudge waits for next user message (not current turn)
- Sticky replay: appendReminderToUserMessageById at anchored message
- All callers updated to pass db through
- Commit detection guard: hadPriorCommitState prevents false triggers after restart
"SELECT note_nudge_trigger_pending AS triggerPending, note_nudge_trigger_message_id AS triggerMessageId, note_nudge_sticky_text AS stickyText, note_nudge_sticky_message_id AS stickyMessageId FROM session_meta WHERE session_id = ?",
62
+
)
63
+
.get(sessionId)as{
64
+
triggerPending: number;
65
+
triggerMessageId: string;
66
+
stickyText: string;
67
+
stickyMessageId: string;
68
+
}|null;
69
+
}
70
+
34
71
describe("note-nudger",()=>{
35
-
it("fires after a trigger when notes exist, then suppresses until the next trigger",()=>{
72
+
it("persists trigger deferral and sticky delivery state in session_meta",()=>{
36
73
constdb=makeDb();
37
74
addSessionNote(db,"ses-trigger","Follow up later.");
0 commit comments