Skip to content

fix: dedupe identical session snapshots#1

Merged
vicary merged 1 commit into
mainfrom
fix/dedupe-session-snapshots
Mar 9, 2026
Merged

fix: dedupe identical session snapshots#1
vicary merged 1 commit into
mainfrom
fix/dedupe-session-snapshots

Conversation

@vicary

@vicary vicary commented Mar 8, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds a per-session in-memory cache that stores the last-seen snapshot content for each session ID.
  • Before ingesting a snapshot event, the handler compares the incoming content against the cached value; identical snapshots are silently skipped, eliminating redundant Graphiti ingestion calls.
  • Adds unit tests covering: first snapshot always ingested, duplicate snapshot skipped, distinct sessions tracked independently, and changed snapshot after duplicate is re-ingested.

Note

Low Risk
Low risk behavior change limited to session.idle snapshot ingestion, reducing redundant addEpisode calls. Main risk is unintentionally skipping snapshots if downstream relied on duplicates, but dedupe only applies to exact content matches and only after a successful save.

Overview
Prevents redundant Graphiti ingestion on session.idle by caching the last successfully saved snapshot body per session and skipping client.addEpisode when the newly generated snapshot is identical.

Adds unit tests covering first-snapshot behavior, skipping identical subsequent snapshots, re-saving when content changes, and ensuring failed addEpisode attempts don’t update the dedupe cache (so retries still occur).

Written by Cursor Bugbot for commit a3ff743. This will update automatically on new commits. Configure here.

@vicary vicary merged commit 7bf6a4d into main Mar 9, 2026
2 checks passed
@vicary vicary deleted the fix/dedupe-session-snapshots branch March 9, 2026 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant