Repository navigation
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
Codecov Reportâ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## trunk #419 +/- ##
============================================
- Coverage 93.12% 92.95% -0.17%
- Complexity 1382 1393 +11
============================================
Files 59 59
Lines 4016 4062 +46
============================================
+ Hits 3740 3776 +36
- Misses 276 286 +10
Flags with carried forward coverage won't be shown. Click here to find out more. â View full report in Codecov by Harness. ð New features to boost your workflow:
|
There was a problem hiding this comment.
ðĒ Approval recommended
Static review found no blocking issues in cache isolation or protocol handling, though tests were not executed.
No open issues ð
What changed in this PR
Addresses #409 by resetting the process-local WordPress object cache between valid STDIO messages, allowing long-running connections to observe updated data without flushing shared persistent storage.
Changes:
- Adds runtime cache resets, an opt-out filter, and safe handling of unsupported or failing cache backends.
- Centralizes envelope inspection to preserve protocol errors, request IDs, and notification silence.
- Adds regression coverage and documents cache freshness behavior and limitations.
| File | Description |
|---|---|
tests/âphpunit/âIntegration/âStdioCacheInvalidationTest.php |
Tests fresh reads, permission checks, write preconditions, and backend handling. |
tests/âphpunit/âFixtures/âStdioCacheProcess.php |
Provides isolated cache doubles and real STDIO stream coverage. |
includes/âTransport/âInfrastructure/âMcpWireOrchestrator.php |
Reuses shared envelope inspection during dispatch. |
includes/âTransport/âInfrastructure/âJsonRpcRequestDecoder.php |
Adds shared request and notification envelope inspection. |
includes/âCli/âStdioServerBridge.php |
Resets runtime caches before dispatch with persistent-cache safeguards. |
docs/âguides/âcli-usage.md |
Documents reset behavior, opt-out, failures, and freshness limits. |
Review effort: Balanced
|
I'm going with #413 for #409 and closing this PR. #413 fixes the bug with a small guarded flush in The one-time STDERR warning when a drop-in does not support |
What?
Closes #409
Resets the WordPress runtime object cache before dispatching each valid JSON-RPC message in the STDIO server bridge, ensuring subsequent tool and prompt executions observe fresh state without evicting shared persistent caches.
Why?
wp mcp-adapter serveruns as a single long-lived CLI process reading from STDIN. Because WordPress's in-memory object cache persists across the entire process lifetime, changes made by external processes (WP Admin, REST API, cron, or another CLI session) never reach the STDIO server.This causes:
How?
StdioServerBridgebefore dispatching each valid request (wp_cache_flush()for the default cache;wp_cache_flush_runtime()when supported by an external cache).STDERRif an external backend lacks runtime-flush support.JsonRpcRequestDecoder::inspect_envelope()so malformed envelopes retain error precedence, cache failures preserve request IDs, and notifications remain silent.mcp_adapter_stdio_flush_runtime_cache), updated docs and added tests for live reads, permissions, etc.Use of AI Tools
AI assistance: Yes
Tool(s): Antigravity
Model(s): Gemini 3.8 Flash
Used for: Issue root-cause analysis, implementation plan drafting, creating tests and verifying implementation.
Testing Instructions
Changelog Entry