Persist restored session metadata to Redis in loadSession#4842
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses cross-pod vMCP session consistency when sessions are restored from storage: after RestoreSession, it persists the restored session’s (potentially updated) metadata back into Redis/storage so per-backend session IDs don’t remain stale. With storage now kept current, checkSession reverts to full metadata comparison (maps.Equal) to detect any metadata drift across pods.
Changes:
- Persist restored session metadata back to storage in
loadSessionafter a successfulRestoreSession. - Revert
checkSessiondrift detection to full-map comparison viamaps.Equal. - Add unit tests covering (1) restored-metadata persistence and (2) eviction on stale per-backend session IDs.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| pkg/vmcp/server/sessionmanager/session_manager.go | Persist restored metadata to storage; restore full metadata drift detection in checkSession. |
| pkg/vmcp/server/sessionmanager/session_manager_test.go | Add tests ensuring restored metadata is written back and stale cached metadata triggers eviction. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4842 +/- ##
==========================================
+ Coverage 69.12% 69.15% +0.02%
==========================================
Files 531 531
Lines 55183 55196 +13
==========================================
+ Hits 38146 38170 +24
+ Misses 14113 14103 -10
+ Partials 2924 2923 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
After a successful RestoreSession call, write the restored session's metadata back to Redis so per-backend session IDs stay current. Backends that ignore Mcp-Session-Id hints (e.g. SSE transports) assign a fresh ID on every restore; without this write the stale IDs persisted in Redis indefinitely. With Redis kept consistent, revert checkSession's comparison from the narrowed MetadataKeyBackendIDs-only workaround (introduced in #4724) back to maps.Equal, restoring full cross-pod consistency detection for any metadata drift. Closes #4836
Summary
After a successful RestoreSession call, write the restored session's metadata back to Redis so per-backend session IDs stay current. Backends that ignore Mcp-Session-Id hints (e.g. SSE transports) assign a fresh ID on every restore; without this write the stale IDs persisted in Redis indefinitely.
With Redis kept consistent, revert checkSession's comparison from the narrowed MetadataKeyBackendIDs-only workaround (introduced in #4724) back to maps.Equal, restoring full cross-pod consistency detection for any metadata drift.
Fixes #4836
Type of change
Test plan
task test)task test-e2e)task lint-fix)Changes
Does this introduce a user-facing change?
Implementation plan
Approved implementation plan
Special notes for reviewers