fix: critical bugs, stale removal, hot reload, E2E tests#12
Merged
msilverblatt merged 31 commits intomasterfrom Mar 21, 2026
Merged
fix: critical bugs, stale removal, hot reload, E2E tests#12msilverblatt merged 31 commits intomasterfrom
msilverblatt merged 31 commits intomasterfrom
Conversation
Add clear_prompt_registry, clear_resource_registry, clear_resource_template_registry. Export from lib.rs with clear_all_registries() helper. Add process-wide TEST_LOCK mutex so tests with global registry state serialize correctly under default parallelism. Use unwrap_or_else(|e| e.into_inner()) on all Mutex lock calls to survive poisoning.
The oneOf discriminated union schema is not understood by Claude Code or most MCP clients. 'separate' creates individual tools per action which works universally. 'union' remains available for clients that support oneOf.
Add go.work workspace with replace directive for sdk/go pre-tag local dev, remove replace directives from sdk/go and examples go.mod files, set real version requirements, and add CI step to push sdk/go submodule tag on release.
Hot reload now watches the entry-point file's parent directory recursively, filtering by file extension. Changes to any source file in the project trigger a reload.
Previously syncTools/syncResources/syncPrompts only called Add, never Remove. Tools that were deleted or renamed during hot reload persisted as stale entries in the MCP server.
Also fixes two bugs discovered during testing: - Fix process manager Reload to read ToolListResponse from pending channel (Python SDK sends it with request_id, not as unsolicited message) - Fix Python discovery to clear tool and workflow registries on hot reload (previously only cleared group registry, leaving stale tools)
Task 4 changed the default strategy from 'union' to 'separate' but the TypeScript group tests were not updated.
Prevents potential deadlock if a handler accesses the registry.
Prevents partial sync when concurrent tool mutations interleave with hot reload's sequential SyncTools + SyncResources + SyncPrompts.
The protocol-based ReloadRequest only works for scripts using the discovery module with hot_reload=True. Simple single-file scripts don't re-import on ReloadRequest, so the tool list never changes. Replace with a stop-and-restart approach that kills the old process, resets internal state, and spawns a fresh process. This works for all languages and all script structures.
Breaking change: default tool group strategy is now "separate" (each action becomes its own tool) instead of "union" (oneOf). Users passing strategy="union" explicitly are unaffected.
…and-testing # Conflicts: # .gitignore # README.md # sdk/python/pyproject.toml # sdk/python/src/protomcp/discovery.py # sdk/rust/Cargo.toml # sdk/rust/src/group.rs # sdk/rust/src/local_middleware.rs # sdk/rust/src/middleware.rs # sdk/rust/src/server_context.rs # sdk/rust/src/sidecar.rs # sdk/rust/src/telemetry.rs # sdk/rust/src/tool.rs # sdk/rust/src/workflow.rs # sdk/typescript/package.json # test/e2e/e2e_test.go
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.
Summary
Comprehensive fix pass addressing 9 critical issues found during repo review, plus exhaustive real-scenario E2E tests for advanced features.
Bug Fixes
import osin transport.py (runtime crash on large payloads)clear_all_registries()helper, mutex poison recoverygo.workfor local dev, removereplacedirectives, addsdk/go/vX.Y.Zsubmodule tagging in CIuniontoseparate(oneOf not supported by Claude Code / most MCP clients)RemoveTools/RemoveResources/RemovePromptson syncSyncAll()for atomic tool/resource/prompt sync during reloadE2E Tests (5 new integration tests)
Bugs Found During Testing
Reloadchannel routing bug (ToolListResponse routed to wrong channel)Test Results
Test plan
go test ./...)pytest tests/)cargo test)vitest run)