Skip to content

feat(mcp): add loopover_file_incident_report write tool - #9365

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
bitfathers94:fix/issue-9298
Jul 27, 2026
Merged

feat(mcp): add loopover_file_incident_report write tool#9365
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
bitfathers94:fix/issue-9298

Conversation

@bitfathers94

Copy link
Copy Markdown
Contributor

feat(mcp): add loopover_file_incident_report write tool

Mirror POST /v1/repos/:owner/:repo/pulls/:number/incident-reports over the
MCP surface so a maintainer-authenticated client can file a post-merge
incident report on a harmful rented-loop PR, closing the write-side gap next
to the already-wrapped maintainer-packet/reviewability read tools.

The handler replays the REST route exactly: maintainer-manage auth, the
PR-must-exist-and-be-merged validation, then recordPostMergeIncidentReport
with reporterKind "customer" and the calling actor, returning the same
{ ok, repoFullName, pullNumber, ...report } shape. The input body fields
(description/severity/mergedSha) are declared inline rather than spread from
routes.ts's postMergeIncidentReportSchema.shape, because routes.ts imports the
MCP server module before that schema is defined -- dereferencing .shape at
module-init would hit the circular-import temporal dead zone.

Closes #9298

Validation

Verified locally on this branch before opening:

  • npm run typecheck
  • npx turbo run build:tsc build:verify
  • npm run test:coverage — patch coverage 100.0% of changed lines

Mirror POST /v1/repos/:owner/:repo/pulls/:number/incident-reports over the
MCP surface so a maintainer-authenticated client can file a post-merge
incident report on a harmful rented-loop PR, closing the write-side gap next
to the already-wrapped maintainer-packet/reviewability read tools.

The handler replays the REST route exactly: maintainer-manage auth, the
PR-must-exist-and-be-merged validation, then recordPostMergeIncidentReport
with reporterKind "customer" and the calling actor, returning the same
{ ok, repoFullName, pullNumber, ...report } shape. The input body fields
(description/severity/mergedSha) are declared inline rather than spread from
routes.ts's postMergeIncidentReportSchema.shape, because routes.ts imports the
MCP server module before that schema is defined -- dereferencing .shape at
module-init would hit the circular-import temporal dead zone.
@bitfathers94
bitfathers94 requested a review from JSONbored as a code owner July 27, 2026 14:28
@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.83%. Comparing base (09eb223) to head (98bf81b).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9365      +/-   ##
==========================================
+ Coverage   75.38%   75.83%   +0.44%     
==========================================
  Files         275      276       +1     
  Lines       58023    59244    +1221     
  Branches     6181     6421     +240     
==========================================
+ Hits        43739    44925    +1186     
- Misses      14014    14027      +13     
- Partials      270      292      +22     
Flag Coverage Δ
backend 97.13% <100.00%> (?)

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

Files with missing lines Coverage Δ
src/mcp/server.ts 97.13% <100.00%> (ø)

@loopover-orb loopover-orb Bot added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jul 27, 2026
@loopover-orb

loopover-orb Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-27 14:39:26 UTC

2 files · 1 AI reviewer · no blockers · readiness 98/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This PR wires up an MCP tool that mirrors the existing REST incident-report route: same maintainer-manage gate, PR-must-exist-and-be-merged validation, and recordPostMergeIncidentReport persistence with reporterKind "customer". The inline shape duplication (instead of spreading routes.ts's schema) is well-justified by a documented circular-import issue, and the test suite exercises the success path, actor resolution for session vs static callers, both business-rejection paths, and the access-denial path with DB-side assertions that nothing was recorded. This is a narrow, well-targeted write-tool addition closing issue #9298.

Nits — 4 non-blocking
  • src/mcp/server.ts:268-274 — the description/severity length limits and the mergedSha regex are hand-duplicated from postMergeIncidentReportSchema rather than derived from it; a future change to the REST schema's constraints won't propagate here, worth a comment noting they must be kept in sync manually.
  • The magic numbers 4000 (description max) and 7/40 (sha hex length bounds) in the new fileIncidentReportShape aren't named constants, though this matches the existing inline style in the same file (e.g. WRITE_TOOL_TITLE_MAX elsewhere uses named constants, this doesn't).
  • Consider exporting postMergeIncidentReportSchema's field-level validators (not the whole schema) from a shared module both routes.ts and server.ts can import without triggering the circular dependency, so the two definitions can't drift.
  • src/mcp/server.ts:4382 — the fileIncidentReportShape duplication risk could be caught by a unit test asserting the MCP shape's bounds match the REST schema's bounds, preventing silent divergence.

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #9298
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 65 registered-repo PR(s), 45 merged, 0 issue(s).
Contributor context ✅ Confirmed Gittensor contributor bitfathers94; Gittensor profile; 65 PR(s), 0 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: moderate
Linked issue satisfaction

Partially addressed
The PR adds loopover_file_incident_report with the required tool registration, category entry, ownerRepoPullShape-style input, PR existence/merged validation, recordPostMergeIncidentReport call, and matching response shape, plus tests for happy path, not-found, not-merged, and auth-rejection. However, it deviates from the issue's explicit requirement to reuse postMergeIncidentReportSchema's field-

Review context
  • Author: bitfathers94
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: TypeScript
  • Official Gittensor activity: 65 PR(s), 0 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Keep the PR focused and include validation evidence before maintainer review.
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.
🧪 Chat with LoopOver

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

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

Full command reference: https://loopover.ai/docs/loopover-commands

🧪 Experimental — new and may change.

🟩 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 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LoopOver approves — the gate is satisfied and CI is green.

@loopover-orb
loopover-orb Bot merged commit 457c5fb into JSONbored:main Jul 27, 2026
8 checks passed
@github-actions github-actions Bot mentioned this pull request Jul 27, 2026
12 tasks
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.

mcp: add loopover_file_incident_report tool mirroring POST .../pulls/:number/incident-reports

1 participant