🧰 fix: Scope MCP Registry Initialization To Config Fingerprints#13115
Conversation
|
@codex review |
There was a problem hiding this comment.
Pull request overview
Scopes the shared MCP registry "initialized" marker in Redis to a fingerprint of the current MCP config (servers + allowlists) so that, in rolling deployments with shared Redis, pods running an updated config no longer accept a stale initialized marker from the previous version. Followers also re-check the fingerprint on each retry, and a follower that becomes leader on retry will properly reinitialize.
Changes:
RegistryStatusCacheaddsisInitializedFor(configHash)/getInitializedConfigHash()and an optionalconfigHashparameter tosetInitialized, persisted under a newINITIALIZED_CONFIG_HASHkey.MCPServersInitializer.initializeis rewritten as a polling loop that compares a deterministic SHA-256 fingerprint ofrawConfigs+ allowed domains/addresses against the cached hash, and a newinitializeAsLeaderhelper centralizes the leader path.- New tests cover stale-config reinitialization and the follower-promoted-to-leader retry path during a rolling deployment.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/api/src/mcp/registry/MCPServersInitializer.ts | Compute deterministic config fingerprint, replace recursive follower retry with a loop, extract leader init into helper. |
| packages/api/src/mcp/registry/cache/RegistryStatusCache.ts | Track and compare an initialized config hash alongside the boolean status. |
| packages/api/src/mcp/registry/tests/MCPServersInitializer.test.ts | Add regression tests for stale fingerprints and follower-to-leader transitions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dc13be3109
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
dc13be3 to
39ec554
Compare
GitNexus: 🚀 deployedThe |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 39ec554793
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
GitNexus: 🚀 deployedThe |
39ec554 to
0945e8e
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
GitNexus: 🚀 deployedThe |
Summary
I fixed MCP registry initialization so rolling deployments with shared Redis do not reuse stale startup state from a different LibreChat config or hang behind an older leader pod.
Change Type
Testing
npm run reinstallnpx jest src/mcp/registry/__tests__/MCPServersInitializer.test.ts --runInBandUSE_REDIS=true REDIS_URI=redis://127.0.0.1:6387 REDIS_KEY_PREFIX=MCPRollingLocalTest4 REDIS_RETRY_MAX_ATTEMPTS=2 npx jest src/mcp/registry/__tests__/MCPServersInitializer.cache_integration.spec.ts --runInBand --coverage=false --forceExit --silentUSE_REDIS=true REDIS_URI=redis://127.0.0.1:6387 REDIS_KEY_PREFIX=MCPStatusLocalTest4 REDIS_RETRY_MAX_ATTEMPTS=2 npx jest src/mcp/registry/cache/__tests__/RegistryStatusCache.cache_integration.spec.ts --runInBand --coverage=false --forceExit --silentnpx eslint packages/api/src/mcp/registry/MCPServersInitializer.ts packages/api/src/mcp/registry/cache/RegistryStatusCache.ts packages/api/src/mcp/registry/__tests__/MCPServersInitializer.test.tsnpm run build:apigit diff --checkTest Configuration:
redis://127.0.0.1:6387Checklist