Persist per-backend session IDs to transport metadata on session creation#4403
Merged
Persist per-backend session IDs to transport metadata on session creation#4403
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR ensures per-backend session IDs are persisted into the transport-session metadata at session creation time so they can survive pod restarts (e.g., when metadata is stored in Redis) and be used for future cross-pod session reconstruction.
Changes:
- Added
MetadataKeyBackendSessionPrefix = "vmcp.backend.session."for per-backend session ID metadata keys. - Extended
populateBackendMetadatato writevmcp.backend.session.{workloadID} -> backend_session_idfor each successfully connected backend. - Added unit tests validating the per-backend session ID metadata behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
pkg/vmcp/session/factory.go |
Adds the new metadata key prefix constant and persists per-backend session IDs into transport metadata during session creation. |
pkg/vmcp/session/factory_metadata_test.go |
Adds tests asserting backend session IDs are persisted into session metadata across success/empty/partial-failure cases. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4403 +/- ##
==========================================
+ Coverage 69.46% 69.48% +0.02%
==========================================
Files 485 485
Lines 49821 49823 +2
==========================================
+ Hits 34608 34622 +14
+ Misses 12535 12522 -13
- Partials 2678 2679 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…tion
Add MetadataKeyBackendSessionPrefix ("vmcp.backend.session.") constant and
extend populateBackendMetadata to write vmcp.backend.session.{workloadID} →
backend_session_id for each successfully connected backend alongside the
existing MetadataKeyBackendIDs entry.
This closes the gap identified in RC-8 (#4211): per-backend
session IDs were collected at makeSession time but never written to the
serializable transport-session metadata, so they were lost after pod restart.
With this change, the IDs flow through to Redis and are available for future
cross-pod session reconstruction.
Closes #4211
jerm-dro
approved these changes
Mar 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add MetadataKeyBackendSessionPrefix ("vmcp.backend.session.") constant and extend populateBackendMetadata to write vmcp.backend.session.{workloadID} → backend_session_id for each successfully connected backend alongside the existing MetadataKeyBackendIDs entry.
This closes the gap identified in RC-8 (#4211): per-backend session IDs were collected at makeSession time but never written to the serializable transport-session metadata, so they were lost after pod restart. With this change, the IDs flow through to Redis and are available for future cross-pod session reconstruction.
Fixes #4211
Type of change
Test plan
task test)task test-e2e)task lint-fix)Changes
Does this introduce a user-facing change?
Special notes for reviewers