openhuman icon indicating copy to clipboard operation
openhuman copied to clipboard

Add tool registry policy diagnostics

Open vaddisrinivas opened this issue 6 months ago β€’ 5 comments

Refs #2136

Summary

  • Adds tool_registry.diagnostics as 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).

Review Change Stack

vaddisrinivas avatar May 20 '26 11:05 vaddisrinivas

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.rs
  • src/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 review command to re-trigger a full review. If the issue persists, set path_filters to 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.

❀️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar May 20 '26 11:05 coderabbitai[bot]

@vaddisrinivas CI is failing on changes in this PR β€” please fix before review.

M3gA-Mind avatar May 20 '26 13:05 M3gA-Mind

@vaddisrinivas CI is failing on changes in this PR β€” please fix before review.

M3gA-Mind avatar May 20 '26 14:05 M3gA-Mind

Thanks for the heads-up. CI is green now on the latest run; re-review welcome.

vaddisrinivas avatar May 20 '26 19:05 vaddisrinivas

@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?

vaddisrinivas avatar May 21 '26 19:05 vaddisrinivas