fix(capabilities): same-provider-type URI scheme registration idempotent - #406
Merged
Million-mo merged 1 commit intoSep 1, 2026
Conversation
Per-agent capability variants of the same provider type (e.g. three
`type: viking` capabilities for kb/vision/research agents) each claim the
`viking` URI scheme at pool init. UriSchemeRegistry.register() treated the
second claim as a conflict and aborted startup with:
UriSchemeConflictError: URI scheme 'viking' is already claimed by
'VikingCapability'; cannot register 'VikingCapability'
RuntimeError: Failed to initialize agent pool
Re-registering a scheme with another instance of the same provider type is
now idempotent: the first claimant keeps ownership and later same-type
instances are ignored. Only a genuinely different provider type claiming an
already-owned scheme still raises. Registration remains all-or-nothing.
Per-agent behavior is unchanged: each capability instance stays registered
at AGENT scope in the ExtensionRegistry, so its own tools, memory, and
URI-guard settings apply; the scheme registry only routes `scheme://`
resource lookup.
Includes 10 unit tests (registry semantics + multi-viking manifest
regression) and a changelog entry.
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.
Problem
A manifest with per-agent capability variants of the same provider type crashed at pool init.
UriSchemeRegistry.register()treated the second claim of a scheme as a conflict and aborted startup:Concrete case:
xeno-agent's Hongshan config declares three separatetype: vikingcapabilities (knowledge-base, vision, and research agents, differing insupport_vision,enable_memory, and tool filters). Each instance claims thevikingURI scheme; only the first could register.Fix
UriSchemeRegistry.register()now treats a scheme already claimed by another instance of the same provider type as an idempotent no-op: the first claimant keeps ownership, later same-type instances are ignored. Only a genuinely different provider type claiming an already-owned scheme still raisesUriSchemeConflictError. Registration remains all-or-nothing (conflict on any scheme aborts before any mutation).Per-agent behavior is unaffected: each capability instance stays registered at AGENT scope in the
ExtensionRegistry, so its own tools, memory, and URI-guard settings apply. The scheme registry only routesscheme://resource URI lookups.Verification
tests/capabilities/test_uri_scheme_registry.py(10 unit tests): registration/lookup/unregister, same-type idempotency, cross-type conflict (incl. no-partial-commit), and a regression test mirroringAgentFactory.register_config_capabilitieswith threetype: vikingagents.ruff check/ruff formatclean;mypy --strictclean on changed files.wolfharness serve-acp config/diag-agent-hongshan.yamlnow passes pool init (server starts and stays up) instead of exiting code 1.Changelog:
changelog/unreleased/2026-09-01-same-type-scheme-registration.md