Skip to content

feat(mcp): expose the skipped-PR audit trail as a read-only maintainer MCP tool (loopover_get_skipped_pr_audit) #5825

Description

@JSONbored

Context

GET /v1/app/skipped-pr-audit (src/api/routes.ts) already exists and returns a paginated audit trail of listPrVisibilitySkipAuditEvents — PRs the automated review pipeline decided NOT to visibly review/comment on, with a reason code, optional repoFullName/reason/since filters, and role-scoped repo visibility. It requires maintainer/owner/operator role (getRoleSummaryForIdentity + a role check), the same general authenticated-identity + role-check shape already used by other maintainer-facing MCP tools — it is measurement-only, no mutation, purely an audit read.

This is a distinct capability from every other already-exposed maintainer tool: loopover_get_maintainer_noise reports queue-noise triage, loopover_get_gate_precision reports blocked-then-merged false-positive rates, loopover_get_repo_outcome_patterns/loopover_get_outcome_calibration report gate-decision accuracy — none of them cover why a specific PR was silently skipped by the reviewer, which is exactly what /v1/app/skipped-pr-audit was built for (#105, "add silent audit export for skipped PRs"; consumed today by the #792 UI audit-feed viewer). A maintainer using an MCP client to triage "did the bot actually look at PR #N, and if not, why" currently has no tool for it and must open the dashboard.

Requirements

  • Add a new tool loopover_get_skipped_pr_audit to src/mcp/server.ts, following the "maintainer-authenticated; measurement only" pattern already used by loopover_get_maintainer_noise / loopover_get_gate_precision.
  • Input schema: optional repoFullName (string), optional reason (string, matching the route's own filter), optional since (string/date, matching the route's since query param), optional limit (integer, clamped the same way the route clamps it — 1 to 100, default 50).
  • Implementation: call the existing listPrVisibilitySkipAuditEvents service function directly with the same repo-scope resolution the route already performs for the caller's role (do not reimplement the role-based repo-scoping logic in skippedPrAuditRepoScope — reuse it), rather than an internal HTTP round-trip.
  • Description text: state plainly this is maintainer-authenticated, read-only, and reports PRs the automated reviewer skipped (with reason codes) — not a moderation or override action.
  • Add an output schema following the file's structured-output convention.

Deliverables

  • loopover_get_skipped_pr_audit tool registration in src/mcp/server.ts
  • Unit/integration test(s) covering: the default (no filters) case, each filter individually (repoFullName, reason, since), the limit clamping boundaries, the empty-result case, and the non-maintainer-caller-forbidden case
  • Add the tool to the maintainer-triage profile's recommendedTools list in packages/loopover-mcp/bin/loopover-mcp.js (AGENT_PROFILES), whose stated purpose ("Summarize queue risk, prepare review notes...") already covers this use case

Test Coverage Requirements

99%+ Codecov patch coverage on every changed line and branch in src/mcp/server.ts for the new tool handler, including every filter branch and the forbidden-role branch.

Expected Outcome

An MCP client authenticated as a maintainer can call loopover_get_skipped_pr_audit (optionally filtered by repo/reason/since) and get the same skipped-PR audit trail GET /v1/app/skipped-pr-audit already returns, without needing direct REST/API access or the dashboard.

Links & Resources

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:featureGittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.help wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions