Skip to content

feat(github-app): add reviewer routing auto-request mode - #1108

Closed
statxc wants to merge 2 commits into
JSONbored:mainfrom
statxc:feat/issue-830-reviewer-routing-auto-request
Closed

feat(github-app): add reviewer routing auto-request mode#1108
statxc wants to merge 2 commits into
JSONbored:mainfrom
statxc:feat/issue-830-reviewer-routing-auto-request

Conversation

@statxc

@statxc statxc commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Implements feat(github-app): reviewer-routing auto_request action (#540 follow-up) #830 by adding CODEOWNERS-based reviewer routing with reviewerRoutingMode: off | advisory | auto_request
  • Surfaces reviewer suggestions in the PR review output
  • Auto-requests top-ranked individual reviewers only when reviewerRoutingMode is auto_request, while skipping teams, already-requested reviewers, and first-time external contributors
  • Adds the required settings, API/OpenAPI plumbing, migration, and focused tests for routing, idempotency, newcomer guards, and gate-override safety
  • Includes the follow-up CODEOWNERS matcher fix so directory and shallow-wildcard rules align with GitHub's documented semantics

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 an issue, or this is small enough that the summary explains why an issue is not needed.

Validation

  • git diff --check
  • npm run actionlint
  • npm run typecheck
  • npm run test:coverage
  • npm run test:workers
  • npm run build:mcp
  • npm run test:mcp-pack
  • npm run ui:openapi:check
  • npm run ui:version-audit
  • npm run ui:lint
  • npm run ui:typecheck
  • npm run ui:test
  • 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 or failed, explain why:

  • I ran npm run test:ci locally against the final PR tree.
  • ui:lint passes, but it emits existing react-refresh/only-export-components warnings in route files outside this PR's scope.

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.

UI Evidence

Not applicable. This PR does not introduce visible UI changes. The frontend-facing change is the generated OpenAPI artifact only.

State / title JPG/PNG evidence
N/A No visible UI change

Notes

  • Closes feat(github-app): reviewer-routing auto_request action (#540 follow-up) #830
  • This PR includes the CODEOWNERS routing foundation required to implement the auto_request reviewer-routing mode correctly on current main.
  • auto_request is intentionally conservative: it only requests individual reviewers, never teams, and it does not auto-request for first-time external contributors.
  • The branch is intentionally squashed to a single commit for merge review.

@codecov

codecov Bot commented Jun 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.23789% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.07%. Comparing base (a6e32e7) to head (b3e8364).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/github/codeowners.ts 97.72% 0 Missing and 2 partials ⚠️
src/queue/processors.ts 95.00% 0 Missing and 1 partial ⚠️
src/signals/reviewer-routing.ts 98.46% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1108      +/-   ##
==========================================
+ Coverage   95.03%   95.07%   +0.04%     
==========================================
  Files         177      179       +2     
  Lines       19886    20101     +215     
  Branches     7166     7244      +78     
==========================================
+ Hits        18898    19112     +214     
+ Misses        395      393       -2     
- Partials      593      596       +3     
Files with missing lines Coverage Δ
src/api/routes.ts 94.40% <ø> (ø)
src/db/repositories.ts 96.06% <100.00%> (+<0.01%) ⬆️
src/db/schema.ts 68.32% <ø> (ø)
src/github/app.ts 97.52% <100.00%> (+0.58%) ⬆️
src/github/backfill.ts 92.86% <100.00%> (+0.03%) ⬆️
src/openapi/schemas.ts 100.00% <ø> (ø)
src/signals/engine.ts 97.07% <100.00%> (+0.01%) ⬆️
src/signals/focus-manifest-loader.ts 98.87% <ø> (ø)
src/signals/focus-manifest.ts 96.57% <100.00%> (+0.01%) ⬆️
src/signals/settings-preview.ts 99.24% <100.00%> (+0.01%) ⬆️
... and 3 more
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ghost

ghost commented Jun 23, 2026

Copy link
Copy Markdown

Tip

🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩

✅ Gittensory review — safe to merge

37 files · no blockers · readiness 100/100 · CI green

✅ Approved — safe to merge

Signal Result Evidence
Code review ✅ No blockers synthesized
Linked issue ✅ Linked #830
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Review load ✅ 20/20 Readiness component derived from cached public PR metadata and labels; size label size:XL.
Validation evidence ✅ 25/25 PR body includes validation/test evidence.
Open PR queue ✅ 10/10 0 open PR(s), 0 likely reviewable.
Contributor context ✅ Confirmed Gittensor contributor statxc; Gittensor profile; 46 PR(s), 4 issue(s).
Gate result ✅ Passing No configured blocker found.
Review context
  • Author: statxc
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: TypeScript, Python, JavaScript, Rust, C++, Go, Java, Clojure
  • Official Gittensor activity: 46 PR(s), 4 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.
  • Review load = cached public PR metadata such as size labels, changed paths, and preflight status.
  • Open PR queue = repo-wide review pressure; it is not a PR quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
Visual preview
Route Viewport Before (production) After (this PR's preview)
/ desktop before / after /
/ mobile before / (mobile) after / (mobile)

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

🟩 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 Gittensory, a quiet PR intelligence layer for OSS maintainers.

  • Re-run Gittensory review

Comment thread src/github/codeowners.ts Outdated
@superagent-security superagent-security Bot added the pr:flagged PR flagged for review by security analysis. label Jun 24, 2026
@superagent-security

Copy link
Copy Markdown
Contributor

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

@statxc
statxc force-pushed the feat/issue-830-reviewer-routing-auto-request branch from 28de1f4 to 4332563 Compare June 24, 2026 11:54
@statxc
statxc force-pushed the feat/issue-830-reviewer-routing-auto-request branch from 4332563 to 0175133 Compare June 24, 2026 11:59
@statxc
statxc force-pushed the feat/issue-830-reviewer-routing-auto-request branch from 0175133 to 7327301 Compare June 24, 2026 12:13
@statxc
statxc force-pushed the feat/issue-830-reviewer-routing-auto-request branch from 7327301 to aa85d42 Compare June 24, 2026 12:25
@statxc
statxc force-pushed the feat/issue-830-reviewer-routing-auto-request branch from aa85d42 to 180b229 Compare June 24, 2026 12:34
@statxc
statxc force-pushed the feat/issue-830-reviewer-routing-auto-request branch from 180b229 to 48c8918 Compare June 24, 2026 12:47
@statxc

statxc commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

@JSONbored could you please review this PR?

@statxc
statxc force-pushed the feat/issue-830-reviewer-routing-auto-request branch from 48c8918 to 90ec14d Compare June 24, 2026 13:54
@JSONbored
JSONbored force-pushed the feat/issue-830-reviewer-routing-auto-request branch from 90ec14d to 6f27ad7 Compare June 24, 2026 20:26
@statxc
statxc force-pushed the feat/issue-830-reviewer-routing-auto-request branch from 6f27ad7 to 0183c6a Compare June 24, 2026 20:46
@statxc
statxc force-pushed the feat/issue-830-reviewer-routing-auto-request branch from 0183c6a to 0defbe3 Compare June 24, 2026 21:06

@JSONbored JSONbored left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Nice work here — the CODEOWNERS parser, the load-de-weighted ranking, and the test coverage are
all solid. I'm closing rather than merging for two reasons: this is two features in one PR, and
the auto_request write has a real safety hole. Resubmit as the stack at the bottom and it's in
good shape.

  1. Scope — two features in one PR. The advisory routing core (src/github/codeowners.ts +
    src/signals/reviewer-routing.ts, both new) stands on its own and doesn't need the write path
    at all. #830 itself says the auto_request action "warrants its own focused review" because it
    acts on live PRs. Land them separately (stack below).

  2. auto_request fires under dry-run — this is the blocker. Trace:

    • maybeAutoRequestReviewers (src/queue/processors.ts:1879) has no action-mode check — only
      the reviewerRoutingMode === "auto_request" opt-in.
    • it's called unconditionally at src/queue/processors.ts:2545, inside
      maybePublishPrPublicSurface, which still RUNS when a repo is in dry-run (it computes the
      gate verdict; only its Octokit writes get suppressed).
    • requestPullRequestReviewers (src/github/app.ts) writes with a raw fetch, so it never
      goes through the dry-run chokepoint makeInstallationOctokit (src/github/client.ts).
    • Net: a repo set to dry-run still requests real reviewers on real PRs.

    We routed every installation write through the dry-run-aware client in #1258 specifically to
    stop exactly this, and retrofitted the remaining raw-fetch writers in #1263 to honor the brake.
    Follow that pattern — preferably call through makeInstallationOctokit so dry-run/pause suppress
    it for free; or, if it stays a raw-fetch helper, early-return like fileUpstreamDriftIssues:

    // a paused / frozen / dry-run agent must not write (mirror #1263)
    if (isGlobalAgentPause(env) || (await isGlobalAgentFrozen(env))) return;

    Then confirm there's no other path that reaches the write under a non-live mode. Keep the
    newcomer opt-in and the already-requested idempotency you have — those are good.

Suggested stack (smallest first; split further if any exceeds ~10 files):
PR 1 — src/github/codeowners.ts (parser, pure) + test
PR 2 — src/signals/reviewer-routing.ts (ranking) + test
PR 3 — reviewerRoutingMode off|advisory: types/db/schema + migration + regenerated
openapi.json + settings-preview + focus-manifest + the PR-panel "Suggested reviewers"
render + the one-line fixture updates
PR 4 — auto_request only, with the dry-run fix above + tests

PRs 1–3 are low-risk and move fast; PR 4 then gets the focused review the live write needs.

Per PR: rebase onto latest main, 100% line + branch coverage with a regression test, no
AI-generated attribution in the PR body.

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(github-app): reviewer-routing auto_request action (#540 follow-up)

2 participants