Add trusted external capability provider registry
Summary
- Add a generic external capability provider registry for trusted runtime layers.
- Add config schema support for provider records with trust, enabled state, source URI, and source digest metadata.
- Expose normalized provider lookup and registration eligibility checks for later admission, policy, and diagnostics code.
Problem
- OpenHuman has generic policy and generated-tool hooks, but no neutral place to declare which external capability providers are trusted to register capability-backed tools.
- Without a provider registry, admission and diagnostics code has to duplicate trust metadata or rely on raw strings.
Solution
- Introduce
openhuman::external_capabilitieswith provider config, normalization, registry construction, and error reporting. - Wire
external_capability_providersinto the top-level config schema with a default-empty configuration. - Keep the module generic: it does not load bundles, execute tools, or depend on a provider packaging format.
Submission Checklist
- [x] Tests added or updated (happy path + at least one failure / edge case) per Testing Strategy: provider normalization, trusted/enabled checks, duplicate records, invalid IDs, and missing names.
- [x] Diff coverage ≥ 80% — local full coverage not run; focused Rust tests cover the changed module and CI coverage gate will enforce final diff coverage.
- [x] Coverage matrix updated — N/A: generic config/registry capability, no existing feature row added/removed/renamed.
- [x] All affected feature IDs from the matrix are listed in the PR description under
## Related: N/A, no coverage-matrix feature ID applies. - [x] No new external network dependencies introduced (mock backend used per Testing Strategy): no network dependency added.
- [x] Manual smoke checklist updated if this touches release-cut surfaces (
docs/RELEASE-MANUAL-SMOKE.md): N/A, no release-cut UI/runtime smoke surface changed. - [x] Linked issue closed via
Closes #NNNin the## Relatedsection.
Impact
- Runtime/platform impact: new default-empty config and registry API only.
- Security impact: establishes explicit trust and enablement metadata for external capability providers.
- Compatibility: existing configs deserialize with defaults.
Related
- Closes #2541
- Follow-up PR(s)/TODOs: Companion PRs add generated-tool admission checks and runtime policy hooks.
AI Authored PR Metadata (required for Codex/Linear PRs)
Linear Issue
- Key: N/A - GitHub issue #2541
- URL: https://github.com/tinyhumansai/openhuman/issues/2541
Commit & Branch
- Branch:
codex/oh-2541-external-capability-providers - Commit SHA:
cc862fbc9f3443fe130366e6f27e9838b29863a6
Validation Run
- [x]
pnpm --filter openhuman-app format:check: N/A, Rust-only backend schema/module change. - [x]
pnpm typecheck: N/A, Rust-only backend schema/module change. - [x] Focused tests:
cargo test --manifest-path Cargo.toml external_capabilities --lib - [x] Rust fmt/check (if changed):
cargo fmt --manifest-path Cargo.toml --all --check;git diff --check - [x] Tauri fmt/check (if changed): N/A, no Tauri code changed.
- [x] PR checklist:
node scripts/check-pr-checklist.mjs /tmp/openhuman-pr-body-2541.md
Validation Blocked
command:N/Aerror:N/Aimpact:N/A
Behavior Changes
- Intended behavior change: OpenHuman config can now declare trusted external capability providers.
- User-visible effect: None by default; registry is empty unless configured.
Parity Contract
- Legacy behavior preserved: yes, defaults keep existing runtime behavior unchanged.
- Guard/fallback/dispatch parity checks: invalid or duplicate provider records are reported through registry errors, not silently trusted.
Duplicate / Superseded PR Handling
- Duplicate PR(s): None found for
vaddisrinivas:codex/oh-2541-external-capability-providers. - Canonical PR: this PR.
- Resolution (closed/superseded/updated): N/A.
Summary by CodeRabbit
-
New Features
- New configuration section to manage external capability providers (with sensible defaults).
- Provider registry for lookup, listing, validation, normalization, duplicate/error reporting.
- Providers include a flag controlling whether they may register tools.
-
Tests
- Unit tests for id normalization, validation, registry loading, and error/duplicate cases.
-
Documentation
- Added module-level documentation for external capability provider APIs.
Adds configurable external capability providers: new config and runtime types, provider ID normalization/validation, a config-backed registry exposing list/get/can_register_tools/errors, unit tests, and integration into the top-level Config and schema re-exports. External Capability Provider Registry 🎯 3 (Moderate) | ⏱️ ~20 minutes "🐰 I trimmed the ids and made them neat, ✏️ Tip: You can configure your own custom pre-merge checks in the settings.📝 Walkthrough
Walkthrough
Changes
Layer / File(s)
Summary
Provider types and defaults
src/openhuman/external_capabilities/types.rsAdds
ExternalCapabilityProviderConfig (serde/schemars) with Default, ExternalCapabilityProvidersConfig, runtime ExternalCapabilityProvider, and can_register_tools().
Registry, normalization, and tests
src/openhuman/external_capabilities/registry.rsImplements
ExternalCapabilityProvider::from_config, normalize_provider_id, and ExternalCapabilityProviderRegistry::from_config that builds an ordered BTreeMap, records errors for invalid/duplicate entries, and exposes is_empty, list, get, can_register_tools, and errors. Includes unit tests for normalization, trimming, gating, duplicates, and invalid records.
Module facade and re-exports
src/openhuman/external_capabilities/mod.rs, src/openhuman/mod.rsAdds the
external_capabilities public module and re-exports normalize_provider_id, ExternalCapabilityProviderRegistry, and provider types.
Schema re-exports and Config integration
src/openhuman/config/schema/tools.rs, src/openhuman/config/schema/types.rs, src/openhuman/config/schema/mod.rsRe-exports provider config types through the schema tools module, adds
external_capability_providers: ExternalCapabilityProvidersConfig to top-level Config with #[serde(default)], initializes it in Config::default(), and reformats the pub use list in schema mod.Sequence Diagram
sequenceDiagram
participant ConfigFile as ExternalCapabilityProvidersConfig
participant Registry as ExternalCapabilityProviderRegistry
participant Provider as ExternalCapabilityProvider
ConfigFile->>Registry: from_config(config)
Registry->>Provider: ExternalCapabilityProvider::from_config(cfg)
Provider-->>Registry: validated provider or error
Registry-->>ConfigFile: registry (providers + errors)
Estimated code review effort
Suggested reviewers
Trusted gates keep tool lists sweet,
Providers lined in ordered trees,
Errors logged on gentle breeze,
Tests hop by with tiny feet."🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name
Status
Explanation
Resolution
Docstring Coverage
⚠️ Warning
Docstring coverage is 48.65% which is insufficient. The required threshold is 80.00%.
Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name
Status
Explanation
Title check
✅ Passed
The PR title clearly and specifically summarizes the main change: adding a trusted external capability provider registry, which is the core feature introduced across all modified files.
Linked Issues check
✅ Passed
All coding requirements from
#2541 are met: generic provider metadata type with required fields, config-backed registry with normalization, lookup/list helpers, registration-eligibility checks, backward compatibility via defaults, and comprehensive unit tests covering acceptance criteria.
Out of Scope Changes check
✅ Passed
All changes align with
#2541 objectives: config schema updates, type definitions, registry implementation, normalization logic, and tests. No unrelated functionality like runtime execution, bundle formats, or UI features are introduced.
Description Check
✅ Passed
Check skipped - CodeRabbit’s high-level summary is enabled.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.
Closing as superseded by #2551 for issue #2541.
Both PRs implement a trusted external capability provider registry, but #2551 is the more complete contribution: it ships unit tests (ops_test.rs +281), documentation (gitbooks/developing/mcp-server.md in EN + zh-CN), and integrates with the existing tool_registry/ module rather than introducing a parallel external_capabilities/ subsystem — keeping a single source of truth for capability resolution.
Thanks for the contribution! The scaffolding here was a useful reference for the shape of the registry. If there are specific design choices in this branch you'd like reflected in #2551, happy to surface them as review comments on that PR.