Skip to content

Persist per-backend session IDs to transport metadata on session creation#4403

Merged
yrobla merged 1 commit intomainfrom
issue-4211
Mar 30, 2026
Merged

Persist per-backend session IDs to transport metadata on session creation#4403
yrobla merged 1 commit intomainfrom
issue-4211

Conversation

@yrobla
Copy link
Copy Markdown
Contributor

@yrobla yrobla commented Mar 27, 2026

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

  • Bug fix
  • New feature
  • Refactoring (no behavior change)
  • Dependency update
  • Documentation
  • Other (describe):

Test plan

  • Unit tests (task test)
  • E2E tests (task test-e2e)
  • Linting (task lint-fix)
  • Manual testing (describe below)

Changes

File Change

Does this introduce a user-facing change?

Special notes for reviewers

@yrobla yrobla requested a review from Copilot March 27, 2026 11:33
@github-actions github-actions bot added the size/S Small PR: 100-299 lines changed label Mar 27, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 populateBackendMetadata to write vmcp.backend.session.{workloadID} -> backend_session_id for 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
Copy link
Copy Markdown

codecov bot commented Mar 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.48%. Comparing base (2a89245) to head (a1064e6).
⚠️ Report is 20 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…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
@github-actions github-actions bot added size/S Small PR: 100-299 lines changed and removed size/S Small PR: 100-299 lines changed labels Mar 27, 2026
@yrobla yrobla merged commit b93cfe1 into main Mar 30, 2026
42 of 43 checks passed
@yrobla yrobla deleted the issue-4211 branch March 30, 2026 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Small PR: 100-299 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Persist vMCP Session Metadata to Redis on Creation (RC-8)

4 participants