Skip to content

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

Closed
hurryup52 wants to merge 1 commit 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#8951
hurryup52 wants to merge 1 commit 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.
  • Registers the route in the OpenAPI spec and regenerates the derived openapi.json.

Test plan

  • npx tsc -b --noEmit clean
  • New integration test covers: both validation failures (400), both not-found branches (404 — missing PR, and PR present but repo unregistered), success (202, exact enqueued job shape including force: true and prCreatedAt), and 401 without the bearer token
  • Ran the affected test file locally, passing

Closes #8898

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
@hurryup52
hurryup52 requested a review from JSONbored as a code owner July 26, 2026 14:09
@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 (7016c4d).
⚠️ Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
src/api/routes.ts 91.66% 0 Missing and 1 partial ⚠️

❌ Your patch check has failed because the patch coverage (92.30%) is below the target coverage (99.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8951      +/-   ##
==========================================
+ 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 - fixes required

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

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

🛑 Suggested Action - Fix Blockers

Review summary
This PR adds a new internal admin route, POST /v1/internal/jobs/agent-regate-pr, that lets an operator force a re-gate of one specific PR by setting force:true on the enqueued agent-regate-pr job — the field already existed on JobMessage but had zero real producers before this PR. The validation flow (repoFullName/prNumber type checks -> 400, PR lookup -> 404, repo/installationId lookup -> 404, then enqueue -> 202) is correct and traced end-to-end through getPullRequest/getRepository, and the route sits in the same /v1/internal/* bearer-gated group as its siblings (confirmed by the visible requiresApiToken exemption for /v1/internal/* and the existing sibling routes' identical 401 test pattern). OpenAPI (openapi.json + spec.ts) and the JobMessage doc comment were updated in lockstep with the route, and the new integration test exercises both 404 branches (missing PR vs. PR-present-but-repo-unregistered), both 400s, the 202 success shape, and the 401 no-bearer case.

Nits — 5 non-blocking
  • codecov/patch is at 92.30% against a 99% target for this diff — an easy branch to add coverage for is the invalid-prNumber-type/negative-number 400 case in test/integration/api.test.ts, which isn't explicitly exercised (only missing repoFullName/prNumber are).
  • src/api/routes.ts: the new handler doesn't validate that prNumber fits GitHub's practical range or that repoFullName matches an owner/repo shape before hitting the DB — minor, since getPullRequest/getRepository will simply miss and 404, but worth a one-line comment if intentional.
  • The status codes (400/401/404/202) are hard-coded inline in both routes.ts and spec.ts rather than shared constants — consistent with the rest of the file's style, so not worth changing, just noting for awareness.
  • Consider adding a test case for an invalid (negative or non-integer) prNumber to close the coverage gap flagged by codecov/patch.
  • If this operator route is expected to be used more than rarely, consider logging/audit-recording the manual force-regate trigger (who invoked it) similar to other admin actions in this codebase, for traceability.

CI checks failing

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

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 #8898
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: 21 registered-repo PR(s), 7 merged, 0 issue(s).
Contributor context ✅ Confirmed Gittensor contributor hurryup52; Gittensor profile; 21 PR(s), 0 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: moderate
Linked issue satisfaction

Addressed
The PR adds a bearer-gated POST /v1/internal/jobs/agent-regate-pr route that validates repo/PR existence and enqueues an agent-regate-pr job with force: true, giving the previously-unreachable force field a real producer as requested.

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: JavaScript, TypeScript, Dart, MDX, Rust
  • Official Gittensor activity: 21 PR(s), 0 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Start here: Triage stale or unlinked PRs.
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.

Decision record
  • action: close · clause: ai_review_inconclusive
  • config: 03a7f8b529a9 · pack: oss-anti-slop
  • record: 2ca60f2f639e (schema v2, head 7016c4d)
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.

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(queue): wire an admin trigger for agent-regate-pr's force field, which currently has zero producers

1 participant