Skip to content

fix: Preserve unrelated MCP server tool caches during invalidation - #1977

Merged
jbeckwith-oai merged 1 commit into
mainfrom
codex/fix-mcp-cache-invalidation-1976
Sep 24, 2026
Merged

jbeckwith-oai merged 1 commit into
mainfrom
codex/fix-mcp-cache-invalidation-1976

Conversation

@jbeckwith-oai

@jbeckwith-oai jbeckwith-oai commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Invalidating docs can currently evict cached tools for an unrelated server named docs:extra when docs has no registered cache keys, including after a previous invalidation. Remove the fallback prefix scan so invalidation uses registered keys or the exact server name.

Add regression coverage for never-cached and repeatedly invalidated server names, confirm intended-server invalidation still works, and include an @openai/agents-core patch changeset.

Test plan

  • Both new regression cases fail before the fix; all 70 MCP cache tests pass with it.
  • All 7,374 tests across 240 files pass with pnpm test:review --maxWorkers=2; this profile excludes the repository's five optional Docker/local-process test files.
  • Build, package/example type checks, generated declarations, lint, formatting, and changeset validation pass.
  • Full CI test jobs pass on Node 22 and Node 24.3, including Node 22 published-package API checks; Windows sandbox checks also pass.
  • Two independent review rounds completed with no blocking findings.
  • Full local verification was attempted but remains incomplete: Docker sandbox tests fail because this environment cannot access the daemon or required bind paths, and the runner disconnected during broader verification. The full suites subsequently passed in CI on Node 22 and Node 24.3.

Issue number

Fixes #1976.

Checks

  • Added regression tests
  • Added a patch changeset
  • Completed independent review before submission
  • Ran the repository verification script
  • Full Node 22 and Node 24.3 CI test jobs pass (local environment limitations above)

@jbeckwith-oai
jbeckwith-oai requested a review from a team as a code owner September 24, 2026 12:31
@changeset-bot

changeset-bot Bot commented Sep 24, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 331ede1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@openai/agents-core Patch
@openai/agents-extensions Patch
@openai/agents-openai Patch
@openai/agents-realtime Patch
@openai/agents Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-24T12:34:01.259305Z 331ede1 PR opened
🔒 Security Review ✅ Completed 2026-09-24T12:34:16.016340Z 331ede1 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@markstuart-oai markstuart-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed at 331ede1. Removing the prefix scan fixes the cross-server eviction while the existing per-server key registry preserves agent-specific and custom cache-key invalidation. The regression covers both repeated invalidation and an uncached base server, and verifies that the colon-suffixed server remains cached until explicitly invalidated. No blocking findings.

Verified all 16 hosted checks passing at this head, including Node 22/24, Windows, coverage and CodeQL. Source and existing-test review only; I did not run repository tests or builds.

@jbeckwith-oai
jbeckwith-oai merged commit 4ef9008 into main Sep 24, 2026
16 checks passed
@jbeckwith-oai
jbeckwith-oai deleted the codex/fix-mcp-cache-invalidation-1976 branch September 24, 2026 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP tool cache: invalidating server 'X' deletes the cached tools of an unrelated server named 'X:suffix' via the unscoped prefix-scan fallback

3 participants