Skip to content

feat(api): wire an admin trigger for agent-regate-pr's force field - #8967

Closed
hurryup52 wants to merge 2 commits into
JSONbored:mainfrom
hurryup52:feat/8898-agent-regate-pr-force-trigger
Closed

feat(api): wire an admin trigger for agent-regate-pr's force field#8967
hurryup52 wants to merge 2 commits into
JSONbored:mainfrom
hurryup52:feat/8898-agent-regate-pr-force-trigger

Conversation

@hurryup52

Copy link
Copy Markdown
Contributor

Summary

  • agent-regate-pr job messages carry an optional force field, threaded through regatePullRequest to bypass the AI review cache — but no producer ever sets it (confirmed: all 9 existing call sites omit it).
  • Adds POST /v1/internal/jobs/agent-regate-pr, an operator-gated route (bearer-gated by the shared /v1/internal/* middleware) that enqueues an agent-regate-pr job with force: true for an operator-specified repoFullName/prNumber.
  • Validates repo/PR existence via getPullRequest/getRepository before enqueuing (404 if either is missing), 400 on missing/invalid input (including non-integer/negative prNumber).
  • Registers the route in the OpenAPI spec and regenerates the derived openapi.json.

Scope

  • The PR title follows type(scope): short summary Conventional Commit format.
  • 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 (Closes #8898).

Validation

  • git diff --check
  • npm run actionlint
  • npm run typecheck
  • npm run test:coverage locally — new integration test covers both 400 branches (missing field, non-integer, negative), both 404 branches (missing PR, PR-present-but-repo-unregistered), the 202 success shape, and the 401 no-bearer case.
  • 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:

  • test:workers/build:mcp/test:mcp-pack/ui:lint/ui:typecheck/ui:build skipped: this PR touches only src/api/routes.ts, src/types.ts, src/openapi/spec.ts, its test file, and the generated apps/loopover-ui/public/openapi.json — no MCP package code and no apps/loopover-ui source/component code changed, so those builds/lints are not exercised by this diff.

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 (401-without-bearer-token case).
  • API/OpenAPI/MCP behavior is updated and tested where needed.
  • UI changes use live API data or real empty/error/loading states — N/A, no UI changes.
  • Visible UI changes include a UI Evidence section below — N/A, see below.
  • Public docs/changelogs are updated where needed — N/A, no docs/changelog changes.

UI Evidence

N/A — this PR contains no visible UI, frontend, or docs change. The only path touched under apps/loopover-ui/ is the generated apps/loopover-ui/public/openapi.json, a machine-written API-schema data file produced by npm run ui:openapi (required by this repo's ui:openapi:check drift gate whenever src/openapi/spec.ts changes) — it is not rendered UI code and has no visual output to screenshot.

Notes

  • Resubmission of feat(api): wire an admin trigger for agent-regate-pr's force field #8951, which was auto-closed for two reasons: codecov/patch was at 92.30% (fixed in this PR by adding the missing invalid-prNumber branch coverage), and a screenshot-evidence gate flagged the diff as a "UI/visual" change purely because it touches a path under apps/loopover-ui/ — the file in question is the generated, non-visual openapi.json, not UI code (see UI Evidence above).

Adds POST /v1/internal/jobs/agent-regate-pr, the first real producer for
the force flag on the agent-regate-pr job (previously plumbed and tested
but unreachable from any automatic path). Lets an operator force a fresh
AI opinion on a specific repo+PR instead of reusing a cached result.

Closes JSONbored#8898
Closes the codecov/patch gap flagged on the prior review: the
non-integer and negative prNumber arms of the 400 validation guard
weren't exercised, only the missing-field case was.
@hurryup52
hurryup52 requested a review from JSONbored as a code owner July 26, 2026 14:32
@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.30769% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 91.08%. Comparing base (401caef) to head (974f441).
⚠️ Report is 14 commits behind head on main.

Files with missing lines Patch % Lines
src/api/routes.ts 91.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8967      +/-   ##
==========================================
+ Coverage   90.56%   91.08%   +0.52%     
==========================================
  Files          96       99       +3     
  Lines       22490    25149    +2659     
  Branches     3884     4685     +801     
==========================================
+ Hits        20367    22907    +2540     
- Misses       1945     1975      +30     
- Partials      178      267      +89     
Flag Coverage Δ
backend 95.52% <92.30%> (?)

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

Files with missing lines Coverage Δ
src/openapi/spec.ts 99.48% <100.00%> (ø)
src/types.ts 100.00% <ø> (ø)
src/api/routes.ts 95.21% <91.66%> (ø)

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

loopover-orb Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Caution

🛑 LoopOver review result - reject/close recommended

Review updated: 2026-07-26 14:48:02 UTC

5 files · 1 AI reviewer · 2 blockers · CI failing · blocked

🛑 Suggested Action - Reject/Close

Review summary
This PR adds a new operator-gated route to force-enqueue an agent-regate-pr job with force:true, bypassing the AI review cache for a specific PR — it's the first real producer of the previously-unused `force` field. Validation order is correct (repoFullName -> prNumber -> PR existence -> repo/installationId existence), the route is registered in both the OpenAPI spec and derived openapi.json, and the integration test covers all four status branches (400/400/400/404/404/202/401) including the distinct PR-exists-but-repo-unregistered 404 case. The route is properly gated behind the shared /v1/internal/* bearer middleware per requiresApiToken's `path.startsWith("/v1/internal/")` exemption from the general auth requirement (internal auth is applied elsewhere).

Nits — 5 non-blocking
  • The CI FAILED checks (validate-code, validate, codecov/patch 92.30% vs 99% target) have no detail provided; given the branch is 14 commits behind default, this is plausibly caused by upstream drift rather than this diff's own content — worth rebasing to confirm.
  • src/api/routes.ts: HTTP status codes (400/404/202) are inline magic numbers consistent with the rest of the file's existing route handlers, so no action needed beyond noting the pattern.
  • Consider validating that `body.repoFullName` matches the expected `owner/repo` format before hitting getPullRequest/getRepository, though downstream lookups will simply 404 on malformed input so this is purely defensive.
  • src/api/routes.ts:4838-4854: the new route body is well-structured and matches the sibling internal job routes' pattern (e.g. backfill-pr-details) — no changes needed there.
  • The comment in src/types.ts documenting the new 'manual-regate:' deliveryId prefix is a nice touch for future producers of this JobMessage type.

Why this is blocked

  • No linked issue detected: No closing reference or linked issue number was found in the PR metadata/body. — If this PR is intended to solve an issue, link it explicitly in the PR body.
  • Maintainer requires a linked issue: This repo's maintainer focus manifest requires every PR to reference a tracked issue. — Link the relevant issue (for example Closes #123) before opening the PR.
📋 Copy for AI agents — paste into your coding agent
Fix the following blocker(s) from this PR review:

1. No linked issue detected: No closing reference or linked issue number was found in the PR metadata/body. — If this PR is intended to solve an issue, link it explicitly in the PR body.

2. Maintainer requires a linked issue: This repo's maintainer focus manifest requires every PR to reference a tracked issue. — Link the relevant issue (for example `Closes #123`) before opening the PR.

CI checks failing

  • codecov/patch — 92.30% of diff hit (target 99.00%)
  • validate
  • validate-code

Decision drivers

  • ❌ Code review — 2 blockers (1 reviewer)
  • ❌ Gate result — Blocking (Repo-configured hard blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ⚠️ Missing No linked issue or no-issue rationale found.
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 (no linked issue context).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 23 registered-repo PR(s), 7 merged, 0 issue(s).
Contributor context ✅ Confirmed Gittensor contributor hurryup52; Gittensor profile; 23 PR(s), 0 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: moderate
Review context
  • Author: hurryup52
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: not available
  • Official Gittensor activity: 23 PR(s), 0 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Start here: Explain no-issue PR.
  • Then work through the remaining 2 steps in the Signals table above.
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.

Visual preview
Route Viewport Before (production) After (this PR's preview) Diff
/ desktop before /
before /
after /
after /
/ mobile before / (mobile)
before / (mobile)
after / (mobile)
after / (mobile)

Click any thumbnail to open the full-size screenshot. Before = production · After = this PR's preview deploy.

Scroll preview
Route Before (production) After (this PR's preview)
/ before / (scroll)
before / (scroll)
after / (scroll)
after / (scroll)

A short scroll-through clip (desktop) — click either thumbnail to open the full animation. Evidence for scroll-linked behavior a single screenshot can't show.

🟩 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 26, 2026

Copy link
Copy Markdown
Contributor

This pull request changes UI/visual code but its screenshot evidence is incomplete. Every required viewport × theme combination needs its own before/after image pair in a labeled table row (e.g. "Desktop · Light | before | after"). Still missing: Desktop · Dark, Tablet · Dark, Mobile · Dark.

Please resubmit with the remaining rows filled in.

See https://github.com/JSONbored/loopover/blob/main/.claude/skills/contributing-to-loopover/SKILL.md for the exact format and examples. This is an automated maintenance action.

@loopover-orb loopover-orb Bot closed this Jul 26, 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.

1 participant