Skip to content

feat(mcp): expose skipped-PR audit trail as a maintainer MCP tool - #5905

Merged
JSONbored merged 1 commit into
JSONbored:mainfrom
nghetienhiep:fix/issue-5825
Jul 15, 2026
Merged

feat(mcp): expose skipped-PR audit trail as a maintainer MCP tool#5905
JSONbored merged 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 surfaces the same skipped-PR audit trail already exposed by GET /v1/app/skipped-pr-audit (listPrVisibilitySkipAuditEvents), so an MCP client can triage "did the bot look at PR #N, and if not, why" without the dashboard.
  • Extracted the shared reason enum (PUBLIC_SURFACE_SKIP_REASONS) and the per-reason remediation text (skippedPrAuditRemediation) out of src/api/routes.ts into src/signals/settings-preview.ts (next to PublicSurfaceSkipReason) so the HTTP route and the new MCP tool consume one canonical copy instead of two independently-maintained literal lists.
  • Added the tool to the maintainer-triage MCP agent profile's recommendedTools.

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.

Closes #5825

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 were skipped: this PR touches no files under apps/loopover-ui/** — the only production files changed are src/api/routes.ts, src/mcp/server.ts, src/signals/settings-preview.ts, and packages/loopover-mcp/bin/loopover-mcp.js. npm run ui:openapi:check passed with no drift, confirming the (unchanged) /v1/app/skipped-pr-audit request/response shape still matches the generated OpenAPI spec.
  • Also ran and confirmed green: npm run db:migrations:check, npm run db:schema-drift:check, npm run selfhost:env-reference:check, npm run miner:env-reference:check, npm run cf-typegen:check, npm run manifest:drift-check, npm run command-reference:check, npm run docs:drift-check, npm run engine-parity:drift-check, npm run test:engine-parity, npm run test:live-gate-parity, npm run test:driver-parity (no DB/env/wrangler-binding/docs changes in this PR, so all no-op green as expected).
  • npm run test:coverage full run in my local sandbox reports 15 failing tests across 3 files (selfhost-ams-reporting.test.ts, miner-discover-cli.test.ts, miner-live-issue-snapshot.test.ts), all pre-existing and unrelated to this diff: the sqlite3 CLI binary is not installed in this sandbox (those tests shell out to it), and a real GITHUB_TOKEN is present in this shell's env and leaks into tests asserting no-token behavior. Confirmed identical failures on a clean stash of this branch at the same base commit before any of my changes. New coverage confirmed via test/unit/mcp-skipped-pr-audit.test.ts (11 cases covering: default no-filter feed scoped to the caller's own repos, each of repoFullName/reason/since filtered independently, limit clamped at both the 1 and 100 boundaries, an empty-page result, a session with no maintainer/owner/operator role being forbidden, a non-operator owner explicitly requesting its own scoped repo, a maintainer forbidden from a repo outside its scope, an unparseable since value, and the static mcp identity both forbidden and allowed depending on MCP_READ_REPO_ALLOWLIST) plus the existing test/unit/mcp-output-schemas.test.ts and test/integration/api.test.ts skipped-pr-audit route coverage, all still green after the shared-constant extraction. Verified via lcov that every new line and branch in src/mcp/server.ts (input/output schema, tool registration, requireSkippedPrAuditAccess, getSkippedPrAudit) and the new/moved code in src/signals/settings-preview.ts is hit.

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. SVG screenshots are not used as review evidence. Review-only screenshots or recordings are not committed to the repository.
  • Public docs/changelogs are updated where needed; changelogs are only edited for release-prep PRs.

No UI changes in this PR — the last two Safety checkboxes and the UI Evidence section below are not applicable.

UI Evidence

Not applicable — this PR only adds a backend/MCP tool with no visible UI, frontend, docs, or extension surface.

Notes

  • The new tool's repo-scope gate (requireSkippedPrAuditAccess) mirrors the HTTP route's skippedPrAuditRepoScope (same loadControlPanelRoleSummary/loadControlPanelAccessScope calls, same maintainer/owner/operator role gate, same "no filter → caller's own scoped repos" fallback), reimplemented against this file's MCP identity/throw conventions rather than reused directly, since skippedPrAuditRepoScope is bound to a Hono ProtectedRouteContext and returns a Response, neither of which an MCP tool method can use. The shared static mcp CLI token additionally requires the unscoped MCP_READ_REPO_ALLOWLIST wildcard opt-in for this tool, matching every other cross-repo/maintainer-report MCP gate in this file (requireOperatorAccess, requireDiscoveryAccess).

@nghetienhiep
nghetienhiep requested a review from JSONbored as a code owner July 14, 2026 22:13
@superagent-security

Copy link
Copy Markdown
Contributor

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

@JSONbored
JSONbored marked this pull request as draft July 14, 2026 22:26
@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 commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Warning

LoopOver found maintainer review notes

Scoped related-work signals were found for this PR. They are advisory unless the gate reports a blocker.

Readiness score: 57/100

Signal Result Evidence Action
Linked issue ✅ Linked #5825 No action.
Related work ⚠️ 3 scoped overlaps Top overlaps are listed below; lower-confidence bulk is hidden. Review top overlaps.
Change scope ❌ 8/20 High review scope from cached public metadata (1 linked issue). Add a concise scope and risk note.
Validation posture ❌ 5/25 Preflight is holding this PR: the review lane is unavailable, so it is not ready for automated review. Await review-lane availability.
Contributor workload ✅ 10/10 Author activity: 52 registered-repo PR(s), 23 merged, 0 issue(s). No action.
Contributor context ✅ Confirmed Gittensor contributor nghetienhiep; Gittensor profile; 52 PR(s), 0 issue(s). No action.
Gate result ⚠️ Advisory only Advisory only. No action.
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.
Review context
  • Author: nghetienhiep
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository registration is not available in the local LoopOver cache.
  • Public profile languages: not available
  • Official Gittensor activity: 52 PR(s), 0 issue(s).
  • Related work: Titles/paths share 6 meaningful terms. (PR #5906)
  • Related work: Titles/paths share 6 meaningful terms. (PR #5909)
  • Related work: Titles/paths share 8 meaningful terms. (PR #5906, PR #5909)
Maintainer notes
  • Repo lane is not ready for a confident recommendation: Repository registration is not available in the local LoopOver cache.
  • Possible duplicate or overlapping work: 3 related open work cluster(s) were detected.
Contributor next steps
  • Start here: Review top overlaps.
  • Then work through the remaining 5 steps in the Signals table above.
  • Re-run LoopOver review

💰 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.

@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.16%. Comparing base (1b62bf0) to head (6e059b0).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5905   +/-   ##
=======================================
  Coverage   95.15%   95.16%           
=======================================
  Files         589      589           
  Lines       46695    46723   +28     
  Branches    14902    14913   +11     
=======================================
+ Hits        44434    44462   +28     
  Misses       1511     1511           
  Partials      750      750           
Flag Coverage Δ
shard-1 43.93% <10.52%> (-0.02%) ⬇️
shard-2 36.14% <86.84%> (+0.10%) ⬆️
shard-3 32.04% <10.52%> (-0.02%) ⬇️
shard-4 32.83% <10.52%> (-0.04%) ⬇️
shard-5 31.49% <10.52%> (-0.02%) ⬇️
shard-6 44.53% <34.21%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/api/routes.ts 94.40% <ø> (-0.03%) ⬇️
src/mcp/server.ts 96.06% <100.00%> (+0.12%) ⬆️
src/signals/settings-preview.ts 98.73% <100.00%> (+0.08%) ⬆️

Add loopover_get_skipped_pr_audit, mirroring GET /v1/app/skipped-pr-audit's
maintainer-authenticated, repo-scoped, filterable read of PRs the automated
reviewer intentionally skipped. Extract the shared reason enum and remediation
text out of routes.ts into signals/settings-preview.ts so the route and the
new tool stay in lockstep instead of duplicating the list.

Closes JSONbored#5825
@JSONbored
JSONbored marked this pull request as ready for review July 15, 2026 04:26
@JSONbored
JSONbored merged commit de3a0de into JSONbored:main Jul 15, 2026
16 checks passed
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)

2 participants