Repository navigation
fix(virtual-mcp): invalidate the request-cached project list on metadata writes - #7966
Merged
Merged
Conversation
…ata writes createRequestCachedVirtualMcps memoizes list() per request but only cleared the cache on create/update/delete/removeConnectionReferences. patchMetadata and clearAnalyticsSiteSlugReferences also mutate the connections row (e.g. PROJECT_FOLDER_ENSURE calls list() then patchMetadata() in the same request) without busting the cache, so a later list() in that request could replay stale data.
decocms Bot
pushed a commit
that referenced
this pull request
Oct 16, 2026
PR: #7966 fix(virtual-mcp): invalidate the request-cached project list on metadata writes Bump type: patch - decocms (apps/api/package.json): 4.498.1 -> 4.498.2 Deploy-Scope: server
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.
Bug found reading apps/api/src/storage/virtual.ts (virtual storage cleanup focus area).
createRequestCachedVirtualMcpsmemoizesVirtualMCPStorage.list()for the lifetime of one request, clearing the memo cache oncreate/update/delete/removeConnectionReferences. It missed two other methods that also mutate theconnectionsrow:patchMetadataandclearAnalyticsSiteSlugReferences.This is reachable today:
PROJECT_FOLDER_ENSURE(apps/api/src/tools/virtual/project-folder-ensure.ts) callsctx.storage.virtualMcps.list(organizationId)(populating the cache) and then, later in the same request,ctx.storage.virtualMcps.patchMetadata(...)to persistprojectFolderName— without busting the cache. Any furtherlist()call in that same request (e.g. another tool invoked in the same batched MCP call) would replay the pre-patch snapshot instead of the just-written metadata.admin.ts'sclearAnalyticsSiteSlugReferencescall has the identical gap.Fix: add both methods to the proxy's cache-clearing branch, same as the existing writers.
Verification: added
apps/api/src/storage/virtual.test.tscases that stub a minimalVirtualMCPStorageand assertlist()returns a fresh (non-identical) result afterpatchMetadata()orclearAnalyticsSiteSlugReferences()— previously these would have failed since both calls were no-ops for the cache. Reviewer can runbun test apps/api/src/storage/virtual.test.ts.Locally ran:
bun run fmt,cd apps/api && bunx tsc --noEmit,bun test apps/api/src/storage/virtual.test.ts,bunx oxlint apps/api/src/storage/virtual.ts apps/api/src/storage/virtual.test.ts— all clean. Full CI validates the rest.🤖 Generated with Claude Code
Summary by cubic
Fixes the request-cached virtual MCP project list so it no longer serves stale data after metadata writes.
createRequestCachedVirtualMcpsmemoizeslist()per request and cleared its cache oncreate/update/delete/removeConnectionReferences, but not onpatchMetadataorclearAnalyticsSiteSlugReferences. Both mutate the sameconnectionsrow, so alist()call later in the same request could replay the pre-write snapshot.PROJECT_FOLDER_ENSUREhits this today by callinglist()thenpatchMetadata()in one request.patchMetadataandclearAnalyticsSiteSlugReferencesto the cache-clearing branch.list()returns a fresh result after each of these writes.Written for commit 5a9108a. Summary will update on new commits.