Skip to content

feat(frontend): Add LLM registry admin UI - #12468

Closed
Bentlybro wants to merge 6 commits into
feat/llm-admin-apifrom
feat/llm-admin-ui
Closed

feat(frontend): Add LLM registry admin UI#12468
Bentlybro wants to merge 6 commits into
feat/llm-admin-apifrom
feat/llm-admin-ui

Conversation

@Bentlybro

@Bentlybro Bentlybro commented Mar 18, 2026

Copy link
Copy Markdown
Member

Summary

Add admin UI for LLM registry management - Part 5 of 5 in incremental rollout.

Builds on PR #12467 (admin write API) to provide full visual management interface.

Changes

Admin Page (`/admin/llms`)

  • Main dashboard at `/admin/llms` with role-based access control
  • Sections for Providers, Creators, Models, and Active Migrations
  • Server-side data fetching with Next.js App Router

Main Components

Dashboard (`LlmRegistryDashboard.tsx`):

  • Active Migrations section (collapsible, only shows if migrations exist)
  • Providers & Creators side-by-side grid
  • Models table with recommended model selector
  • Error boundary with retry

Tables:

  • `ModelsTable.tsx` - Full model list with edit/delete/toggle actions
  • `ProviderList.tsx` - Provider management with expand/collapse
  • `CreatorsTable.tsx` - Creator management
  • `MigrationsTable.tsx` - Active migration tracking with revert option

CRUD Modals:

  • Add/Edit/Delete modals for Providers, Models, Creators
  • `DisableModelModal.tsx` - Toggle model with optional migration
  • Form validation with proper error handling

Other:

  • `RecommendedModelSelector.tsx` - Dropdown to set recommended model
  • `actions.ts` - Server actions calling admin API endpoints

Features

✅ Admin-only access (role-based)
✅ Full CRUD operations with modals
✅ Real-time cache revalidation after mutations
✅ Migration tracking and revert
✅ Recommended model management
✅ Responsive design
✅ Error boundaries
✅ Based on original PR #11699 design

Design

UI copied directly from original PR #11699 implementation - proven design, fully functional.

API calls will need updating to match new admin endpoint structure.

Testing

  1. Login as admin user
  2. Navigate to `/admin/llms`
  3. Create/edit/delete providers, models, creators
  4. Toggle model availability
  5. Set recommended model

Stacked PRs

Next Steps

After this PR merges, the LLM registry will be fully operational for admin management.

Block integration (consuming the registry in LLM blocks) comes in a future PR.

@github-project-automation github-project-automation Bot moved this to 🆕 Needs initial review in AutoGPT development kanban Mar 18, 2026
@github-actions github-actions Bot added the conflicts Automatically applied to PRs with merge conflicts label Mar 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request.

@coderabbitai

coderabbitai Bot commented Mar 18, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1b3c90c3-533b-423a-ac25-d0636b3c1960

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/llm-admin-ui

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added platform/frontend AutoGPT Platform - Front end platform/backend AutoGPT Platform - Back end labels Mar 18, 2026
@Bentlybro
Bentlybro force-pushed the feat/llm-admin-ui branch 3 times, most recently from 43a98fb to ca4843b Compare March 19, 2026 11:08

@autogpt-pr-reviewer autogpt-pr-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All 8 specialists have reported. Let me compile the verdict.


PR #12468 — "fix(frontend): Add type definitions and update component imports"
Author: unknown | Requested by: ntindle | Files: 137 changed (+15,068/−7,840)

Key files: server/v2/llm/ (new), data/llm_registry/ (new), admin/llms/ (new frontend), blocks/github/ (consolidation + deletions), copilot/ (cleanup)

🎯 Verdict: BLOCK

What This PR Does

This PR is significantly larger than its title suggests. It's actually Part 5 of a 5-part stacked PR series that introduces a complete LLM Registry system (Prisma schema, backend CRUD API, admin dashboard UI). Alongside that, it consolidates GitHub blocks (deleting 9+ blocks), removes the entire copilot notification system, cleans up credential selection, and regenerates the OpenAPI spec. The commit message ("Add type definitions and update component imports") describes only the final commit — the actual PR title on GitHub is "feat(frontend): Add LLM registry admin UI."

Specialist Findings

🛡️ Security ⚠️ — No critical vulnerabilities, but several medium-severity issues. Admin routes are properly auth-gated with requires_admin_user. All DB operations use Prisma (no SQL injection risk). However, the frontend admin actions.ts has a TODO: Add auth token from session — requests are sent without authentication, making the admin UI non-functional and creating a footgun if someone "fixes" it by disabling backend auth. The public /api/llm/models route exposes disabled models via ?enabled_only=false without requiring admin auth. LlmModelCost exposes credential_provider/credential_id to all authenticated users, leaking infrastructure details. The proxy route change reverts a known streaming truncation fix.

  • ⚠️ actions.ts:12-14 — No auth token in admin API calls (TODO left in code)
  • ⚠️ routes.py:42-53enabled_only=false accessible to non-admins
  • ⚠️ model.py:17-18 — Credential identifiers exposed in public API
  • ⚠️ proxy/[...path]/route.ts — Streaming revert re-introduces file truncation bug

🏗️ Architecture ✅ — The LLM Registry follows good patterns: clean data-layer separation (data/llm_registry/), proper Pydantic response models, CQRS-lite with read routes separate from admin write routes. Prisma schema is well-structured with correct FK constraints and check constraints. GitHub block consolidation is clean with zero orphaned imports. Copilot cleanup is complete.

  • ⚠️ admin_routes.py:28 — Admin router has no prefix (repeats /llm/ in every decorator) while public router uses APIRouter(prefix="/llm") — inconsistent pattern
  • ⚠️ data/llm_registry/model.py:6 — Data layer imports from blocks layer (from backend.blocks.llm import ModelMetadata) — wrong dependency direction, acceptable only as transitional step
  • ⚠️ registry.py — Module-level global mutable state (_dynamic_models, _schema_options, _lock) will be problematic for testing and multi-process deployments

Performance ⚠️ — The registry's in-memory cache pattern is reasonable for single-instance deployments but has issues at scale.

  • 🔴 schema.prisma:LlmModelCostMissing plain index on llmModelId. Only partial unique indexes exist (with WHERE clauses), which PostgreSQL cannot use for plain FK joins or CASCADE deletes. refresh_llm_registry() will sequential-scan the costs table.
  • 🟠 registry.py:61-62 — Single-instance in-memory cache with no cross-process invalidation. Admin mutations only refresh the responding instance; all others serve stale data until restart.
  • 🟠 admin_routes.py — Redundant DB round-trips: every update/delete does 3 queries (find by slug → find by ID in db_write → actual mutation).
  • 🟡 registry.py:183-193get_default_model_slug() re-sorts all models on every call instead of caching during refresh.
  • 🟡 registry.py:66-163 — Lock held during entire DB fetch + processing; should fetch outside lock and do atomic swap.

🧪 Testing 🔴 — Zero test coverage for the entire LLM Registry feature. This is the most significant gap. 984 lines of new backend code (registry.py 240 lines, db_write.py 294 lines, admin_routes.py 309 lines, routes.py 141 lines) and 3,185 lines of new frontend code ship with no tests at all. Additionally, test_github_blocks.py was deleted but prepare_pr_api_url() and surviving blocks still use the tested patterns — coverage lost for surviving code. The test_perplexity.py removal is mostly correct (tested code was deleted), but the PerplexityModel enum behavioral change (validation error instead of silent fallback) has no test proving the new behavior.

  • 🔴 New LLM Registry: 0% coverage across 6 backend files and 16 frontend files
  • ⚠️ test_gmail.py removal leaves _get_email_body with no protection against html2text raising during .handle()
  • run_block_test.py remaining tests correctly cover the simplified execution path
  • review_routes_test.py mock path updates are correct

📖 Quality 🔴 — Build-breaking import errors across the entire admin LLM UI. (Cross-confirmed by QA)

  • 🔴 All 9+ modal components import non-existent functions from actions.ts: components use names like deleteLlmModelAction, createLlmProviderAction, toggleLlmModelAction but the file exports deleteModel, createProvider, etc. Six functions are completely missing: deleteLlmCreatorAction, updateLlmCreatorAction, fetchLlmModelUsage, toggleLlmModelAction, setRecommendedModelAction, revertLlmMigrationAction.
  • ⚠️ routes.py:55-76,112-136LlmModelCost(...) mapping duplicated verbatim in two route handlers
  • ⚠️ admin_routes.py:126,178,246,291import prisma.models repeated as function-level import in 4 handlers
  • ⚠️ blocks/github/repo.py — 1174 lines after consolidation, repo_url.replace("https://github.com/", "") inlined 3 times

📦 Product 🔴 — 9+ GitHub blocks silently deleted with no migration path.

  • 🔴 GithubListCommitsBlock (8b13f579), GithubGetCommitBlock (389eee51), GithubMergePullRequestBlock (77456c22), GithubCompareBranchesBlock, GithubSearchCodeBlock, GithubGetRepositoryTreeBlock, GithubGetRepositoryInfoBlock, GithubForkRepositoryBlock, GithubStarRepositoryBlock — all deleted with no data migration. Existing user agents referencing these block IDs will silently break.
  • 🟡 Copilot notification removal — users lose all background completion feedback (WebSocket listener, browser notifications, sound, title badge, sidebar auto-refresh)
  • 🟡 useCredentialsInput.ts — Multi-type credential selection replaced with priority waterfall (OAuth always wins); users needing API key for providers that also support OAuth can't select it
  • ✅ Branch/file blocks consolidated with same block IDs preserved — no breakage there

📬 Discussion ⚠️Zero human review. PR has merge conflicts. Draft status.

  • PR has merge conflicts with dev (confirmed by github-actions bot)
  • No reviewers assigned, no human comments, no inline review threads
  • CodeRabbit automated review skipped because PR is still Draft
  • This is actually the entire 5-PR stacked series (#12357#12359#12371#12467#12468), carrying the cumulative diff. All 5 PRs are OPEN with none merged. Review should proceed bottom-up.
  • PR title mismatch: commit message says "fix(frontend)" but actual GitHub PR title is "feat(frontend): Add LLM registry admin UI" — and even that understates the scope

🔎 QA 🔴 — Existing features (login, signup, copilot, build, library, marketplace, password reset) all work cleanly. The new admin LLM Registry page (/admin/llms) is completely broken — build errors from wrong Table component import paths (@/components/atoms/Table/Table should be @/components/molecules/Table/Table) and non-existent action function imports (10+ files affected). The copilot page shows no artifacts from the notification removal — the cleanup is visually clean.

landing-page
login-page
dashboard-after-signup
copilot-page
build-page
library-page
marketplace-page
reset-password-page

Blockers (Must Fix)

  1. admin/llms/ — Build errors across all 10+ modal/table components — Wrong import paths for Table (atomsmolecules) and non-existent action function names. The entire admin LLM UI is non-functional. (Quality 🔴 + QA 🔴)
  2. admin/llms/actions.ts:12-14 — No auth token sent with admin API callsTODO: Add auth token from session means all admin CRUD operations fail with 401. (Security 🟠)
  3. actions.ts — 6 action functions completely missingdeleteLlmCreatorAction, updateLlmCreatorAction, fetchLlmModelUsage, toggleLlmModelAction, setRecommendedModelAction, revertLlmMigrationAction are imported but never defined. (Quality 🔴)
  4. blocks/github/commits.py, repo_branches.py, repo_files.py — 9+ blocks deleted with no migrationGithubListCommitsBlock, GithubMergePullRequestBlock, and 7 others removed. Existing agents using these block IDs will silently break at runtime. Need deprecation notices or registry fallback. (Product 🔴)
  5. Merge conflicts with dev — PR cannot be merged in its current state. (Discussion ⚠️)
  6. schema.prisma:LlmModelCost — Missing index on llmModelId — Partial unique indexes cannot serve FK joins; will cause sequential scans. (Performance 🔴)

Should Fix (Follow-up OK)

  1. data/llm_registry/, server/v2/llm/ — Zero test coverage — 984 lines of new backend code with no tests. At minimum: registry refresh tests, admin CRUD happy-path tests, public listing tests. (Testing 🔴)
  2. routes.py:42-53enabled_only=false accessible to non-admins — Should require admin auth or be removed from public route. (Security 🟡)
  3. model.py:17-18 — Credential identifiers in public API responsecredential_provider, credential_id, credential_type exposed to all authenticated users. (Security 🟡)
  4. registry.py — In-memory cache with no cross-instance invalidation — Admin mutations only refresh one instance. Add Redis pub/sub or TTL refresh. (Performance 🟠)
  5. admin_routes.py — 3 DB queries per mutation — Redundant slug→ID→mutation round-trips. (Performance 🟠)
  6. proxy/[...path]/route.ts — Streaming revert re-introduces truncation bug — Original code intentionally buffered to prevent file corruption. (Security 🟡)
  7. Copilot sidebar auto-refresh removedrefetchInterval: 10_000 deleted; sidebar no longer updates. Users get no feedback on background task completion. (Product 🟡)
  8. useCredentialsInput.ts — Credential type selection regression — Multi-type providers default to OAuth with no way to choose API key. (Product 🟡)

Risk Assessment

Merge risk: HIGH | Rollback: MODERATE (schema migration adds tables, doesn't alter existing ones; block deletions are the risk)

Additional context from Discussion Analyst: This PR carries the cumulative diff of 5 stacked PRs (#12357#12468), none of which are merged. The PR is still in Draft status with zero human reviews. The recommended path is to resolve merge conflicts, merge the stack bottom-up starting with the schema PR (#12357), or collapse into a single feature PR with the import/naming issues fixed.


REVIEW_COMPLETE
PR: #12468
Verdict: BLOCK
Blockers: 6

@github-project-automation github-project-automation Bot moved this from 🆕 Needs initial review to 🚧 Needs work in AutoGPT development kanban Mar 19, 2026
@autogpt-pr-reviewer

Copy link
Copy Markdown

⚠️ Code review could not be completed

The review failed due to an unexpected error after multiple retries.

If this persists, please contact support with job ID 5d391f2d-88ee-404e-88ba-7bb57c7c5c34.

@github-actions

Copy link
Copy Markdown
Contributor

Conflicts have been resolved! 🎉 A maintainer will review the pull request shortly.

@github-actions github-actions Bot removed the conflicts Automatically applied to PRs with merge conflicts label Mar 21, 2026
@github-actions

github-actions Bot commented Mar 21, 2026

Copy link
Copy Markdown
Contributor

🔍 PR Overlap Detection

This check compares your PR against all other open PRs targeting the same branch to detect potential merge conflicts early.

🔴 Merge Conflicts Detected

The following PRs have been tested and will have merge conflicts if merged after this PR. Consider coordinating with the authors.

🟡 Medium Risk — Some Line Overlap

These PRs have some overlapping changes:

  • feat(platform): Add LLM registry admin write API #12467 (Bentlybro · updated 3m ago)

    • autogpt_platform/backend/schema.prisma: L1301-1464
    • autogpt_platform/backend/backend/data/llm_registry/__init__.py: L1-31
    • autogpt_platform/backend/migrations/20260310_add_llm_registry_schema/migration.sql: L1-148
    • autogpt_platform/backend/backend/server/v2/llm/__init__.py: L1-6
    • autogpt_platform/backend/backend/server/v2/llm/model.py: L1-67
    • autogpt_platform/backend/backend/api/rest_api.py: L37-46, L117-148, L355-360, L376-391
    • autogpt_platform/backend/backend/data/llm_registry/model.py: L1-9
    • autogpt_platform/backend/backend/data/llm_registry/registry.py: L1-240
    • autogpt_platform/backend/backend/server/v2/llm/admin_routes.py: L1-309
    • autogpt_platform/backend/backend/server/v2/llm/db_write.py: L1-294
    • autogpt_platform/backend/backend/server/v2/llm/routes.py: L1-141
    • autogpt_platform/backend/backend/server/v2/llm/admin_model.py: L1-112
    • autogpt_platform/backend/migrations/20260310_seed_llm_registry/migration.sql: L1-260
  • feat(platform): Add LLM registry public read API #12371 (Bentlybro · updated 4m ago)

    • autogpt_platform/backend/schema.prisma: L1301-1464
    • autogpt_platform/backend/backend/data/llm_registry/__init__.py: L1-31
    • autogpt_platform/backend/migrations/20260310_add_llm_registry_schema/migration.sql: L1-148
    • autogpt_platform/backend/backend/server/v2/llm/model.py: L1-67
    • autogpt_platform/backend/backend/api/rest_api.py: L37-46, L117-148, L355-360, L376-386
    • autogpt_platform/backend/backend/data/llm_registry/model.py: L1-9
    • autogpt_platform/backend/backend/data/llm_registry/registry.py: L1-240
    • autogpt_platform/backend/backend/server/v2/llm/routes.py: L1-141
    • autogpt_platform/backend/backend/server/v2/llm/__init__.py: L1-5
    • autogpt_platform/backend/migrations/20260310_seed_llm_registry/migration.sql: L1-260
  • feat(platform): Add LLM registry core - DB layer + in-memory cache #12359 (Bentlybro · updated 6m ago)

    • autogpt_platform/backend/schema.prisma: L1301-1464
    • autogpt_platform/backend/backend/data/llm_registry/__init__.py: L1-31
    • autogpt_platform/backend/migrations/20260310_add_llm_registry_schema/migration.sql: L1-148
    • autogpt_platform/backend/backend/api/rest_api.py: L37-43, L117-147
    • autogpt_platform/backend/backend/data/llm_registry/model.py: L1-9
    • autogpt_platform/backend/backend/data/llm_registry/registry.py: L1-240
    • autogpt_platform/backend/migrations/20260310_seed_llm_registry/migration.sql: L1-260
  • feat(platform): Add LLM registry database schema and seed data #12357 (Bentlybro · updated 10m ago)

    • autogpt_platform/backend/schema.prisma: L1301-1464
    • autogpt_platform/backend/migrations/20260310_add_llm_registry_schema/migration.sql: L1-148
    • autogpt_platform/backend/migrations/20260310_seed_llm_registry/migration.sql: L1-260

🟢 Low Risk — File Overlap Only

These PRs touch the same files but different sections (click to expand)

Summary: 4 conflict(s), 4 medium risk, 2 low risk (out of 10 PRs with file overlap)


Auto-generated on push. Ignores: openapi.json, lock files.

@github-actions github-actions Bot removed platform/backend AutoGPT Platform - Back end platform/blocks conflicts Automatically applied to PRs with merge conflicts labels Apr 4, 2026
@github-actions

github-actions Bot commented Apr 4, 2026

Copy link
Copy Markdown
Contributor

Conflicts have been resolved! 🎉 A maintainer will review the pull request shortly.

@Bentlybro
Bentlybro force-pushed the feat/llm-admin-ui branch 2 times, most recently from e61394a to 2ed0408 Compare April 7, 2026 17:00
@Bentlybro
Bentlybro force-pushed the feat/llm-admin-api branch from 6e9731f to 8410448 Compare April 7, 2026 17:35
@github-actions github-actions Bot added the conflicts Automatically applied to PRs with merge conflicts label Apr 7, 2026
@github-actions

github-actions Bot commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request.

@Bentlybro
Bentlybro force-pushed the feat/llm-admin-ui branch from 2ed0408 to 2951d2c Compare April 7, 2026 17:35
@github-actions

github-actions Bot commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

Conflicts have been resolved! 🎉 A maintainer will review the pull request shortly.

@github-actions github-actions Bot removed the conflicts Automatically applied to PRs with merge conflicts label Apr 7, 2026
@Bentlybro
Bentlybro force-pushed the feat/llm-admin-api branch from be328c1 to afe119c Compare April 8, 2026 14:26
@github-actions

github-actions Bot commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request.

@github-actions github-actions Bot added the conflicts Automatically applied to PRs with merge conflicts label Apr 8, 2026
@github-actions

github-actions Bot commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

Conflicts have been resolved! 🎉 A maintainer will review the pull request shortly.

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request.

Complete admin interface for managing LLM providers, models, and creators:
- Provider CRUD with credential configuration
- Model CRUD with cost management, enable/disable toggle
- Creator CRUD for model creators
- Recommended model selector
- Admin layout sidebar entry for LLM Registry
- Table atom component for data display
…e/disable, migration list/revert

- toggleLlmModelAction now sends migration params (migrate_to_slug, reason, custom_credit_cost)
- deleteLlmModelAction passes replacement_model_slug query param
- fetchLlmModelUsage calls real /llm/models/{slug}/usage endpoint
- fetchLlmMigrations calls real /llm/migrations endpoint
- revertLlmMigrationAction calls /llm/migrations/{id}/revert
- Fix model usage calls to use slug instead of UUID
…l guard, required migration

DisableModelModal.tsx:
- Fix field name: usage.node_count (was usage.usage_count — always undefined)
- Recommended model: show blocking error UI instead of disable form;
  skip usage fetch entirely since the action is not allowed
- Usage > 0: remove optional migration checkbox; migration is now required
  and the form is always shown — submit disabled until a replacement is picked
- Usage = 0: unchanged — simple disable with no migration needed
- Extract RecommendedModelBlock and DisableForm as named sub-components
@github-actions

Copy link
Copy Markdown
Contributor

Conflicts have been resolved! 🎉 A maintainer will review the pull request shortly.

1 similar comment
@github-actions

Copy link
Copy Markdown
Contributor

Conflicts have been resolved! 🎉 A maintainer will review the pull request shortly.

… fix falsy update checks

- Rename provider_id -> provider_name in createLlmModelAction to match backend
- Remove stale provider_id field from updateLlmModelAction (not in UpdateLlmModelRequest)
- Replace any types with unknown/typed alternatives in adminFetch
- Fix falsy value checks in update actions to use !== null
@CLAassistant

CLAassistant commented May 11, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@ntindle

ntindle commented Jul 18, 2026

Copy link
Copy Markdown
Member

Closing in favor of the LLM registry restack: the admin UI (read slice; the editing slice follows as the next PR in the stack) is now #13612 (fresh re-cut onto current dev — the original migrations and seed data had drifted ~4 months). The design and much of the code here carried over directly; @Bentlybro is credited as co-author on the carried commits. Full stack starts at #13605. Thanks for the groundwork — the reviewed schema and cache design survived contact with the restack almost unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

platform/frontend AutoGPT Platform - Front end size/xl

Projects

Status: ✅ Done
Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants