feat: restartMcp key on custom ops#281
Merged
Merged
Conversation
A custom op that clears state the warm MCP daemons cache (autoload map, phpstan/phpunit result caches) can declare "restartMcp": true (all servers in the mcp block) or a list of names. After the cmd succeeds, supertool SIGTERMs those daemons via stop.py; each cold-restarts on next use with a fresh index. Skipped on cmd failure. Reserved key, not leaked as env var. Lets a single cache-clearing op also reset the warm LSP layer in one round-trip instead of leaving daemons serving stale analysis. Co-Authored-By: Max <noreply>
…nown names - Filter restartMcp names against the configured mcp block: unknown names are reported on a separate "unknown server(s) ignored" line instead of being counted as restarted (no more "restarted 1 daemon(s) (typo)" lie). - Drop the ↻ glyph from the status line for log-parser safety (ASCII). - Tests: add single-string restartMcp case, unknown-name case, and assert the excluded server is not stopped in the named-list case. Co-Authored-By: Max <noreply>
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.
Context
A custom op that clears state the warm MCP daemons cache (autoload map, PHPStan/PHPUnit result caches) had no way to also reset those daemons — they kept serving stale analysis until the idle timeout. This adds a declarative
restartMcpkey so one cache-clearing op (e.g. DVSI'sdvsi_clearcache) can clear caches and cold-restart the warm LSP layer in a single round-trip.What changed
_resolve_custom_op: after a custom op'scmdsucceeds, if the op declaresrestartMcp, SIGTERM the matching warm daemons via the existingstop.pypath (_mcp_stop_server). Each cold-restarts on next call with a fresh index."restartMcp": true→ every server in themcpblock"restartMcp": ["name", ...]→ only those serversrestartMcpadded to_RESERVED_KEYSso it isn't leaked as aSUPERTOOL_*env var.mcp: restarted N daemon(s)suffix.Test plan
tests/test_custom_ops.py— 5 new cases (all-servers, named-list, skip-on-cmd-failure, no-key-no-restart). Full file: 68 passed.🤖 Generated by Max — daemons don't get to lie about what they've seen.