feat(ui): maintainer self-serve AI review + BYOK key config (closes #663) - #665
Merged
Conversation
Add an AI review & BYOK settings panel to the maintainer dashboard so maintainers can configure dual-AI review and supply their own Anthropic/OpenAI key without touching the API directly. - New AiReviewSettings component: repo selector, mode (off/advisory/block), BYOK toggle, provider + optional model, and a write-only provider-key field (POST/GET-status/DELETE). The key is never rendered back — only the configured/last4 status is read. - Wires PUT /v1/repos/:owner/:repo/ai-review and the /ai-key routes via apiFetch with credentials:"include" (session-scoped maintainer authz). - Renders under SurfacePreview in the maintainer panel. closes #663, part of #525
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Note Gittensory Gate skippedPR closed before full evaluation. No late first comment was created.
💰 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. |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
gittensory-ui | 689dc6e | Commit Preview URL Branch Preview URL |
Jun 14 2026, 01:01 AM |
JSONbored
added a commit
that referenced
this pull request
Jun 14, 2026
…-only panel guard, key validation) (#670) Follow-up hardening from a security/completeness audit of the BYOK feature (PRs #664/#665). The panel was already maintainer-only via the backend gate; these changes close the confirmed gaps. Backend: - Bound the BYOK provider fetch with AbortSignal.timeout (20s), mirroring the github/gittensor timeoutFetch convention, so a hung Anthropic/OpenAI connection can't stall the queue worker. Surface the failure reason (timeout/http_error/exception) in the ai_usage_events audit metadata for observability — never any key material. - Classify POST/DELETE /ai-key and PUT /ai-review as "expensive" in routeClassForPath (POST /ai-key runs PBKDF2 100k iters + an encrypted upsert). - Enforce the provider/key prefix check the schema comment already described: Anthropic keys must start with sk-ant-, OpenAI with sk- (and not sk-ant-), so a mismatched key is rejected with a 400 instead of failing silently later. Frontend: - Add an explicit maintainer/owner/operator role gate to MaintainerPanel via useSession, so the dashboard query and the BYOK form never mount for a non-maintainer (the backend 403 remains the source of truth) and a clean "Maintainer access required" message replaces the raw 403. - Mirror the provider/key prefix validation client-side for instant feedback. Tests: provider-fetch timeout signal + recorded failure reason, rate-limit classification, and provider/key mismatch rejection (400). Branch coverage 97%.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


What
Adds a maintainer-facing AI review & BYOK settings panel to the dashboard (Option A), so maintainers can configure dual-AI review and supply their own Anthropic/OpenAI key entirely from the UI — no direct API calls, no repo secrets.
This is the UI half of the BYOK feature; the backend (config-as-code provider/model + the maintainer self-serve routes) lands in #664.
How
New
AiReviewSettingscomponent (rendered underSurfacePreviewin the maintainer panel):off/advisory/block(block only blocks on a dual-model consensus defect, confirmed-contributor-only).PUT /v1/repos/:owner/:repo/ai-review.POST /ai-key; status (configured ····last4) viaGET /ai-key;DELETE /ai-keyto remove.Security
configuredflag +last4+modelare ever read (the GET endpoint never returns the secret).apiFetchwithcredentials:"include"— the backend enforces maintainer/owner authz per repo.Verification
ui:typecheck✅ui:lint✅ui:build✅closes #663
part of #525
Depends on #664 (backend routes).