Add tool registry policy diagnostics
Refs #2136
Summary
- Adds
tool_registry.diagnosticsas a generic, redacted diagnostics RPC for tool inventory and policy visibility review. - Reports tool counts by transport, enabled count, possible write-capable tool ids, and known policy/approval/registry surfaces.
- Adds focused unit coverage for diagnostics schema/handler behavior and policy surface reporting.
Checklist
- [x] Issue URL: https://github.com/tinyhumansai/openhuman/issues/2136
- [x] Branch:
codex/oh-2136-policy-diagnostics - [x] Commit SHA:
a99bd5d9820899a22a618f80d4fb9e0f35057fc9 - [x] Files changed summary:
src/openhuman/tool_registry/mod.rs,src/openhuman/tool_registry/ops.rs,src/openhuman/tool_registry/schemas.rs,src/openhuman/tool_registry/types.rs - [x] Validation commands run:
cargo fmt --manifest-path Cargo.toml --all --check;cargo test --manifest-path Cargo.toml tool_registry - [x] Blocked validations: N/A - none
- [x] Behavior intentionally changed: adds a read-only diagnostics RPC/report surface under
tool_registry - [x] Duplicate/stale PR note: no existing open PR found for this branch or issue search before creating this PR
Summary by CodeRabbit
- New Features
- Added a diagnostics endpoint that returns redacted tool-policy diagnostics: total and enabled tool counts, transport breakdown, possible write surfaces, and policy surfaces.
- Tests
- Added coverage and tests validating the diagnostics output and schema (non-empty counts and expected policy-surface entries).
No actionable comments were generated in the recent review. π
βΉοΈ Recent review info
βοΈ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 3d02c108-f6bf-42c5-84a6-639beed74a67
π₯ Commits
Reviewing files that changed from the base of the PR and between a99bd5d9820899a22a618f80d4fb9e0f35057fc9 and 3c3905b018e67b918dfefa5f597e030fa851af1e.
π Files selected for processing (2)
src/openhuman/tool_registry/ops.rssrc/openhuman/tool_registry/schemas.rs
π Walkthrough
Walkthrough
Adds a diagnostics RPC to the tool registry: defines ToolPolicyDiagnostics, implements diagnostics() with helpers to count tools and discover write-capable and policy surfaces, and wires a diagnostics controller/handler with tests validating schema and JSON output.
Changes
Tool Registry Diagnostics Feature
| Layer / File(s) | Summary |
|---|---|
ToolPolicyDiagnostics type definition and export src/openhuman/tool_registry/types.rs, src/openhuman/tool_registry/mod.rs |
Defines ToolPolicyDiagnostics (counts and redacted surface lists) and re-exports it from the registry module. |
Diagnostics computation logic and unit test src/openhuman/tool_registry/ops.rs |
Adds pub fn diagnostics() plus helpers (looks_write_capable, policy_surface_ids, is_policy_surface) and a unit test that validates inventory counts and expected policy/write-capable surfaces. |
RPC schema and controller handler wiring src/openhuman/tool_registry/schemas.rs |
Registers the diagnostics controller in all_controller_schemas() and all_registered_controllers(), defines the diagnostics schema I/O, implements handle_diagnostics handler, and updates/adds tests asserting schema presence and JSON output shape/content. |
π― 3 (Moderate) | β±οΈ ~25 minutes
Possibly related PRs
- tinyhumansai/openhuman#2003: Earlier work extending the tool_registry surface and APIs; this PR adds diagnostics on top of that registry surface.
Poem
π° I hopped through the registry night,
Counting tools by dim moonlight,
Surfaces that write, surfaces that show,
I list them all in tidy rows,
Diagnostics done β a rabbit's delight!
π₯ Pre-merge checks | β 4 | β 1
β Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | β οΈ Warning | Docstring coverage is 69.57% 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 |
|---|---|---|
| Description Check | β Passed | Check skipped - CodeRabbitβs high-level summary is enabled. |
| Title check | β Passed | The title 'Add tool registry policy diagnostics' directly and clearly summarizes the main change: adding a new diagnostics feature to the tool registry focused on policy visibility. |
| Linked Issues check | β Passed | Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check | β Passed | Check skipped because no linked issues were found for this pull request. |
βοΈ Tip: You can configure your own custom pre-merge checks in the settings.
[!WARNING]
Review ran into problems
π₯ Problems
Git: Failed to clone repository. Please run the
@coderabbitai full reviewcommand to re-trigger a full review. If the issue persists, setpath_filtersto include or exclude specific files.
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.
@vaddisrinivas CI is failing on changes in this PR β please fix before review.
@vaddisrinivas CI is failing on changes in this PR β please fix before review.
Thanks for the heads-up. CI is green now on the latest run; re-review welcome.
@graycyrus Thanks again for the review. I addressed both requested diagnostics fixes in 8d25d1a8 (dynamic policy namespaces and {marker}. write-capability detection) and resolved the threads; current checks are green. Could you please take another look when you have a chance?