Skip to content

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

Closed
nghetienhiep wants to merge 1 commit into
JSONbored:mainfrom
nghetienhiep:fix/issue-5825
Closed

feat(mcp): expose the skipped-PR audit trail as a read-only maintainer MCP tool#5879
nghetienhiep wants to merge 1 commit into
JSONbored:mainfrom
nghetienhiep:fix/issue-5825

Conversation

@nghetienhiep

Copy link
Copy Markdown
Contributor

Summary

  • Add loopover_get_skipped_pr_audit, a maintainer-authenticated, read-only MCP tool that exposes the same skipped-PR audit trail GET /v1/app/skipped-pr-audit already returns, so an MCP client can see why the review pipeline silently skipped a PR without hitting the dashboard.
  • Extract the route's role check and repo-scope resolution (skippedPrAuditRepoScope) into a shared src/services/skipped-pr-audit.ts module, and getRoleSummaryForIdentity into src/services/control-panel-roles.ts, so the HTTP route and the new MCP tool call the exact same logic instead of two copies drifting apart.
  • Add the new tool to the maintainer-triage MCP profile's recommended tools.

Scope

  • The PR title follows type(scope): short summary Conventional Commit format, for example fix(api): restore profile access checks.
  • This PR is focused and does not mix unrelated backend, UI, MCP, docs, dependency, and deploy changes.
  • This follows CONTRIBUTING.md and does not reintroduce GitHub Pages, VitePress, site/, or CNAME.
  • I linked a currently open issue this PR resolves (e.g. Closes #123) — a linked open issue is required for every contributor PR.

Validation

  • git diff --check
  • npm run actionlint
  • npm run typecheck
  • npm run test:coverage locally; codecov/patch requires ≥99% coverage of the lines AND branches you changed (aim for 100% on your diff so CI variance does not fail near the threshold). Global coverage is a non-blocking trend with a loose 90% backstop, not the gate.
  • npm run test:workers
  • npm run build:mcp
  • npm run test:mcp-pack
  • npm run ui:openapi:check
  • npm run ui:lint
  • npm run ui:typecheck
  • npm run ui:build
  • npm audit --audit-level=moderate
  • New or changed behavior has unit/integration tests for new branches, fallback paths, and sanitizer boundaries

If any required check was skipped, explain why:

  • ui:lint / ui:typecheck / ui:build are skipped: this PR does not touch apps/loopover-ui/** at all (backend src/mcp, src/api, src/services and the packages/loopover-mcp CLI's agent-profile list only), so there is no UI surface for those checks to exercise.

Safety

  • No secrets, wallet details, hotkeys, coldkeys, user PATs, private keys, raw trust scores, private rankings, or private maintainer evidence are exposed.
  • Public GitHub text stays sanitized, low-noise, and does not imply compensation guarantees or optimization tactics.
  • Auth, cookie, CORS, GitHub App, Cloudflare, or session changes include negative-path tests.
  • API/OpenAPI/MCP behavior is updated and tested where needed.
  • UI changes use live API data or real empty/error/loading states, not production mock/demo fallbacks.
  • Visible UI changes include a UI Evidence section below with JPG/JPEG or PNG screenshots arranged as organized, captioned, clickable thumbnails.
  • Public docs/changelogs are updated where needed; changelogs are only edited for release-prep PRs.

No UI changes in this PR (backend MCP tool + CLI agent-profile list only), so the UI Evidence section is not applicable.

Notes

  • The new tool's access gate deliberately does not mirror GET /v1/app/skipped-pr-audit's blanket trust of every non-session (static) identity. The shared LOOPOVER_MCP_TOKEN static mcp identity is scoped to MCP_READ_REPO_ALLOWLIST (per-repo when repoFullName is given, full wildcard opt-in when it isn't — no single repo to scope an unfiltered, cross-repo request against), matching the existing canAccessRepo / requireDiscoveryAccess pattern already used by every other repo-scoped and cross-repo MCP tool in this file. api/internal static identities and real maintainer/owner/operator sessions behave exactly like the HTTP route.

Closes #5825

…r MCP tool

Add loopover_get_skipped_pr_audit, mirroring GET /v1/app/skipped-pr-audit's
maintainer-authenticated, measurement-only shape. Extract the route's role
check and repo-scope resolution into shared services/skipped-pr-audit.ts and
services/control-panel-roles.ts so the HTTP route and the new tool call the
same logic instead of drifting apart. The shared static mcp identity is
scoped to MCP_READ_REPO_ALLOWLIST rather than blanket-trusted, matching every
other repo-scoped/cross-repo tool in this file.

Closes JSONbored#5825
@nghetienhiep
nghetienhiep requested a review from JSONbored as a code owner July 14, 2026 20:46
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@loopover-orb loopover-orb Bot added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jul 14, 2026
@loopover-orb loopover-orb Bot mentioned this pull request Jul 14, 2026
24 tasks
@loopover-orb

loopover-orb Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Caution

🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥

🛑 LoopOver review result - reject/close recommended

Review updated: 2026-07-14 21:30:34 UTC

8 files · 1 AI reviewer · 1 blocker · readiness 57/100 · CI failing · blocked

🛑 Suggested Action - Reject/Close

Review summary
This PR cleanly extracts the existing GET /v1/app/skipped-pr-audit route's role-check and repo-scoping logic into a shared src/services/skipped-pr-audit.ts module and control-panel-roles.ts's getRoleSummaryForIdentity, then wires an equivalent loopover_get_skipped_pr_audit MCP tool on top of the same shared logic. The extraction is a faithful move (function bodies are unchanged, just relocated and exported), the route in src/api/routes.ts is updated to call the shared functions, and the new MCP tool correctly re-implements the route's static-mcp-identity allowlist gate plus role gate before calling the same listPrVisibilitySkipAuditEvents query. Test coverage is thorough, covering unscoped/scoped queries, reason/since/limit filtering, forbidden-role, forbidden-repo-scope, and the static mcp allowlist wildcard cases.

Nits — 5 non-blocking
  • src/mcp/server.ts:getSkippedPrAudit does not clamp `input.limit` to 1-100 like the HTTP route does (`clampInteger(parsed.data.limit ?? 50, 1, 100)` in src/api/routes.ts), yet the added test at test/unit/mcp-skipped-pr-audit.test.ts asserts clamping behavior — worth double-checking that listPrVisibilitySkipAuditEvents itself enforces the 1-100 bound so the two surfaces don't silently diverge on an unclamped or absurdly large limit.
  • src/mcp/server.ts's skippedPrAuditShape uses `limit: z.number().int().optional()` with no explicit min/max in the zod schema, so an out-of-range value relies entirely on downstream clamping rather than input validation — consider mirroring the route's explicit bounds in the schema for a clearer contract.
  • Confirm listPrVisibilitySkipAuditEvents (src/db/repositories) applies the same 1-100 clamp so both HTTP and MCP surfaces agree even if a caller bypasses schema validation.
  • Consider adding `.min(1).max(100)` to the MCP tool's limit field in skippedPrAuditShape for parity with the route's clampInteger bounds.
  • Readiness score is below the configured threshold — Use the readiness panel as advisory maintainer context; the score does not block this PR.

Why this is blocked

  • Linked issue overlaps another open PR — Review the related PRs before spending reviewer time on duplicate work.
📋 Copy for AI agents — paste into your coding agent
Fix the following blocker(s) from this PR review:

1. Linked issue overlaps another open PR — Review the related PRs before spending reviewer time on duplicate work.

CI checks failing

  • validate
  • validate-tests (4)
  • validate-tests (3)
  • validate-tests (6)
  • validate-tests (2)
  • validate-tests (1)
  • validate-tests (5)
Signal Result Evidence
Code review ❌ 1 blocker 1 reviewer
Linked issue ✅ Linked #5825
Related work ⚠️ 2 scoped overlaps Top overlaps are listed below; lower-confidence bulk is hidden.
Change scope ❌ 8/20 High review scope from cached public metadata (1 linked issue).
Validation posture ❌ 5/25 Preflight is holding this PR: the review lane is unavailable, so it is not ready for automated review.
Contributor workload ✅ 10/10 Author activity: 30 registered-repo PR(s), 15 merged, 0 issue(s).
Contributor context ✅ Confirmed Gittensor contributor nghetienhiep; Gittensor profile; 30 PR(s), 0 issue(s).
Gate result ❌ Blocking Repo-configured hard blocker found.
Improvement ✅ Minor risk: clean · value: minor — Code changes are accompanied by test evidence. LLM value judgment: moderate — The PR adds a well-scoped, maintainer-authenticated read-only MCP tool backed by a clean extraction of existing, already-tested route logic rather than new business logic, which is a modest but concrete improvement to MCP surface parity with the HTTP API.
Linked issue satisfaction

Addressed
The PR adds loopover_get_skipped_pr_audit to src/mcp/server.ts with the required optional repoFullName/reason/since/limit filters, reuses the route's own role-check and repo-scope logic (extracted into shared services rather than reimplemented), adds an output schema, and updates the maintainer-triage profile's recommendedTools list, matching every stated requirement.

Review context
  • Author: nghetienhiep
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository registration is not available in the local Gittensory cache.
  • Public profile languages: not available
  • Official Gittensor activity: 30 PR(s), 0 issue(s).
  • Related work: Titles/paths share 3 meaningful terms. (issue #4241)
  • Related work: Titles/paths share 3 meaningful terms. (issue #642, issue #5229)
Contributor next steps
  • Review top overlaps.
  • Add a concise scope and risk note.
  • Await review-lane availability.
  • Triage stale or unlinked PRs.
  • Refresh registry data or choose a registered active repo.
  • Check active issues and PRs before submitting.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
[BETA] Chat with Gittensory

Ask Gittensory a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.

  • @gittensory ask <question> answers contribution-quality Q&A with source citations and freshness.
  • @gittensory chat <question> answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @gittensory mention with a real question is routed to the closest matching read-only command automatically -- no exact syntax required.

Full command reference: https://gittensory.aethereal.dev/docs/gittensory-commands

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.

  • Re-run LoopOver review

@loopover-orb

loopover-orb Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Gittensory is closing this pull request on the maintainer's behalf (CI is failing (validate, validate-tests (4), validate-tests (3), validate-tests (6), validate-tests (2), validate-tests (1), validate-tests (5)); Linked issue overlaps another open PR; duplicate of another open PR). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed.

@loopover-orb loopover-orb Bot closed this Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant