feat(platform): Add LLM registry database schema and seed data - #12357
feat(platform): Add LLM registry database schema and seed data#12357Bentlybro wants to merge 22 commits into
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughThis pull request introduces a complete LLM Registry schema to the AutoGPT platform backend, consisting of a SQL migration that creates five new database tables (LlmProvider, LlmModel, LlmModelCost, LlmModelCreator, LlmModelMigration), an enum type (LlmCostUnit), and corresponding Prisma ORM model definitions. The schema includes indexes, foreign keys, and check constraints for data integrity. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
🔍 PR Overlap DetectionThis check compares your PR against all other open PRs targeting the same branch to detect potential merge conflicts early. 🔴 Merge Conflicts DetectedThe following PRs have been tested and will have merge conflicts if merged after this PR. Consider coordinating with the authors.
🟢 Low Risk — File Overlap OnlyThese PRs touch the same files but different sections (click to expand)
Summary: 2 conflict(s), 0 medium risk, 5 low risk (out of 7 PRs with file overlap) Auto-generated on push. Ignores: |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
autogpt_platform/backend/schema.prisma (1)
1396-1398: Drop the left-prefix duplicates.
@@unique([llmModelId, credentialProvider, unit])already servesllmModelIdlookups, and@@index([sourceModelSlug, isReverted])already servessourceModelSlug-only filters. Keeping the single-column variants just adds write overhead and index bloat.Lean index set
model LlmModelCost { ... @@unique([llmModelId, credentialProvider, unit]) - @@index([llmModelId]) @@index([credentialProvider]) @@map("platform.LlmModelCost") } model LlmModelMigration { ... - @@index([sourceModelSlug]) @@index([targetModelSlug]) @@index([isReverted]) @@index([sourceModelSlug, isReverted]) @@map("platform.LlmModelMigration") }Also applies to: 1451-1454
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@autogpt_platform/backend/schema.prisma` around lines 1396 - 1398, Drop redundant single-column indexes that are left-prefixes of multi-column constraints to reduce write overhead and index bloat: remove @@index([llmModelId]) and @@index([credentialProvider]) because @@unique([llmModelId, credentialProvider, unit]) already covers llmModelId and credentialProvider lookups, and remove @@index([sourceModelSlug]) where @@index([sourceModelSlug, isReverted]) exists; update the Prisma schema by deleting those single-column @@index declarations and keep the multi-column @@unique/@@index entries (e.g., @@unique([llmModelId, credentialProvider, unit]) and @@index([sourceModelSlug, isReverted])).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@autogpt_platform/backend/migrations/20260310_add_llm_registry_schema/migration.sql`:
- Line 47: Add CHECK constraints to the DDL so the database enforces the
documented numeric domains: constrain "priceTier" to BETWEEN 1 AND 3, and ensure
"creditCost", "customCreditCost", and "nodeCount" are non-negative (>= 0);
update the column definitions (the ALTER/CREATE statements that define
priceTier, creditCost, customCreditCost, nodeCount) to include NOT NULL and the
appropriate CHECK clauses so out-of-range values are rejected at the database
level, matching the contract used by backend/blocks/llm.py.
In `@autogpt_platform/backend/schema.prisma`:
- Around line 1425-1455: The LlmModelMigration rows use free-text
sourceModelSlug and targetModelSlug which can become orphaned; change the schema
to enforce referential integrity by replacing or supplementing those String
fields with foreign key relations to the LlmModel model (e.g., add sourceModelId
Int and targetModelId Int fields or change to
sourceModelLlmModelId/targetModelLlmModelId), add `@relation`(...) attributes
pointing to LlmModel (referencing LlmModel.id) and remove or deprecate the loose
slug fields (or keep slug fields but add explicit relations using LlmModel.slug
with `@unique` and `@relation`), and update @@index entries to use the new FK
columns (and adjust any code that constructs migrations to populate the new FK
fields instead of raw slugs).
---
Nitpick comments:
In `@autogpt_platform/backend/schema.prisma`:
- Around line 1396-1398: Drop redundant single-column indexes that are
left-prefixes of multi-column constraints to reduce write overhead and index
bloat: remove @@index([llmModelId]) and @@index([credentialProvider]) because
@@unique([llmModelId, credentialProvider, unit]) already covers llmModelId and
credentialProvider lookups, and remove @@index([sourceModelSlug]) where
@@index([sourceModelSlug, isReverted]) exists; update the Prisma schema by
deleting those single-column @@index declarations and keep the multi-column
@@unique/@@index entries (e.g., @@unique([llmModelId, credentialProvider, unit])
and @@index([sourceModelSlug, isReverted])).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: e90a5c0a-3391-4505-a3c4-a502d34ce66a
📒 Files selected for processing (2)
autogpt_platform/backend/migrations/20260310_add_llm_registry_schema/migration.sqlautogpt_platform/backend/schema.prisma
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
- GitHub Check: types
- GitHub Check: Seer Code Review
- GitHub Check: test (3.11)
- GitHub Check: test (3.12)
- GitHub Check: test (3.13)
- GitHub Check: Analyze (python)
- GitHub Check: Check PR Status
- GitHub Check: Analyze (typescript)
🧰 Additional context used
📓 Path-based instructions (2)
autogpt_platform/backend/schema.prisma
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Run database migrations with 'poetry run prisma migrate dev' and 'poetry run prisma generate' after schema changes in backend
Files:
autogpt_platform/backend/schema.prisma
autogpt_platform/backend/**/schema.prisma
📄 CodeRabbit inference engine (autogpt_platform/backend/CLAUDE.md)
Define key database models (User, AgentGraph, AgentGraphExecution, AgentNode, StoreListing) in
schema.prisma
Files:
autogpt_platform/backend/schema.prisma
🧠 Learnings (6)
📓 Common learnings
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/backend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:20.508Z
Learning: Applies to autogpt_platform/backend/**/schema.prisma : Define key database models (User, AgentGraph, AgentGraphExecution, AgentNode, StoreListing) in `schema.prisma`
Learnt from: Pwuts
Repo: Significant-Gravitas/AutoGPT PR: 12284
File: autogpt_platform/frontend/src/app/api/openapi.json:11897-11900
Timestamp: 2026-03-04T23:58:18.476Z
Learning: Repo: Significant-Gravitas/AutoGPT — PR `#12284`
Backend/frontend OpenAPI codegen convention: In backend/api/features/store/model.py, the StoreSubmission and StoreSubmissionAdminView models define submitted_at: datetime | None, changes_summary: str | None, and instructions: str | None with no default. This is intentional to produce “required but nullable” fields in OpenAPI (properties appear in required[] and use anyOf [type, null]). This matches Prisma’s submittedAt DateTime? and changesSummary String?. Do not flag this as a required/nullable mismatch.
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.490Z
Learning: Applies to autogpt_platform/backend/schema.prisma : Run database migrations with 'poetry run prisma migrate dev' and 'poetry run prisma generate' after schema changes in backend
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12213
File: autogpt_platform/frontend/src/app/api/openapi.json:9983-9995
Timestamp: 2026-02-27T15:59:00.370Z
Learning: Repo: Significant-Gravitas/AutoGPT PR: 12213 — Backend/frontend OpenAPI codegen
Learning: For MCP schema models, required OpenAPI fields must have no defaults in Pydantic. Specifically, MCPToolInfo.input_schema must be required (no Field(default_factory=dict)) so openapi.json emits it in "required", ensuring generated TS types treat input_schema as non-optional.
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/backend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:20.508Z
Learning: Applies to autogpt_platform/backend/backend/**/*.py : Use Prisma ORM for database operations in PostgreSQL with pgvector for embeddings
📚 Learning: 2026-02-04T16:50:20.508Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/backend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:20.508Z
Learning: Applies to autogpt_platform/backend/**/schema.prisma : Define key database models (User, AgentGraph, AgentGraphExecution, AgentNode, StoreListing) in `schema.prisma`
Applied to files:
autogpt_platform/backend/migrations/20260310_add_llm_registry_schema/migration.sqlautogpt_platform/backend/schema.prisma
📚 Learning: 2026-02-26T17:02:22.448Z
Learnt from: Pwuts
Repo: Significant-Gravitas/AutoGPT PR: 12211
File: .pre-commit-config.yaml:160-179
Timestamp: 2026-02-26T17:02:22.448Z
Learning: Keep the pre-commit hook pattern broad for autogpt_platform/backend to ensure OpenAPI schema changes are captured. Do not narrow to backend/api/ alone, since the generated schema depends on Pydantic models across multiple directories (backend/data/, backend/blocks/, backend/copilot/, backend/integrations/, backend/util/). Narrowing could miss schema changes and cause frontend type desynchronization.
Applied to files:
autogpt_platform/backend/migrations/20260310_add_llm_registry_schema/migration.sqlautogpt_platform/backend/schema.prisma
📚 Learning: 2026-03-05T00:13:52.412Z
Learnt from: Pwuts
Repo: Significant-Gravitas/AutoGPT PR: 12284
File: autogpt_platform/backend/schema.prisma:284-284
Timestamp: 2026-03-05T00:13:52.412Z
Learning: In `autogpt_platform/backend/schema.prisma`, the `AgentGraph` ↔ `StoreListing` relation uses the pattern: `AgentGraph` declares `StoreListing? relation(fields: [id], references: [agentGraphId], onDelete: NoAction)` and `StoreListing` declares `AgentGraph AgentGraph[]` with `agentGraphId String unique`. This is intentional and valid because `AgentGraph` has a composite PK `@id([id, version])` (multiple rows per graph id, one per version), while `StoreListing.agentGraphId` is `unique` (one listing per graph id). The `fields: [id], references: [agentGraphId]` on the `AgentGraph` side joins `AgentGraph.id` against `StoreListing.agentGraphId`. Do NOT flag this as a cardinality mismatch or malformed relation — `prisma validate` passes cleanly.
Applied to files:
autogpt_platform/backend/schema.prisma
📚 Learning: 2026-03-04T23:58:18.476Z
Learnt from: Pwuts
Repo: Significant-Gravitas/AutoGPT PR: 12284
File: autogpt_platform/frontend/src/app/api/openapi.json:11897-11900
Timestamp: 2026-03-04T23:58:18.476Z
Learning: Repo: Significant-Gravitas/AutoGPT — PR `#12284`
Backend/frontend OpenAPI codegen convention: In backend/api/features/store/model.py, the StoreSubmission and StoreSubmissionAdminView models define submitted_at: datetime | None, changes_summary: str | None, and instructions: str | None with no default. This is intentional to produce “required but nullable” fields in OpenAPI (properties appear in required[] and use anyOf [type, null]). This matches Prisma’s submittedAt DateTime? and changesSummary String?. Do not flag this as a required/nullable mismatch.
Applied to files:
autogpt_platform/backend/schema.prisma
📚 Learning: 2026-02-04T16:49:42.490Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.490Z
Learning: Applies to autogpt_platform/backend/schema.prisma : Run database migrations with 'poetry run prisma migrate dev' and 'poetry run prisma generate' after schema changes in backend
Applied to files:
autogpt_platform/backend/schema.prisma
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
autogpt_platform/backend/schema.prisma (2)
1397-1399: Drop the duplicatellmModelIdindex.
@@unique([llmModelId, credentialProvider, unit])already creates a btree that PostgreSQL can use forllmModelId = ?lookups via the leftmost prefix, so the standalone@@index([llmModelId])just adds write and storage overhead.♻️ Minimal cleanup
@@unique([llmModelId, credentialProvider, unit]) - @@index([llmModelId]) @@index([credentialProvider])🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@autogpt_platform/backend/schema.prisma` around lines 1397 - 1399, Remove the redundant single-column index on llmModelId: the model already declares @@unique([llmModelId, credentialProvider, unit]) which provides a btree usable for llmModelId lookups, so delete the line @@index([llmModelId]) (located alongside the @@unique([llmModelId, credentialProvider, unit]) and @@index([credentialProvider]) declarations) to avoid extra write/storage overhead.
1452-1455:sourceModelSlugis indexed twice.The composite index on
[sourceModelSlug, isReverted]already covers queries onsourceModelSlugalone, so the standalone@@index([sourceModelSlug])is redundant.♻️ Minimal cleanup
- @@index([sourceModelSlug]) @@index([targetModelSlug]) @@index([isReverted]) @@index([sourceModelSlug, isReverted]) // Composite index for active migration queries🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@autogpt_platform/backend/schema.prisma` around lines 1452 - 1455, Remove the redundant standalone index @@index([sourceModelSlug]) since the composite index @@index([sourceModelSlug, isReverted]) already covers queries filtering by sourceModelSlug; keep the composite @@index([sourceModelSlug, isReverted]) and the other indexes (@@index([targetModelSlug]) and @@index([isReverted])) unchanged to preserve intended query performance.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@autogpt_platform/backend/schema.prisma`:
- Around line 1435-1446: The customCreditCost Int? field is too narrow for
unit-aware pricing; update the schema so the migration override uses the same
shape as LlmModelCost (preserving its RUN vs TOKENS unit and any rate fields) or
replace customCreditCost with a relation to a dedicated LlmModelCostOverride
model that mirrors LlmModelCost (e.g., fields for unit/type, value, and
currency) and nullable association on the workflow/model record; change
references in billing code to read the new LlmModelCost-shaped override (or join
the override table) when present instead of treating customCreditCost as a
simple integer.
- Around line 1361-1366: The model capability flags are unsafe with true
defaults and one column name is misleading: change supportsTools and
supportsJsonOutput to default to false (so partially-seeded rows are not assumed
capable) and rename supportsParallelTool to supportsParallelToolCalls; update
the Model definition (fields supportsTools, supportsJsonOutput,
supportsReasoning, supportsParallelTool -> supportsParallelToolCalls) and then
search/replace any usage of supportsParallelTool in code, migrations, and
queries to use supportsParallelToolCalls to keep callers in sync.
---
Nitpick comments:
In `@autogpt_platform/backend/schema.prisma`:
- Around line 1397-1399: Remove the redundant single-column index on llmModelId:
the model already declares @@unique([llmModelId, credentialProvider, unit])
which provides a btree usable for llmModelId lookups, so delete the line
@@index([llmModelId]) (located alongside the @@unique([llmModelId,
credentialProvider, unit]) and @@index([credentialProvider]) declarations) to
avoid extra write/storage overhead.
- Around line 1452-1455: Remove the redundant standalone index
@@index([sourceModelSlug]) since the composite index @@index([sourceModelSlug,
isReverted]) already covers queries filtering by sourceModelSlug; keep the
composite @@index([sourceModelSlug, isReverted]) and the other indexes
(@@index([targetModelSlug]) and @@index([isReverted])) unchanged to preserve
intended query performance.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 5ce6319e-04c4-4328-b5d2-2a3a482365d1
📒 Files selected for processing (2)
autogpt_platform/backend/migrations/20260310_add_llm_registry_schema/migration.sqlautogpt_platform/backend/schema.prisma
🚧 Files skipped from review as they are similar to previous changes (1)
- autogpt_platform/backend/migrations/20260310_add_llm_registry_schema/migration.sql
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: types
- GitHub Check: Seer Code Review
- GitHub Check: test (3.11)
- GitHub Check: Check PR Status
- GitHub Check: Analyze (python)
🧰 Additional context used
📓 Path-based instructions (2)
autogpt_platform/backend/schema.prisma
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Run database migrations with 'poetry run prisma migrate dev' and 'poetry run prisma generate' after schema changes in backend
Files:
autogpt_platform/backend/schema.prisma
autogpt_platform/backend/**/schema.prisma
📄 CodeRabbit inference engine (autogpt_platform/backend/CLAUDE.md)
Define key database models (User, AgentGraph, AgentGraphExecution, AgentNode, StoreListing) in
schema.prisma
Files:
autogpt_platform/backend/schema.prisma
🧠 Learnings (8)
📓 Common learnings
Learnt from: Pwuts
Repo: Significant-Gravitas/AutoGPT PR: 12284
File: autogpt_platform/frontend/src/app/api/openapi.json:11897-11900
Timestamp: 2026-03-04T23:58:18.476Z
Learning: Repo: Significant-Gravitas/AutoGPT — PR `#12284`
Backend/frontend OpenAPI codegen convention: In backend/api/features/store/model.py, the StoreSubmission and StoreSubmissionAdminView models define submitted_at: datetime | None, changes_summary: str | None, and instructions: str | None with no default. This is intentional to produce “required but nullable” fields in OpenAPI (properties appear in required[] and use anyOf [type, null]). This matches Prisma’s submittedAt DateTime? and changesSummary String?. Do not flag this as a required/nullable mismatch.
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/backend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:20.508Z
Learning: Applies to autogpt_platform/backend/**/schema.prisma : Define key database models (User, AgentGraph, AgentGraphExecution, AgentNode, StoreListing) in `schema.prisma`
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.490Z
Learning: Applies to autogpt_platform/backend/schema.prisma : Run database migrations with 'poetry run prisma migrate dev' and 'poetry run prisma generate' after schema changes in backend
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12213
File: autogpt_platform/frontend/src/app/api/openapi.json:9983-9995
Timestamp: 2026-02-27T15:59:00.370Z
Learning: Repo: Significant-Gravitas/AutoGPT PR: 12213 — Backend/frontend OpenAPI codegen
Learning: For MCP schema models, required OpenAPI fields must have no defaults in Pydantic. Specifically, MCPToolInfo.input_schema must be required (no Field(default_factory=dict)) so openapi.json emits it in "required", ensuring generated TS types treat input_schema as non-optional.
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12213
File: autogpt_platform/frontend/src/app/api/openapi.json:9983-9995
Timestamp: 2026-02-27T15:59:00.370Z
Learning: Repo: Significant-Gravitas/AutoGPT PR: 12213 — OpenAPI/codegen
Learning: Ensuring a field is required in generated TS types needs two sides: (1) no default value on the Pydantic field, and (2) the OpenAPI model's "required" array must list it. For MCPToolInfo, making input_schema required in OpenAPI and removing Field(default_factory=dict) in the backend prevents optional typing drift.
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/backend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:20.508Z
Learning: Applies to autogpt_platform/backend/backend/**/*.py : Use Prisma ORM for database operations in PostgreSQL with pgvector for embeddings
📚 Learning: 2026-02-04T16:50:20.508Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/backend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:20.508Z
Learning: Applies to autogpt_platform/backend/**/schema.prisma : Define key database models (User, AgentGraph, AgentGraphExecution, AgentNode, StoreListing) in `schema.prisma`
Applied to files:
autogpt_platform/backend/schema.prisma
📚 Learning: 2026-03-05T00:13:52.412Z
Learnt from: Pwuts
Repo: Significant-Gravitas/AutoGPT PR: 12284
File: autogpt_platform/backend/schema.prisma:284-284
Timestamp: 2026-03-05T00:13:52.412Z
Learning: In `autogpt_platform/backend/schema.prisma`, the `AgentGraph` ↔ `StoreListing` relation uses the pattern: `AgentGraph` declares `StoreListing? relation(fields: [id], references: [agentGraphId], onDelete: NoAction)` and `StoreListing` declares `AgentGraph AgentGraph[]` with `agentGraphId String unique`. This is intentional and valid because `AgentGraph` has a composite PK `@id([id, version])` (multiple rows per graph id, one per version), while `StoreListing.agentGraphId` is `unique` (one listing per graph id). The `fields: [id], references: [agentGraphId]` on the `AgentGraph` side joins `AgentGraph.id` against `StoreListing.agentGraphId`. Do NOT flag this as a cardinality mismatch or malformed relation — `prisma validate` passes cleanly.
Applied to files:
autogpt_platform/backend/schema.prisma
📚 Learning: 2026-02-04T16:49:42.490Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.490Z
Learning: Applies to autogpt_platform/backend/schema.prisma : Run database migrations with 'poetry run prisma migrate dev' and 'poetry run prisma generate' after schema changes in backend
Applied to files:
autogpt_platform/backend/schema.prisma
📚 Learning: 2026-03-04T23:58:18.476Z
Learnt from: Pwuts
Repo: Significant-Gravitas/AutoGPT PR: 12284
File: autogpt_platform/frontend/src/app/api/openapi.json:11897-11900
Timestamp: 2026-03-04T23:58:18.476Z
Learning: Repo: Significant-Gravitas/AutoGPT — PR `#12284`
Backend/frontend OpenAPI codegen convention: In backend/api/features/store/model.py, the StoreSubmission and StoreSubmissionAdminView models define submitted_at: datetime | None, changes_summary: str | None, and instructions: str | None with no default. This is intentional to produce “required but nullable” fields in OpenAPI (properties appear in required[] and use anyOf [type, null]). This matches Prisma’s submittedAt DateTime? and changesSummary String?. Do not flag this as a required/nullable mismatch.
Applied to files:
autogpt_platform/backend/schema.prisma
📚 Learning: 2026-02-04T16:50:20.508Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/backend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:20.508Z
Learning: Applies to autogpt_platform/backend/backend/**/*.py : Use Prisma ORM for database operations in PostgreSQL with pgvector for embeddings
Applied to files:
autogpt_platform/backend/schema.prisma
📚 Learning: 2026-02-04T16:49:42.490Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.490Z
Learning: Always run 'poetry run prisma migrate dev' and 'poetry run prisma generate' after schema changes before backend development
Applied to files:
autogpt_platform/backend/schema.prisma
📚 Learning: 2026-02-26T17:02:22.448Z
Learnt from: Pwuts
Repo: Significant-Gravitas/AutoGPT PR: 12211
File: .pre-commit-config.yaml:160-179
Timestamp: 2026-02-26T17:02:22.448Z
Learning: Keep the pre-commit hook pattern broad for autogpt_platform/backend to ensure OpenAPI schema changes are captured. Do not narrow to backend/api/ alone, since the generated schema depends on Pydantic models across multiple directories (backend/data/, backend/blocks/, backend/copilot/, backend/integrations/, backend/util/). Narrowing could miss schema changes and cause frontend type desynchronization.
Applied to files:
autogpt_platform/backend/schema.prisma
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (3)
autogpt_platform/backend/schema.prisma (3)
1363-1368:⚠️ Potential issue | 🟠 MajorDefault capability flags to
false, nottrue.A partially seeded
LlmModelrow is treated as tool/JSON-capable by default today. That makes the registry optimistic in the unsafe direction. These flags should be opt-in, and this is also a good point to renamesupportsParallelToolto match the existing “parallel tool calls” terminology before clients depend on it.Suggested schema tweak
- supportsTools Boolean `@default`(true) - supportsJsonOutput Boolean `@default`(true) + supportsTools Boolean `@default`(false) + supportsJsonOutput Boolean `@default`(false) supportsReasoning Boolean `@default`(false) - supportsParallelTool Boolean `@default`(false) + supportsParallelToolCalls Boolean `@default`(false)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@autogpt_platform/backend/schema.prisma` around lines 1363 - 1368, The model capability flags are currently opt-out (true) but should be opt-in (false) and one field should be renamed for clarity: change the default values of supportsTools, supportsJsonOutput, supportsReasoning, and supportsParallelTool from `@default`(true) to `@default`(false), and rename the supportsParallelTool field to supportsParallelToolCalls (update all usages, queries, and any code referencing the old symbol such as LlmModel.supportsParallelTool to the new LlmModel.supportsParallelToolCalls) and add a migration to preserve data and map the old column to the new name.
1428-1458:⚠️ Potential issue | 🟠 MajorMake migration rows reference
LlmModeldirectly.
sourceModelSlugandtargetModelSlugare free-text right now, so a typo or later slug rename silently breaks migration resolution. Add foreign-key relations toLlmModeland keep the slug columns only as denormalized audit data if you still want the readable copies.Minimal Prisma shape
model LlmModel { id String `@id` `@default`(uuid()) createdAt DateTime `@default`(now()) updatedAt DateTime `@updatedAt` slug String `@unique` ... Costs LlmModelCost[] + SourceMigrations LlmModelMigration[] `@relation`("LlmMigrationSource") + TargetMigrations LlmModelMigration[] `@relation`("LlmMigrationTarget") @@index([providerId, isEnabled]) @@index([creatorId]) @@schema("platform") } model LlmModelMigration { id String `@id` `@default`(uuid()) createdAt DateTime `@default`(now()) updatedAt DateTime `@updatedAt` - sourceModelSlug String - targetModelSlug String + sourceModelId String + SourceModel LlmModel `@relation`("LlmMigrationSource", fields: [sourceModelId], references: [id], onDelete: Restrict) + targetModelId String + TargetModel LlmModel `@relation`("LlmMigrationTarget", fields: [targetModelId], references: [id], onDelete: Restrict) + sourceModelSlug String + targetModelSlug String reason String? ... - @@index([sourceModelSlug]) - @@index([targetModelSlug]) + @@index([sourceModelId]) + @@index([targetModelId]) @@index([isReverted]) - @@index([sourceModelSlug, isReverted]) + @@index([sourceModelId, isReverted]) @@schema("platform") }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@autogpt_platform/backend/schema.prisma` around lines 1428 - 1458, The migration table currently uses free-text sourceModelSlug and targetModelSlug which can break on typos/renames; add explicit foreign-key relation fields (e.g., sourceModelId and targetModelId) that reference LlmModel's primary key via Prisma `@relation` attributes, keep the slug columns only as denormalized audit copies, and set an appropriate onDelete behavior (e.g., SetNull) so historical rows remain valid when LlmModel rows change; also add indexes on the new FK fields and update any comments/TODOs (and billing integration logic) to read from the FK-linked LlmModel when resolving migrations while falling back to the denormalized slug if the relation is null.
1437-1448:⚠️ Potential issue | 🟠 MajorThe migration pricing override loses the cost unit.
LlmModelCostis unit-aware, butcustomCreditCostcollapses the override to one bare integer. That works for flat per-run pricing, but it cannot express a token-priced override unambiguously. The migration override needs the same unit-aware shape asLlmModelCost, or a relation to a dedicated override record.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@autogpt_platform/backend/schema.prisma` around lines 1437 - 1448, The customCreditCost field collapses pricing to a bare Int and loses the unit information used by LlmModelCost; change the schema so the migration override is unit-aware by either (A) replacing customCreditCost Int? with a typed relation to the existing LlmModelCost shape (e.g., customCreditCost LlmModelCost? or embed the same fields from LlmModelCost) or (B) add a new model (e.g., MigrationPricingOverride) with the same unit-aware fields as LlmModelCost (cost, unit, perToken/perRun flags) and reference it from the workflow record; keep the DB constraint semantics (non-negative when present) and update any code that reads customCreditCost to use the new shape/relation so token-priced overrides are unambiguous.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@autogpt_platform/backend/schema.prisma`:
- Around line 1325-1337: LlmProvider.name is currently a free String which
allows typos/case mismatches that later cause Unsupported LLM provider errors;
change the schema so the provider key is constrained: define a Prisma enum
(e.g., LlmProviderKey) listing the supported provider identifiers (the same set
used by the provider dispatch in autogpt_platform/backend/backend/blocks/llm.py
and autogpt_platform/backend/backend/integrations/providers.py) and replace name
String with name LlmProviderKey, or alternatively split into nameKey
LlmProviderKey plus displayName/displayLabel free-form fields; update any model
references (Models, LlmModel relations) to use the new enum field name and
migrate existing data accordingly.
---
Duplicate comments:
In `@autogpt_platform/backend/schema.prisma`:
- Around line 1363-1368: The model capability flags are currently opt-out (true)
but should be opt-in (false) and one field should be renamed for clarity: change
the default values of supportsTools, supportsJsonOutput, supportsReasoning, and
supportsParallelTool from `@default`(true) to `@default`(false), and rename the
supportsParallelTool field to supportsParallelToolCalls (update all usages,
queries, and any code referencing the old symbol such as
LlmModel.supportsParallelTool to the new LlmModel.supportsParallelToolCalls) and
add a migration to preserve data and map the old column to the new name.
- Around line 1428-1458: The migration table currently uses free-text
sourceModelSlug and targetModelSlug which can break on typos/renames; add
explicit foreign-key relation fields (e.g., sourceModelId and targetModelId)
that reference LlmModel's primary key via Prisma `@relation` attributes, keep the
slug columns only as denormalized audit copies, and set an appropriate onDelete
behavior (e.g., SetNull) so historical rows remain valid when LlmModel rows
change; also add indexes on the new FK fields and update any comments/TODOs (and
billing integration logic) to read from the FK-linked LlmModel when resolving
migrations while falling back to the denormalized slug if the relation is null.
- Around line 1437-1448: The customCreditCost field collapses pricing to a bare
Int and loses the unit information used by LlmModelCost; change the schema so
the migration override is unit-aware by either (A) replacing customCreditCost
Int? with a typed relation to the existing LlmModelCost shape (e.g.,
customCreditCost LlmModelCost? or embed the same fields from LlmModelCost) or
(B) add a new model (e.g., MigrationPricingOverride) with the same unit-aware
fields as LlmModelCost (cost, unit, perToken/perRun flags) and reference it from
the workflow record; keep the DB constraint semantics (non-negative when
present) and update any code that reads customCreditCost to use the new
shape/relation so token-priced overrides are unambiguous.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 5969db40-5609-42ac-830c-8ce3cbd9d66a
📒 Files selected for processing (2)
autogpt_platform/backend/migrations/20260310_add_llm_registry_schema/migration.sqlautogpt_platform/backend/schema.prisma
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
- GitHub Check: types
- GitHub Check: Seer Code Review
- GitHub Check: test (3.11)
- GitHub Check: Analyze (python)
- GitHub Check: Analyze (typescript)
- GitHub Check: test (3.12)
- GitHub Check: test (3.13)
- GitHub Check: Check PR Status
🧰 Additional context used
📓 Path-based instructions (2)
autogpt_platform/backend/schema.prisma
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Run database migrations with 'poetry run prisma migrate dev' and 'poetry run prisma generate' after schema changes in backend
Files:
autogpt_platform/backend/schema.prisma
autogpt_platform/backend/**/schema.prisma
📄 CodeRabbit inference engine (autogpt_platform/backend/CLAUDE.md)
Define key database models (User, AgentGraph, AgentGraphExecution, AgentNode, StoreListing) in
schema.prisma
Files:
autogpt_platform/backend/schema.prisma
🧠 Learnings (11)
📓 Common learnings
Learnt from: Pwuts
Repo: Significant-Gravitas/AutoGPT PR: 12284
File: autogpt_platform/frontend/src/app/api/openapi.json:11897-11900
Timestamp: 2026-03-04T23:58:18.476Z
Learning: Repo: Significant-Gravitas/AutoGPT — PR `#12284`
Backend/frontend OpenAPI codegen convention: In backend/api/features/store/model.py, the StoreSubmission and StoreSubmissionAdminView models define submitted_at: datetime | None, changes_summary: str | None, and instructions: str | None with no default. This is intentional to produce “required but nullable” fields in OpenAPI (properties appear in required[] and use anyOf [type, null]). This matches Prisma’s submittedAt DateTime? and changesSummary String?. Do not flag this as a required/nullable mismatch.
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/backend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:20.508Z
Learning: Applies to autogpt_platform/backend/**/schema.prisma : Define key database models (User, AgentGraph, AgentGraphExecution, AgentNode, StoreListing) in `schema.prisma`
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.490Z
Learning: Applies to autogpt_platform/backend/schema.prisma : Run database migrations with 'poetry run prisma migrate dev' and 'poetry run prisma generate' after schema changes in backend
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12213
File: autogpt_platform/frontend/src/app/api/openapi.json:9983-9995
Timestamp: 2026-02-27T15:59:00.370Z
Learning: Repo: Significant-Gravitas/AutoGPT PR: 12213 — Backend/frontend OpenAPI codegen
Learning: For MCP schema models, required OpenAPI fields must have no defaults in Pydantic. Specifically, MCPToolInfo.input_schema must be required (no Field(default_factory=dict)) so openapi.json emits it in "required", ensuring generated TS types treat input_schema as non-optional.
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12213
File: autogpt_platform/frontend/src/app/api/openapi.json:9983-9995
Timestamp: 2026-02-27T15:59:00.370Z
Learning: Repo: Significant-Gravitas/AutoGPT PR: 12213 — OpenAPI/codegen
Learning: Ensuring a field is required in generated TS types needs two sides: (1) no default value on the Pydantic field, and (2) the OpenAPI model's "required" array must list it. For MCPToolInfo, making input_schema required in OpenAPI and removing Field(default_factory=dict) in the backend prevents optional typing drift.
📚 Learning: 2026-02-04T16:50:20.508Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/backend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:20.508Z
Learning: Applies to autogpt_platform/backend/**/schema.prisma : Define key database models (User, AgentGraph, AgentGraphExecution, AgentNode, StoreListing) in `schema.prisma`
Applied to files:
autogpt_platform/backend/schema.prismaautogpt_platform/backend/migrations/20260310_add_llm_registry_schema/migration.sql
📚 Learning: 2026-02-04T16:49:42.490Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.490Z
Learning: Applies to autogpt_platform/backend/schema.prisma : Run database migrations with 'poetry run prisma migrate dev' and 'poetry run prisma generate' after schema changes in backend
Applied to files:
autogpt_platform/backend/schema.prismaautogpt_platform/backend/migrations/20260310_add_llm_registry_schema/migration.sql
📚 Learning: 2026-03-05T00:13:52.412Z
Learnt from: Pwuts
Repo: Significant-Gravitas/AutoGPT PR: 12284
File: autogpt_platform/backend/schema.prisma:284-284
Timestamp: 2026-03-05T00:13:52.412Z
Learning: In `autogpt_platform/backend/schema.prisma`, the `AgentGraph` ↔ `StoreListing` relation uses the pattern: `AgentGraph` declares `StoreListing? relation(fields: [id], references: [agentGraphId], onDelete: NoAction)` and `StoreListing` declares `AgentGraph AgentGraph[]` with `agentGraphId String unique`. This is intentional and valid because `AgentGraph` has a composite PK `@id([id, version])` (multiple rows per graph id, one per version), while `StoreListing.agentGraphId` is `unique` (one listing per graph id). The `fields: [id], references: [agentGraphId]` on the `AgentGraph` side joins `AgentGraph.id` against `StoreListing.agentGraphId`. Do NOT flag this as a cardinality mismatch or malformed relation — `prisma validate` passes cleanly.
Applied to files:
autogpt_platform/backend/schema.prisma
📚 Learning: 2026-03-04T23:58:18.476Z
Learnt from: Pwuts
Repo: Significant-Gravitas/AutoGPT PR: 12284
File: autogpt_platform/frontend/src/app/api/openapi.json:11897-11900
Timestamp: 2026-03-04T23:58:18.476Z
Learning: Repo: Significant-Gravitas/AutoGPT — PR `#12284`
Backend/frontend OpenAPI codegen convention: In backend/api/features/store/model.py, the StoreSubmission and StoreSubmissionAdminView models define submitted_at: datetime | None, changes_summary: str | None, and instructions: str | None with no default. This is intentional to produce “required but nullable” fields in OpenAPI (properties appear in required[] and use anyOf [type, null]). This matches Prisma’s submittedAt DateTime? and changesSummary String?. Do not flag this as a required/nullable mismatch.
Applied to files:
autogpt_platform/backend/schema.prisma
📚 Learning: 2026-02-27T15:59:00.370Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12213
File: autogpt_platform/frontend/src/app/api/openapi.json:9983-9995
Timestamp: 2026-02-27T15:59:00.370Z
Learning: Repo: Significant-Gravitas/AutoGPT PR: 12213 — OpenAPI/codegen
Learning: Ensuring a field is required in generated TS types needs two sides: (1) no default value on the Pydantic field, and (2) the OpenAPI model's "required" array must list it. For MCPToolInfo, making input_schema required in OpenAPI and removing Field(default_factory=dict) in the backend prevents optional typing drift.
Applied to files:
autogpt_platform/backend/schema.prisma
📚 Learning: 2026-02-27T15:59:00.370Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12213
File: autogpt_platform/frontend/src/app/api/openapi.json:9983-9995
Timestamp: 2026-02-27T15:59:00.370Z
Learning: Repo: Significant-Gravitas/AutoGPT PR: 12213 — Backend/frontend OpenAPI codegen
Learning: For MCP schema models, required OpenAPI fields must have no defaults in Pydantic. Specifically, MCPToolInfo.input_schema must be required (no Field(default_factory=dict)) so openapi.json emits it in "required", ensuring generated TS types treat input_schema as non-optional.
Applied to files:
autogpt_platform/backend/schema.prisma
📚 Learning: 2026-03-10T08:39:13.707Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12356
File: autogpt_platform/backend/backend/copilot/constants.py:9-12
Timestamp: 2026-03-10T08:39:13.707Z
Learning: In Significant-Gravitas/AutoGPT PR `#12356`, the `COPILOT_SYNTHETIC_ID_PREFIX = "copilot-"` check in `create_auto_approval_record` (human_review.py) is intentional and safe. The `graph_exec_id` passed to this function comes from server-side `PendingHumanReview` DB records (not from user input); the API only accepts `node_exec_id` from users. Synthetic `copilot-*` IDs are only ever created server-side in `run_block.py`. The prefix skip avoids a DB lookup for a `AgentGraphExecution` record that legitimately does not exist for CoPilot sessions, while `user_id` scoping is enforced at the auth layer and on the resulting auto-approval record.
Applied to files:
autogpt_platform/backend/schema.prisma
📚 Learning: 2026-02-04T16:50:20.508Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/backend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:20.508Z
Learning: Applies to autogpt_platform/backend/backend/**/*.py : Use Prisma ORM for database operations in PostgreSQL with pgvector for embeddings
Applied to files:
autogpt_platform/backend/schema.prisma
📚 Learning: 2026-02-04T16:49:42.490Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.490Z
Learning: Always run 'poetry run prisma migrate dev' and 'poetry run prisma generate' after schema changes before backend development
Applied to files:
autogpt_platform/backend/schema.prisma
📚 Learning: 2026-02-26T17:02:22.448Z
Learnt from: Pwuts
Repo: Significant-Gravitas/AutoGPT PR: 12211
File: .pre-commit-config.yaml:160-179
Timestamp: 2026-02-26T17:02:22.448Z
Learning: Keep the pre-commit hook pattern broad for autogpt_platform/backend to ensure OpenAPI schema changes are captured. Do not narrow to backend/api/ alone, since the generated schema depends on Pydantic models across multiple directories (backend/data/, backend/blocks/, backend/copilot/, backend/integrations/, backend/util/). Narrowing could miss schema changes and cause frontend type desynchronization.
Applied to files:
autogpt_platform/backend/schema.prismaautogpt_platform/backend/migrations/20260310_add_llm_registry_schema/migration.sql
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@autogpt_platform/backend/schema.prisma`:
- Around line 6-13: The schema uses multiSchema so every existing model, view,
and enum (e.g., User, AgentGraph and the other ~37 models, the 6 views, and all
enums) must include an explicit @@schema("public") attribute; update each
existing model, view, and enum declaration to add @@schema("public") (leave the
newly added LLM registry entities with @@schema("platform") unchanged) so that
all previously defined entities are explicitly assigned to the public schema and
Prisma CI stops failing.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 793bfab4-2632-49b9-8989-575903dc19c7
📒 Files selected for processing (2)
autogpt_platform/backend/migrations/20260310_add_llm_registry_schema/migration.sqlautogpt_platform/backend/schema.prisma
📜 Review details
🧰 Additional context used
📓 Path-based instructions (2)
autogpt_platform/backend/schema.prisma
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Run database migrations with 'poetry run prisma migrate dev' and 'poetry run prisma generate' after schema changes in backend
Files:
autogpt_platform/backend/schema.prisma
autogpt_platform/backend/**/schema.prisma
📄 CodeRabbit inference engine (autogpt_platform/backend/CLAUDE.md)
Define key database models (User, AgentGraph, AgentGraphExecution, AgentNode, StoreListing) in
schema.prisma
Files:
autogpt_platform/backend/schema.prisma
🧠 Learnings (13)
📓 Common learnings
Learnt from: Pwuts
Repo: Significant-Gravitas/AutoGPT PR: 12284
File: autogpt_platform/frontend/src/app/api/openapi.json:11897-11900
Timestamp: 2026-03-04T23:58:18.476Z
Learning: Repo: Significant-Gravitas/AutoGPT — PR `#12284`
Backend/frontend OpenAPI codegen convention: In backend/api/features/store/model.py, the StoreSubmission and StoreSubmissionAdminView models define submitted_at: datetime | None, changes_summary: str | None, and instructions: str | None with no default. This is intentional to produce “required but nullable” fields in OpenAPI (properties appear in required[] and use anyOf [type, null]). This matches Prisma’s submittedAt DateTime? and changesSummary String?. Do not flag this as a required/nullable mismatch.
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/backend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:20.508Z
Learning: Applies to autogpt_platform/backend/**/schema.prisma : Define key database models (User, AgentGraph, AgentGraphExecution, AgentNode, StoreListing) in `schema.prisma`
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12213
File: autogpt_platform/frontend/src/app/api/openapi.json:9983-9995
Timestamp: 2026-02-27T15:59:00.370Z
Learning: Repo: Significant-Gravitas/AutoGPT PR: 12213 — Backend/frontend OpenAPI codegen
Learning: For MCP schema models, required OpenAPI fields must have no defaults in Pydantic. Specifically, MCPToolInfo.input_schema must be required (no Field(default_factory=dict)) so openapi.json emits it in "required", ensuring generated TS types treat input_schema as non-optional.
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12213
File: autogpt_platform/frontend/src/app/api/openapi.json:9983-9995
Timestamp: 2026-02-27T15:59:00.370Z
Learning: Repo: Significant-Gravitas/AutoGPT PR: 12213 — OpenAPI/codegen
Learning: Ensuring a field is required in generated TS types needs two sides: (1) no default value on the Pydantic field, and (2) the OpenAPI model's "required" array must list it. For MCPToolInfo, making input_schema required in OpenAPI and removing Field(default_factory=dict) in the backend prevents optional typing drift.
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.490Z
Learning: Applies to autogpt_platform/backend/schema.prisma : Run database migrations with 'poetry run prisma migrate dev' and 'poetry run prisma generate' after schema changes in backend
📚 Learning: 2026-02-04T16:50:20.508Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/backend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:20.508Z
Learning: Applies to autogpt_platform/backend/**/schema.prisma : Define key database models (User, AgentGraph, AgentGraphExecution, AgentNode, StoreListing) in `schema.prisma`
Applied to files:
autogpt_platform/backend/schema.prismaautogpt_platform/backend/migrations/20260310_add_llm_registry_schema/migration.sql
📚 Learning: 2026-02-04T16:49:42.490Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.490Z
Learning: Applies to autogpt_platform/backend/schema.prisma : Run database migrations with 'poetry run prisma migrate dev' and 'poetry run prisma generate' after schema changes in backend
Applied to files:
autogpt_platform/backend/schema.prismaautogpt_platform/backend/migrations/20260310_add_llm_registry_schema/migration.sql
📚 Learning: 2026-03-05T00:13:52.412Z
Learnt from: Pwuts
Repo: Significant-Gravitas/AutoGPT PR: 12284
File: autogpt_platform/backend/schema.prisma:284-284
Timestamp: 2026-03-05T00:13:52.412Z
Learning: In `autogpt_platform/backend/schema.prisma`, the `AgentGraph` ↔ `StoreListing` relation uses the pattern: `AgentGraph` declares `StoreListing? relation(fields: [id], references: [agentGraphId], onDelete: NoAction)` and `StoreListing` declares `AgentGraph AgentGraph[]` with `agentGraphId String unique`. This is intentional and valid because `AgentGraph` has a composite PK `@id([id, version])` (multiple rows per graph id, one per version), while `StoreListing.agentGraphId` is `unique` (one listing per graph id). The `fields: [id], references: [agentGraphId]` on the `AgentGraph` side joins `AgentGraph.id` against `StoreListing.agentGraphId`. Do NOT flag this as a cardinality mismatch or malformed relation — `prisma validate` passes cleanly.
Applied to files:
autogpt_platform/backend/schema.prisma
📚 Learning: 2026-03-04T23:58:18.476Z
Learnt from: Pwuts
Repo: Significant-Gravitas/AutoGPT PR: 12284
File: autogpt_platform/frontend/src/app/api/openapi.json:11897-11900
Timestamp: 2026-03-04T23:58:18.476Z
Learning: Repo: Significant-Gravitas/AutoGPT — PR `#12284`
Backend/frontend OpenAPI codegen convention: In backend/api/features/store/model.py, the StoreSubmission and StoreSubmissionAdminView models define submitted_at: datetime | None, changes_summary: str | None, and instructions: str | None with no default. This is intentional to produce “required but nullable” fields in OpenAPI (properties appear in required[] and use anyOf [type, null]). This matches Prisma’s submittedAt DateTime? and changesSummary String?. Do not flag this as a required/nullable mismatch.
Applied to files:
autogpt_platform/backend/schema.prisma
📚 Learning: 2026-02-04T16:50:20.508Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/backend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:20.508Z
Learning: Applies to autogpt_platform/backend/backend/**/*.py : Use Prisma ORM for database operations in PostgreSQL with pgvector for embeddings
Applied to files:
autogpt_platform/backend/schema.prisma
📚 Learning: 2026-02-27T15:59:00.370Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12213
File: autogpt_platform/frontend/src/app/api/openapi.json:9983-9995
Timestamp: 2026-02-27T15:59:00.370Z
Learning: Repo: Significant-Gravitas/AutoGPT PR: 12213 — OpenAPI/codegen
Learning: Ensuring a field is required in generated TS types needs two sides: (1) no default value on the Pydantic field, and (2) the OpenAPI model's "required" array must list it. For MCPToolInfo, making input_schema required in OpenAPI and removing Field(default_factory=dict) in the backend prevents optional typing drift.
Applied to files:
autogpt_platform/backend/schema.prisma
📚 Learning: 2026-02-27T15:59:00.370Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12213
File: autogpt_platform/frontend/src/app/api/openapi.json:9983-9995
Timestamp: 2026-02-27T15:59:00.370Z
Learning: Repo: Significant-Gravitas/AutoGPT PR: 12213 — Backend/frontend OpenAPI codegen
Learning: For MCP schema models, required OpenAPI fields must have no defaults in Pydantic. Specifically, MCPToolInfo.input_schema must be required (no Field(default_factory=dict)) so openapi.json emits it in "required", ensuring generated TS types treat input_schema as non-optional.
Applied to files:
autogpt_platform/backend/schema.prisma
📚 Learning: 2026-03-10T08:39:13.707Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12356
File: autogpt_platform/backend/backend/copilot/constants.py:9-12
Timestamp: 2026-03-10T08:39:13.707Z
Learning: In Significant-Gravitas/AutoGPT PR `#12356`, the `COPILOT_SYNTHETIC_ID_PREFIX = "copilot-"` check in `create_auto_approval_record` (human_review.py) is intentional and safe. The `graph_exec_id` passed to this function comes from server-side `PendingHumanReview` DB records (not from user input); the API only accepts `node_exec_id` from users. Synthetic `copilot-*` IDs are only ever created server-side in `run_block.py`. The prefix skip avoids a DB lookup for a `AgentGraphExecution` record that legitimately does not exist for CoPilot sessions, while `user_id` scoping is enforced at the auth layer and on the resulting auto-approval record.
Applied to files:
autogpt_platform/backend/schema.prisma
📚 Learning: 2026-01-19T07:20:23.494Z
Learnt from: ntindle
Repo: Significant-Gravitas/AutoGPT PR: 11795
File: autogpt_platform/backend/backend/api/features/chat/tools/utils.py:92-111
Timestamp: 2026-01-19T07:20:23.494Z
Learning: In autogpt_platform/backend/backend/api/features/chat/tools/utils.py, the _serialize_missing_credential function uses next(iter(field_info.provider)) for provider selection. The PR author confirmed this non-deterministic provider selection is acceptable because the function returns both "type" (single, for backward compatibility) and "types" (full array), which achieves the primary goal of deterministic credential type presentation.
Applied to files:
autogpt_platform/backend/schema.prisma
📚 Learning: 2026-03-01T07:59:02.311Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12213
File: autogpt_platform/frontend/src/app/api/openapi.json:10030-10037
Timestamp: 2026-03-01T07:59:02.311Z
Learning: Repo: Significant-Gravitas/AutoGPT PR: 12213 — For MCP manual token storage, backend model autogpt_platform/backend/backend/api/features/mcp/routes.py defines MCPStoreTokenRequest.token as Pydantic SecretStr with a min length constraint, which generates OpenAPI schema metadata (format: "password", writeOnly: true, minLength: 1) in autogpt_platform/frontend/src/app/api/openapi.json. Prefer SecretStr (with length constraints) for sensitive request fields so generated TS clients and docs treat them as secrets.
Applied to files:
autogpt_platform/backend/schema.prisma
📚 Learning: 2026-02-04T16:49:42.490Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.490Z
Learning: Always run 'poetry run prisma migrate dev' and 'poetry run prisma generate' after schema changes before backend development
Applied to files:
autogpt_platform/backend/schema.prisma
📚 Learning: 2026-02-26T17:02:22.448Z
Learnt from: Pwuts
Repo: Significant-Gravitas/AutoGPT PR: 12211
File: .pre-commit-config.yaml:160-179
Timestamp: 2026-02-26T17:02:22.448Z
Learning: Keep the pre-commit hook pattern broad for autogpt_platform/backend to ensure OpenAPI schema changes are captured. Do not narrow to backend/api/ alone, since the generated schema depends on Pydantic models across multiple directories (backend/data/, backend/blocks/, backend/copilot/, backend/integrations/, backend/util/). Narrowing could miss schema changes and cause frontend type desynchronization.
Applied to files:
autogpt_platform/backend/schema.prismaautogpt_platform/backend/migrations/20260310_add_llm_registry_schema/migration.sql
🪛 GitHub Actions: AutoGPT Platform - Backend CI
autogpt_platform/backend/schema.prisma
[error] 18-18: Prisma schema validation error for model 'User': This model is missing an @@schema attribute.
[error] 107-107: Prisma schema validation error for model 'UserOnboarding': This model is missing an @@schema attribute.
[error] 130-130: Prisma schema validation error for model 'CoPilotUnderstanding': This model is missing an @@schema attribute.
[error] 150-150: Prisma schema validation error for model 'UserWorkspace': This model is missing an @@schema attribute.
[error] 164-164: Prisma schema validation error for model 'UserWorkspaceFile': This model is missing an @@schema attribute.
[error] 190-190: Prisma schema validation error for model 'BuilderSearchHistory': This model is missing an @@schema attribute.
[error] 209-209: Prisma schema validation error for model 'ChatSession': This model is missing an @@schema attribute.
[error] 233-233: Prisma schema validation error for model 'ChatMessage': This model is missing an @@schema attribute.
[error] 256-256: Prisma schema validation error for model 'AgentGraph': This model is missing an @@schema attribute.
[error] 302-302: Prisma schema validation error for model 'AgentPreset': This model is missing an @@schema attribute.
[error] 350-350: Prisma schema validation error for model 'NotificationEvent': This model is missing an @@schema attribute.
[error] 364-364: Prisma schema validation error for model 'UserNotificationBatch': This model is missing an @@schema attribute.
[error] 382-382: Prisma schema validation error for model 'LibraryAgent': This model is missing an @@schema attribute.
[error] 417-417: Prisma schema validation error for model 'LibraryFolder': This model is missing an @@schema attribute.
[error] 447-447: Prisma schema validation error for model 'AgentNode': This model is missing an @@schema attribute.
[error] 479-479: Prisma schema validation error for model 'AgentNodeLink': This model is missing an @@schema attribute.
[error] 500-500: Prisma schema validation error for model 'AgentBlock': This model is missing an @@schema attribute.
[error] 530-530: Prisma schema validation error for model 'AgentGraphExecution': This model is missing an @@schema attribute.
[error] 581-581: Prisma schema validation error for model 'AgentNodeExecution': This model is missing an @@schema attribute.
[error] 608-608: Prisma schema validation error for model 'AgentNodeExecutionInputOutput': This model is missing an @@schema attribute.
[error] 651-651: Prisma schema validation error for model 'PendingHumanReview': This model is missing an @@schema attribute.
[error] 677-677: Prisma schema validation error for model 'IntegrationWebhook': This model is missing an @@schema attribute.
[error] 699-699: Prisma schema validation error for model 'AnalyticsDetails': This model is missing an @@schema attribute.
[error] 728-728: Prisma schema validation error for model 'AnalyticsMetrics': This model is missing an @@schema attribute.
[error] 760-760: Prisma schema validation error for model 'CreditTransaction': This model is missing an @@schema attribute.
[error] 785-785: Prisma schema validation error for model 'CreditRefundRequest': This model is missing an @@schema attribute.
[error] 807-807: Prisma schema validation error for model 'SearchTerms': This model is missing an @@schema attribute.
[error] 817-817: Prisma schema validation error for model 'Profile': This model is missing an @@schema attribute.
[error] 979-979: Prisma schema validation error for model 'StoreListing': This model is missing an @@schema attribute.
[error] 1013-1013: Prisma schema validation error for model 'StoreListingVersion': This model is missing an @@schema attribute.
[error] 1092-1092: Prisma schema validation error for model 'UnifiedContentEmbedding': This model is missing an @@schema attribute.
[error] 1117-1117: Prisma schema validation error for model 'StoreListingReview': This model is missing an @@schema attribute.
[error] 1158-1158: Prisma schema validation error for model 'APIKey': This model is missing an @@schema attribute.
[error] 1183-1183: Prisma schema validation error for model 'UserBalance': This model is missing an @@schema attribute.
[error] 1206-1206: Prisma schema validation error for model 'OAuthApplication': This model is missing an @@schema attribute.
[error] 1239-1239: Prisma schema validation error for model 'OAuthAuthorizationCode': This model is missing an @@schema attribute.
[error] 1266-1266: Prisma schema validation error for model 'OAuthAccessToken': This model is missing an @@schema attribute.
[error] 1288-1288: Prisma schema validation error for model 'OAuthRefreshToken': This model is missing an @@schema attribute.
[error] 841-841: Prisma schema validation error for view 'Creator': This view is missing an @@schema attribute.
[error] 866-866: Prisma schema validation error for view 'StoreAgent': This view is missing an @@schema attribute.
[error] 904-904: Prisma schema validation error for view 'StoreSubmission': This view is missing an @@schema attribute.
[error] 943-943: Prisma schema validation error for view 'mv_agent_run_counts': This view is missing an @@schema attribute.
[error] 955-955: Prisma schema validation error for view 'mv_review_stats': This view is missing an @@schema attribute.
[error] 970-970: Prisma schema validation error for view 'mv_suggested_blocks': This view is missing an @@schema attribute.
[error] 77-77: This enum 'OnboardingStep' is missing an @@schema attribute.
[error] Multiple Prisma schema elements are invalid due to missing @@Schema attributes; cannot continue generation.
🪛 GitHub Actions: AutoGPT Platform - Frontend CI
autogpt_platform/backend/schema.prisma
[error] 18-18: Prisma schema validation failed. Model 'User' is missing an @@Schema attribute.
[error] 107-107: Prisma schema validation failed. Model 'UserOnboarding' is missing an @@Schema attribute.
[error] 130-130: Prisma schema validation failed. Model 'CoPilotUnderstanding' is missing an @@Schema attribute.
[error] 150-150: Prisma schema validation failed. Model 'UserWorkspace' is missing an @@Schema attribute.
[error] 164-164: Prisma schema validation failed. Model 'UserWorkspaceFile' is missing an @@Schema attribute.
[error] 190-190: Prisma schema validation failed. Model 'BuilderSearchHistory' is missing an @@Schema attribute.
[error] 302-302: Prisma schema validation failed. Model 'AgentPreset' is missing an @@Schema attribute.
[error] 417-417: Prisma schema validation failed. Model 'LibraryFolder' is missing an @@Schema attribute.
[error] 447-447: Prisma schema validation failed. Model 'AgentNode' is missing an @@Schema attribute.
[error] 479-479: Prisma schema validation failed. Model 'AgentNodeLink' is missing an @@Schema attribute.
[error] 500-500: Prisma schema validation failed. Model 'AgentBlock' is missing an @@Schema attribute.
[error] 581-581: Prisma schema validation failed. Model 'AgentNodeExecution' is missing an @@Schema attribute.
[error] 608-608: Prisma schema validation failed. Model 'AgentNodeExecutionInputOutput' is missing an @@Schema attribute.
[error] 651-651: Prisma schema validation failed. Model 'PendingHumanReview' is missing an @@Schema attribute.
[error] 677-677: Prisma schema validation failed. Model 'IntegrationWebhook' is missing an @@Schema attribute.
[error] 699-699: Prisma schema validation failed. Model 'AnalyticsDetails' is missing an @@Schema attribute.
[error] 728-728: Prisma schema validation failed. Model 'AnalyticsMetrics' is missing an @@Schema attribute.
[error] 760-760: Prisma schema validation failed. Model 'CreditTransaction' is missing an @@Schema attribute.
[error] 785-785: Prisma schema validation failed. Model 'CreditRefundRequest' is missing an @@Schema attribute.
[error] 807-807: Prisma schema validation failed. Model 'SearchTerms' is missing an @@Schema attribute.
[error] 817-817: Prisma schema validation failed. Model 'Profile' is missing an @@Schema attribute.
[error] 979-979: Prisma schema validation failed. Model 'StoreListing' is missing an @@Schema attribute.
[error] 1013-1013: Prisma schema validation failed. Model 'StoreListingVersion' is missing an @@Schema attribute.
[error] 1117-1117: Prisma schema validation failed. Model 'StoreListingReview' is missing an @@Schema attribute.
[error] 1158-1158: Prisma schema validation failed. Model 'APIKey' is missing an @@Schema attribute.
[error] 1239-1239: Prisma schema validation failed. Model 'OAuthAuthorizationCode' is missing an @@Schema attribute.
[error] 1266-1266: Prisma schema validation failed. Model 'OAuthAccessToken' is missing an @@Schema attribute.
[error] 1288-1288: Prisma schema validation failed. Model 'OAuthRefreshToken' is missing an @@Schema attribute.
[error] 841-841: Prisma schema validation failed. View 'Creator' is missing an @@Schema attribute.
[error] 904-904: Prisma schema validation failed. View 'StoreSubmission' is missing an @@Schema attribute.
[error] 943-943: Prisma schema validation failed. View 'mv_agent_run_counts' is missing an @@Schema attribute.
[error] 955-955: Prisma schema validation failed. View 'mv_review_stats' is missing an @@Schema attribute.
[error] 970-970: Prisma schema validation failed. View 'mv_suggested_blocks' is missing an @@Schema attribute.
[error] 77-77: Prisma schema validation failed. Enum 'OnboardingStep' is missing an @@Schema attribute.
[error] 18-18: Prisma generate failed due to multiple schema validation errors (see above).
🔇 Additional comments (9)
autogpt_platform/backend/schema.prisma (5)
1320-1338: LGTM on the LlmProvider model structure.The model provides a clean separation of concerns with
nameas the unique identifier anddisplayNamefor UI. The optional credential fields (defaultCredentialProvider,defaultCredentialId,defaultCredentialType) offer flexibility for provider configuration.Note: A past review suggested constraining
nameto a Prisma enum sincellm.pyonly supports a fixed set of providers. This is a valid point for a follow-up PR once provider dispatch becomes table-driven.
1340-1380: Well-designed LlmModel with safe defaults.Good improvements:
- Capability flags (
supportsTools,supportsJsonOutput,supportsReasoning,supportsParallelToolCalls) all default tofalse, preventing partially-seeded rows from being incorrectly assumed capable.- Clean separation of
providerId(who serves the model) fromcreatorId(who trained it).- Appropriate FK behaviors:
RESTRICTon provider prevents orphaning;SET NULLon creator allows creator deletion.- Indexes on
(providerId, isEnabled)and(creatorId)support common query patterns.
1382-1403: LGTM on LlmModelCost design.The unique constraint
@@unique([llmModelId, credentialProvider, unit])correctly ensures one cost entry per model-provider-unit combination, supporting bothRUN(fixed cost) andTOKENS(variable cost) pricing models per credential provider.
1405-1421: LGTM on LlmModelCreator.Clean design for tracking model creators (e.g., OpenAI, Meta, Anthropic) separately from providers who serve them, enabling the same creator's models to be listed across multiple providers.
1423-1461: Documented limitations acknowledged in LlmModelMigration.The extensive TODO comments (lines 1437-1450) properly document the known limitations:
sourceModelSlug/targetModelSluglack FK relations toLlmModel.slug(orphan risk)customCreditCostis unit-agnostic (ambiguous for token-priced models)These were flagged in past reviews and are appropriately marked for follow-up PRs. The composite index
(sourceModelSlug, isReverted)at line 1459 is useful for querying active migrations by source model.autogpt_platform/backend/migrations/20260310_add_llm_registry_schema/migration.sql (4)
1-5: LGTM on schema and enum creation.The schema creation is properly idempotent with
IF NOT EXISTS. The enum creation follows standard Prisma migration patterns where the_prisma_migrationstable ensures each migration runs exactly once.
38-61: LlmModel table correctly implements safe capability defaults.All capability columns (
supportsTools,supportsJsonOutput,supportsReasoning,supportsParallelToolCalls) default tofalse, ensuring partially-seeded rows aren't assumed capable. This aligns with the Prisma schema and addresses previous feedback.
97-126: LGTM on index strategy.Appropriate index coverage:
- Unique indexes enforce business constraints on
name/slugcolumns- Composite index
(llmModelId, credentialProvider, unit)prevents duplicate cost entries- Migration indexes support common query patterns (active migrations by source/target)
136-145: CHECK constraints properly enforce domain rules.The constraints correctly implement the documented business rules:
priceTier BETWEEN 1 AND 3enforces the tier systemcreditCost >= 0andnodeCount >= 0prevent invalid negative valuescustomCreditCost IS NULL OR >= 0handles nullable override correctlyThis addresses the feedback from past reviews about enforcing numeric domain rules at the DDL level.
There was a problem hiding this comment.
Actionable comments posted: 2
♻️ Duplicate comments (2)
autogpt_platform/backend/schema.prisma (2)
1430-1444:⚠️ Potential issue | 🟠 Major
customCreditCostis still too narrow for token-priced models.Line 1444 collapses the override to a bare integer, while
LlmModelCostis unit-aware. For aTOKENSmodel, billing still has no reliable way to know what this override means. This should mirrorLlmModelCostor point to a dedicated override record instead of storing a unit-lessInt.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@autogpt_platform/backend/schema.prisma` around lines 1430 - 1444, The current customCreditCost Int? is unit-less and incompatible with token-priced models; change it to a unit-aware structure by either replacing customCreditCost with a relation to LlmModelCost (e.g., customCreditCostId -> LlmModelCost) or create a new model (e.g., MigrationPricingOverride with fields amount Int, unit PricingUnit enum/TOKENS|RUN|FLAT) and reference it from the workflow/entity instead of the Int; update the schema to enforce non-negative amount, adjust any codepaths expecting customCreditCost to read the related record (or amount+unit), and add a migration and comment describing the new semantics so billing can unambiguously apply overrides.
1421-1423:⚠️ Potential issue | 🟠 MajorBack these migration slugs with foreign keys.
These fields are still free text. A typo, delete, or later slug rename can leave
LlmModelMigrationpointing at models that no longer exist. Please relate them toLlmModeldirectly, ideally via stable model IDs rather than raw slugs.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@autogpt_platform/backend/schema.prisma` around lines 1421 - 1423, LlmModelMigration currently stores free-text sourceModelSlug and targetModelSlug; change these to relational foreign keys pointing at LlmModel (e.g., sourceModelId and targetModelId referencing LlmModel.id) and add proper Prisma relation attributes on the LlmModelMigration model and reciprocal relation fields on LlmModel so migrations cannot point at non-existent models; keep or drop the slug columns as needed for denormalized read access, but ensure the canonical link is the foreign-key ID, update any create/update logic to set the IDs (not raw slugs), and add appropriate indexes/constraints to enforce referential integrity.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@autogpt_platform/backend/schema.prisma`:
- Around line 1450-1452: Add a partial unique index to prevent multiple active
migrations for the same source model: create a SQL migration that adds a unique
index on the LlmModelMigration table for column sourceModelSlug WHERE isReverted
= false (use the name LlmModelMigration_active_source_key), and include the
matching DROP INDEX in the down/rollback migration; this targets the model
LlmModelMigration and columns sourceModelSlug and isReverted so routing cannot
find more than one active (isReverted = false) row per sourceModelSlug.
- Around line 1385-1396: The current unique constraint on the LlmModelCost model
(the @@unique([llmModelId, credentialProvider, unit]) definition) prevents
having both a provider-level default and credential-specific overrides; remove
that @@unique and instead add two migration SQL unique indexes: one unique index
on (llmModelId, credentialProvider, unit) WHERE credentialId IS NULL (name it
LlmModelCost_default_cost_key) and a second unique index on (llmModelId,
credentialProvider, credentialId, unit) WHERE credentialId IS NOT NULL (name it
LlmModelCost_credential_cost_key); keep the existing
@@index([credentialProvider]) and apply the SQL in your migration so Prisma
schema (LlmModelCost fields: credentialProvider, credentialId, unit, llmModelId)
supports both default and credential-specific pricing.
---
Duplicate comments:
In `@autogpt_platform/backend/schema.prisma`:
- Around line 1430-1444: The current customCreditCost Int? is unit-less and
incompatible with token-priced models; change it to a unit-aware structure by
either replacing customCreditCost with a relation to LlmModelCost (e.g.,
customCreditCostId -> LlmModelCost) or create a new model (e.g.,
MigrationPricingOverride with fields amount Int, unit PricingUnit
enum/TOKENS|RUN|FLAT) and reference it from the workflow/entity instead of the
Int; update the schema to enforce non-negative amount, adjust any codepaths
expecting customCreditCost to read the related record (or amount+unit), and add
a migration and comment describing the new semantics so billing can
unambiguously apply overrides.
- Around line 1421-1423: LlmModelMigration currently stores free-text
sourceModelSlug and targetModelSlug; change these to relational foreign keys
pointing at LlmModel (e.g., sourceModelId and targetModelId referencing
LlmModel.id) and add proper Prisma relation attributes on the LlmModelMigration
model and reciprocal relation fields on LlmModel so migrations cannot point at
non-existent models; keep or drop the slug columns as needed for denormalized
read access, but ensure the canonical link is the foreign-key ID, update any
create/update logic to set the IDs (not raw slugs), and add appropriate
indexes/constraints to enforce referential integrity.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: e84fee1d-d050-4a7e-b3e7-8eeb5e044823
📒 Files selected for processing (1)
autogpt_platform/backend/schema.prisma
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: test (3.12)
- GitHub Check: test (3.13)
- GitHub Check: test (3.11)
- GitHub Check: Seer Code Review
- GitHub Check: Analyze (python)
- GitHub Check: Check PR Status
🧰 Additional context used
📓 Path-based instructions (2)
autogpt_platform/backend/schema.prisma
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Run database migrations with 'poetry run prisma migrate dev' and 'poetry run prisma generate' after schema changes in backend
Files:
autogpt_platform/backend/schema.prisma
autogpt_platform/backend/**/schema.prisma
📄 CodeRabbit inference engine (autogpt_platform/backend/CLAUDE.md)
Define key database models (User, AgentGraph, AgentGraphExecution, AgentNode, StoreListing) in
schema.prisma
Files:
autogpt_platform/backend/schema.prisma
🧠 Learnings (11)
📓 Common learnings
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/backend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:20.508Z
Learning: Applies to autogpt_platform/backend/**/schema.prisma : Define key database models (User, AgentGraph, AgentGraphExecution, AgentNode, StoreListing) in `schema.prisma`
Learnt from: Pwuts
Repo: Significant-Gravitas/AutoGPT PR: 12284
File: autogpt_platform/frontend/src/app/api/openapi.json:11897-11900
Timestamp: 2026-03-04T23:58:18.476Z
Learning: Repo: Significant-Gravitas/AutoGPT — PR `#12284`
Backend/frontend OpenAPI codegen convention: In backend/api/features/store/model.py, the StoreSubmission and StoreSubmissionAdminView models define submitted_at: datetime | None, changes_summary: str | None, and instructions: str | None with no default. This is intentional to produce “required but nullable” fields in OpenAPI (properties appear in required[] and use anyOf [type, null]). This matches Prisma’s submittedAt DateTime? and changesSummary String?. Do not flag this as a required/nullable mismatch.
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.490Z
Learning: Applies to autogpt_platform/backend/schema.prisma : Run database migrations with 'poetry run prisma migrate dev' and 'poetry run prisma generate' after schema changes in backend
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12213
File: autogpt_platform/frontend/src/app/api/openapi.json:9983-9995
Timestamp: 2026-02-27T15:59:00.370Z
Learning: Repo: Significant-Gravitas/AutoGPT PR: 12213 — Backend/frontend OpenAPI codegen
Learning: For MCP schema models, required OpenAPI fields must have no defaults in Pydantic. Specifically, MCPToolInfo.input_schema must be required (no Field(default_factory=dict)) so openapi.json emits it in "required", ensuring generated TS types treat input_schema as non-optional.
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12213
File: autogpt_platform/frontend/src/app/api/openapi.json:9983-9995
Timestamp: 2026-02-27T15:59:00.370Z
Learning: Repo: Significant-Gravitas/AutoGPT PR: 12213 — OpenAPI/codegen
Learning: Ensuring a field is required in generated TS types needs two sides: (1) no default value on the Pydantic field, and (2) the OpenAPI model's "required" array must list it. For MCPToolInfo, making input_schema required in OpenAPI and removing Field(default_factory=dict) in the backend prevents optional typing drift.
📚 Learning: 2026-02-04T16:50:20.508Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/backend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:20.508Z
Learning: Applies to autogpt_platform/backend/**/schema.prisma : Define key database models (User, AgentGraph, AgentGraphExecution, AgentNode, StoreListing) in `schema.prisma`
Applied to files:
autogpt_platform/backend/schema.prisma
📚 Learning: 2026-03-05T00:13:52.412Z
Learnt from: Pwuts
Repo: Significant-Gravitas/AutoGPT PR: 12284
File: autogpt_platform/backend/schema.prisma:284-284
Timestamp: 2026-03-05T00:13:52.412Z
Learning: In `autogpt_platform/backend/schema.prisma`, the `AgentGraph` ↔ `StoreListing` relation uses the pattern: `AgentGraph` declares `StoreListing? relation(fields: [id], references: [agentGraphId], onDelete: NoAction)` and `StoreListing` declares `AgentGraph AgentGraph[]` with `agentGraphId String unique`. This is intentional and valid because `AgentGraph` has a composite PK `@id([id, version])` (multiple rows per graph id, one per version), while `StoreListing.agentGraphId` is `unique` (one listing per graph id). The `fields: [id], references: [agentGraphId]` on the `AgentGraph` side joins `AgentGraph.id` against `StoreListing.agentGraphId`. Do NOT flag this as a cardinality mismatch or malformed relation — `prisma validate` passes cleanly.
Applied to files:
autogpt_platform/backend/schema.prisma
📚 Learning: 2026-03-04T23:58:18.476Z
Learnt from: Pwuts
Repo: Significant-Gravitas/AutoGPT PR: 12284
File: autogpt_platform/frontend/src/app/api/openapi.json:11897-11900
Timestamp: 2026-03-04T23:58:18.476Z
Learning: Repo: Significant-Gravitas/AutoGPT — PR `#12284`
Backend/frontend OpenAPI codegen convention: In backend/api/features/store/model.py, the StoreSubmission and StoreSubmissionAdminView models define submitted_at: datetime | None, changes_summary: str | None, and instructions: str | None with no default. This is intentional to produce “required but nullable” fields in OpenAPI (properties appear in required[] and use anyOf [type, null]). This matches Prisma’s submittedAt DateTime? and changesSummary String?. Do not flag this as a required/nullable mismatch.
Applied to files:
autogpt_platform/backend/schema.prisma
📚 Learning: 2026-02-04T16:49:42.490Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.490Z
Learning: Applies to autogpt_platform/backend/schema.prisma : Run database migrations with 'poetry run prisma migrate dev' and 'poetry run prisma generate' after schema changes in backend
Applied to files:
autogpt_platform/backend/schema.prisma
📚 Learning: 2026-02-27T15:59:00.370Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12213
File: autogpt_platform/frontend/src/app/api/openapi.json:9983-9995
Timestamp: 2026-02-27T15:59:00.370Z
Learning: Repo: Significant-Gravitas/AutoGPT PR: 12213 — OpenAPI/codegen
Learning: Ensuring a field is required in generated TS types needs two sides: (1) no default value on the Pydantic field, and (2) the OpenAPI model's "required" array must list it. For MCPToolInfo, making input_schema required in OpenAPI and removing Field(default_factory=dict) in the backend prevents optional typing drift.
Applied to files:
autogpt_platform/backend/schema.prisma
📚 Learning: 2026-02-27T15:59:00.370Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12213
File: autogpt_platform/frontend/src/app/api/openapi.json:9983-9995
Timestamp: 2026-02-27T15:59:00.370Z
Learning: Repo: Significant-Gravitas/AutoGPT PR: 12213 — Backend/frontend OpenAPI codegen
Learning: For MCP schema models, required OpenAPI fields must have no defaults in Pydantic. Specifically, MCPToolInfo.input_schema must be required (no Field(default_factory=dict)) so openapi.json emits it in "required", ensuring generated TS types treat input_schema as non-optional.
Applied to files:
autogpt_platform/backend/schema.prisma
📚 Learning: 2026-03-10T08:39:13.707Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12356
File: autogpt_platform/backend/backend/copilot/constants.py:9-12
Timestamp: 2026-03-10T08:39:13.707Z
Learning: In Significant-Gravitas/AutoGPT PR `#12356`, the `COPILOT_SYNTHETIC_ID_PREFIX = "copilot-"` check in `create_auto_approval_record` (human_review.py) is intentional and safe. The `graph_exec_id` passed to this function comes from server-side `PendingHumanReview` DB records (not from user input); the API only accepts `node_exec_id` from users. Synthetic `copilot-*` IDs are only ever created server-side in `run_block.py`. The prefix skip avoids a DB lookup for a `AgentGraphExecution` record that legitimately does not exist for CoPilot sessions, while `user_id` scoping is enforced at the auth layer and on the resulting auto-approval record.
Applied to files:
autogpt_platform/backend/schema.prisma
📚 Learning: 2026-01-19T07:20:23.494Z
Learnt from: ntindle
Repo: Significant-Gravitas/AutoGPT PR: 11795
File: autogpt_platform/backend/backend/api/features/chat/tools/utils.py:92-111
Timestamp: 2026-01-19T07:20:23.494Z
Learning: In autogpt_platform/backend/backend/api/features/chat/tools/utils.py, the _serialize_missing_credential function uses next(iter(field_info.provider)) for provider selection. The PR author confirmed this non-deterministic provider selection is acceptable because the function returns both "type" (single, for backward compatibility) and "types" (full array), which achieves the primary goal of deterministic credential type presentation.
Applied to files:
autogpt_platform/backend/schema.prisma
📚 Learning: 2026-03-01T07:59:02.311Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12213
File: autogpt_platform/frontend/src/app/api/openapi.json:10030-10037
Timestamp: 2026-03-01T07:59:02.311Z
Learning: Repo: Significant-Gravitas/AutoGPT PR: 12213 — For MCP manual token storage, backend model autogpt_platform/backend/backend/api/features/mcp/routes.py defines MCPStoreTokenRequest.token as Pydantic SecretStr with a min length constraint, which generates OpenAPI schema metadata (format: "password", writeOnly: true, minLength: 1) in autogpt_platform/frontend/src/app/api/openapi.json. Prefer SecretStr (with length constraints) for sensitive request fields so generated TS clients and docs treat them as secrets.
Applied to files:
autogpt_platform/backend/schema.prisma
📚 Learning: 2026-02-26T17:02:22.448Z
Learnt from: Pwuts
Repo: Significant-Gravitas/AutoGPT PR: 12211
File: .pre-commit-config.yaml:160-179
Timestamp: 2026-02-26T17:02:22.448Z
Learning: Keep the pre-commit hook pattern broad for autogpt_platform/backend to ensure OpenAPI schema changes are captured. Do not narrow to backend/api/ alone, since the generated schema depends on Pydantic models across multiple directories (backend/data/, backend/blocks/, backend/copilot/, backend/integrations/, backend/util/). Narrowing could miss schema changes and cause frontend type desynchronization.
Applied to files:
autogpt_platform/backend/schema.prisma
| credentialProvider String | ||
| credentialId String? | ||
| credentialType String? | ||
| currency String? | ||
|
|
||
| metadata Json @default("{}") | ||
|
|
||
| llmModelId String | ||
| Model LlmModel @relation(fields: [llmModelId], references: [id], onDelete: Cascade) | ||
|
|
||
| @@unique([llmModelId, credentialProvider, unit]) | ||
| @@index([credentialProvider]) |
There was a problem hiding this comment.
Let credential-specific pricing coexist with provider defaults.
Line 1395 ignores credentialId, so this table can only hold one (llmModelId, credentialProvider, unit) row. That blocks a very common case for this schema: a provider-wide default price plus an override for a specific credential.
Possible migration-friendly fix
model LlmModelCost {
...
- @@unique([llmModelId, credentialProvider, unit])
+ @@index([llmModelId, credentialProvider, unit])
@@index([credentialProvider])
}CREATE UNIQUE INDEX "LlmModelCost_default_cost_key"
ON "platform"."LlmModelCost" ("llmModelId", "credentialProvider", "unit")
WHERE "credentialId" IS NULL;
CREATE UNIQUE INDEX "LlmModelCost_credential_cost_key"
ON "platform"."LlmModelCost" ("llmModelId", "credentialProvider", "credentialId", "unit")
WHERE "credentialId" IS NOT NULL;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@autogpt_platform/backend/schema.prisma` around lines 1385 - 1396, The current
unique constraint on the LlmModelCost model (the @@unique([llmModelId,
credentialProvider, unit]) definition) prevents having both a provider-level
default and credential-specific overrides; remove that @@unique and instead add
two migration SQL unique indexes: one unique index on (llmModelId,
credentialProvider, unit) WHERE credentialId IS NULL (name it
LlmModelCost_default_cost_key) and a second unique index on (llmModelId,
credentialProvider, credentialId, unit) WHERE credentialId IS NOT NULL (name it
LlmModelCost_credential_cost_key); keep the existing
@@index([credentialProvider]) and apply the SQL in your migration so Prisma
schema (LlmModelCost fields: credentialProvider, credentialId, unit, llmModelId)
supports both default and credential-specific pricing.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
autogpt_platform/backend/migrations/20260310_add_llm_registry_schema/migration.sql (1)
45-46: Consider adding CHECK constraints for context/token limits.
contextWindowshould be positive (a model needs at least some context), andmaxOutputTokenswhen specified should also be positive. Negative values here would be invalid model metadata.💡 Optional: Add validation constraints
ALTER TABLE "LlmModel" - ADD CONSTRAINT "LlmModel_priceTier_check" CHECK ("priceTier" BETWEEN 1 AND 3); + ADD CONSTRAINT "LlmModel_priceTier_check" CHECK ("priceTier" BETWEEN 1 AND 3), + ADD CONSTRAINT "LlmModel_contextWindow_check" CHECK ("contextWindow" > 0), + ADD CONSTRAINT "LlmModel_maxOutputTokens_check" CHECK ("maxOutputTokens" IS NULL OR "maxOutputTokens" > 0);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@autogpt_platform/backend/migrations/20260310_add_llm_registry_schema/migration.sql` around lines 45 - 46, Add CHECK constraints to enforce positive values for the context and token limits: ensure "contextWindow" > 0 and ensure "maxOutputTokens" is either NULL or > 0; update the CREATE TABLE (or ALTER TABLE within this migration) that defines columns "contextWindow" and "maxOutputTokens" to include CHECK ("contextWindow" > 0) and CHECK ("maxOutputTokens" IS NULL OR "maxOutputTokens" > 0) so negative values cannot be inserted.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In
`@autogpt_platform/backend/migrations/20260310_add_llm_registry_schema/migration.sql`:
- Around line 45-46: Add CHECK constraints to enforce positive values for the
context and token limits: ensure "contextWindow" > 0 and ensure
"maxOutputTokens" is either NULL or > 0; update the CREATE TABLE (or ALTER TABLE
within this migration) that defines columns "contextWindow" and
"maxOutputTokens" to include CHECK ("contextWindow" > 0) and CHECK
("maxOutputTokens" IS NULL OR "maxOutputTokens" > 0) so negative values cannot
be inserted.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 059ef8c8-40da-4de4-b193-63b4725fed9c
📒 Files selected for processing (1)
autogpt_platform/backend/migrations/20260310_add_llm_registry_schema/migration.sql
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
- GitHub Check: types
- GitHub Check: test (3.12)
- GitHub Check: Analyze (typescript)
- GitHub Check: Analyze (python)
- GitHub Check: Check PR Status
- GitHub Check: test (3.11)
- GitHub Check: test (3.13)
- GitHub Check: Seer Code Review
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: Pwuts
Repo: Significant-Gravitas/AutoGPT PR: 12284
File: autogpt_platform/frontend/src/app/api/openapi.json:11897-11900
Timestamp: 2026-03-04T23:58:18.476Z
Learning: Repo: Significant-Gravitas/AutoGPT — PR `#12284`
Backend/frontend OpenAPI codegen convention: In backend/api/features/store/model.py, the StoreSubmission and StoreSubmissionAdminView models define submitted_at: datetime | None, changes_summary: str | None, and instructions: str | None with no default. This is intentional to produce “required but nullable” fields in OpenAPI (properties appear in required[] and use anyOf [type, null]). This matches Prisma’s submittedAt DateTime? and changesSummary String?. Do not flag this as a required/nullable mismatch.
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/backend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:20.508Z
Learning: Applies to autogpt_platform/backend/**/schema.prisma : Define key database models (User, AgentGraph, AgentGraphExecution, AgentNode, StoreListing) in `schema.prisma`
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12213
File: autogpt_platform/frontend/src/app/api/openapi.json:9983-9995
Timestamp: 2026-02-27T15:59:00.370Z
Learning: Repo: Significant-Gravitas/AutoGPT PR: 12213 — Backend/frontend OpenAPI codegen
Learning: For MCP schema models, required OpenAPI fields must have no defaults in Pydantic. Specifically, MCPToolInfo.input_schema must be required (no Field(default_factory=dict)) so openapi.json emits it in "required", ensuring generated TS types treat input_schema as non-optional.
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-04T16:49:42.490Z
Learning: Applies to autogpt_platform/backend/schema.prisma : Run database migrations with 'poetry run prisma migrate dev' and 'poetry run prisma generate' after schema changes in backend
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12213
File: autogpt_platform/frontend/src/app/api/openapi.json:9983-9995
Timestamp: 2026-02-27T15:59:00.370Z
Learning: Repo: Significant-Gravitas/AutoGPT PR: 12213 — OpenAPI/codegen
Learning: Ensuring a field is required in generated TS types needs two sides: (1) no default value on the Pydantic field, and (2) the OpenAPI model's "required" array must list it. For MCPToolInfo, making input_schema required in OpenAPI and removing Field(default_factory=dict) in the backend prevents optional typing drift.
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12356
File: autogpt_platform/backend/backend/copilot/constants.py:9-12
Timestamp: 2026-03-10T08:39:13.707Z
Learning: In Significant-Gravitas/AutoGPT PR `#12356`, the `COPILOT_SYNTHETIC_ID_PREFIX = "copilot-"` check in `create_auto_approval_record` (human_review.py) is intentional and safe. The `graph_exec_id` passed to this function comes from server-side `PendingHumanReview` DB records (not from user input); the API only accepts `node_exec_id` from users. Synthetic `copilot-*` IDs are only ever created server-side in `run_block.py`. The prefix skip avoids a DB lookup for a `AgentGraphExecution` record that legitimately does not exist for CoPilot sessions, while `user_id` scoping is enforced at the auth layer and on the resulting auto-approval record.
📚 Learning: 2026-02-04T16:50:20.508Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/backend/CLAUDE.md:0-0
Timestamp: 2026-02-04T16:50:20.508Z
Learning: Applies to autogpt_platform/backend/**/schema.prisma : Define key database models (User, AgentGraph, AgentGraphExecution, AgentNode, StoreListing) in `schema.prisma`
Applied to files:
autogpt_platform/backend/migrations/20260310_add_llm_registry_schema/migration.sql
📚 Learning: 2026-02-26T17:02:22.448Z
Learnt from: Pwuts
Repo: Significant-Gravitas/AutoGPT PR: 12211
File: .pre-commit-config.yaml:160-179
Timestamp: 2026-02-26T17:02:22.448Z
Learning: Keep the pre-commit hook pattern broad for autogpt_platform/backend to ensure OpenAPI schema changes are captured. Do not narrow to backend/api/ alone, since the generated schema depends on Pydantic models across multiple directories (backend/data/, backend/blocks/, backend/copilot/, backend/integrations/, backend/util/). Narrowing could miss schema changes and cause frontend type desynchronization.
Applied to files:
autogpt_platform/backend/migrations/20260310_add_llm_registry_schema/migration.sql
🔇 Additional comments (9)
autogpt_platform/backend/migrations/20260310_add_llm_registry_schema/migration.sql (9)
1-2: LGTM!The enum definition is clean and matches the Prisma schema.
5-18: LGTM!Clean table definition with appropriate columns for provider metadata and default credential configuration.
21-33: LGTM!Clean table definition separating creators from providers—good design for representing models like Llama (Meta) served by different providers.
61-75: LGTM!Cost table structure is sound, with the CHECK constraint for non-negative
creditCostproperly added later.
112-116: Well-designed partial unique indexes.The partial unique indexes elegantly handle the cost lookup pattern: one default cost per model/provider/unit combo (where
credentialId IS NULL), while allowing multiple credential-specific overrides. This is a clean solution for supporting both provider-level defaults and per-credential pricing.
127-128: LGTM!The partial unique index correctly prevents multiple active migrations per source model while allowing reverted migration records to accumulate for audit history.
130-137: LGTM!Foreign key semantics are appropriate:
RESTRICTon provider prevents orphaned modelsSET NULLon creator allows creator cleanup while preserving modelsCASCADEon model costs ensures cleanup when models are deleted
139-148: LGTM!CHECK constraints properly enforce domain rules:
priceTierin valid 1-3 range, and all cost/count fields non-negative. This addresses the data integrity concerns from the previous review.
82-83: No changes needed—this is intentional design.The lack of foreign keys on
sourceModelSlugandtargetModelSlugis intentional and already documented in the Prisma schema. These fields referenceLlmModel.slugby value to allow migration records to persist as an audit trail even if the original or target models are deleted. The purpose of each field is already documented in the schema comments.
There was a problem hiding this comment.
🛑 BLOCK
All six specialist reviewers (security, architecture, performance, testing, quality, product) were unable to retrieve any PR data for PR #12357. The PR metadata provided was entirely empty — no title, author, description, changed files, or diff — and all external data retrieval methods were blocked. A meaningful review is impossible without access to the actual code changes.
Risk level: high | Duration: 98s | Reviewed: 70a8f3ee
Specialist Reports
| Specialist | Status | Summary |
|---|---|---|
| security | ❌ FAIL | security review complete. |
| architect | ❌ FAIL | architect review complete. |
| performance | ❌ FAIL | performance review complete. |
| testing | ❌ FAIL | Unfortunately, I'm unable to retrieve the PR data — the gh CLI requires approval in this environment, and WebFetch permissions haven't been granted yet. Additionally, the PR metadata passed in (title, author, description, diff, and changed files) is entirely empty. Here is my assessment given those constraints: |
| quality | quality review complete. | |
| product | ❌ FAIL | product review complete. |
| discussion | ❌ FAIL | discussion review complete. |
Findings: 🔴 0 critical | 🟠 0 high | 🟡 37 medium | 🟢 0 low
Should Fix
- 🟡 Title: (not provided)
- 🟡 Author: (not provided)
- 🟡 Description: (not provided)
- 🟡 Changed files: (not available)
- 🟡 Diff: (empty)
- 🟡 GitHub CLI (
gh) — requires approval - 🟡 WebFetch — requires approval
- 🟡 WebSearch — requires approval
- 🟡 Pattern compliance or SOLID adherence
- 🟡 Coupling and cohesion changes
- 🟡 API contract / schema impacts
- 🟡 Technical debt introduced or resolved
- 🟡 Any architectural concerns
- 🟡 🔴 Critical Performance Issues (N+1 queries, unbounded loops, etc.)
- 🟡 🟠 Efficiency Concerns (algorithmic complexity, memory, caching)
- 🟡 💡 Optimization Opportunities
- 🟡 Complexity Analysis (time & space)
- 🟡 Scalability Assessment
- 🟡 Final Verdict:
APPROVE/NEEDS_OPTIMIZATION/BLOCK - 🟡 Title: (not provided)
- 🟡 Author: (not provided)
- 🟡 Description: (no description)
- 🟡 Changed files: (not available)
- 🟡 Diff: (empty)
- 🟡 🔤 Naming & readability
- 🟡 🏗️ Structure & function size
- 🟡 🧹 Code smells (dead code, magic values, duplication, deep nesting)
- 🟡 📝 Documentation & type hints
- 🟡 🎨 Style & convention compliance
- 🟡 ✅ Verdict: APPROVE / MINOR_FIXES / NEEDS_CLEANUP
- 🟡 The
ghCLI requires shell command approval in this environment - 🟡
WebFetchrequires permission approval - 🟡 ✅ CI/check status (passing, failing, skipped)
- 🟡 ✅ Comment & review thread summary
- 🟡 ✅ Addressed vs. unaddressed concerns table
- 🟡 ✅ Stale approval detection
- 🟡 ✅ Final recommendation (CONCERNS ADDRESSED / NEEDS FOLLOWUP / BLOCKED ON DISCUSSION)
There was a problem hiding this comment.
🛑 BLOCK
All six specialist reviewers were unable to retrieve any PR content for #12357. The PR metadata is completely empty — no title, no author, no description, no diff, and no changed files. A code review cannot be performed without accessible code changes.
Risk level: high | Duration: 94s | Reviewed: 2ccfb4e4
Specialist Reports
| Specialist | Status | Summary |
|---|---|---|
| security | ❌ FAIL | I was unable to retrieve the PR content automatically — the gh CLI commands and WebFetch both require explicit tool approval, and neither was granted. Here's what I need to proceed: |
| architect | ❌ FAIL | I'm unable to automatically retrieve the PR details — both the GitHub CLI and web fetch tools require additional permissions that haven't been granted in this session. To complete the architectural review, I need the actual PR content. You can provide it in any of the following ways: |
| performance | ❌ FAIL | performance review complete. |
| testing | ❌ FAIL | testing review complete. |
| quality | ❌ FAIL | I wasn't able to automatically retrieve the PR content due to tool permission restrictions in this environment. Here's what I need to perform the Code Quality Review: |
| product | product review complete. | |
| discussion | ❌ FAIL | Unfortunately, all external tool calls (Bash gh CLI, WebFetch, and WebSearch) are blocked pending user approval in this environment. No live data could be fetched for PR #12357. Additionally, the PR metadata passed in the prompt is empty — no title, author, description, diff, or changed files were provided. Here is the analysis based on what is available: |
Findings: 🔴 0 critical | 🟠 0 high | 🟡 31 medium | 🟢 0 low
Should Fix
- 🟡
gh pr view/gh pr diff→ requires Bash tool approval - 🟡
WebFetch(GitHub API / web UI) → requires WebFetch tool approval - 🟡 The PR metadata provided in your message contains an empty diff and no changed files
- 🟡 The PR title, description, and author
- 🟡 The Files changed tab content (diff)
- 🟡 SOLID / design pattern compliance
- 🟡 Coupling & cohesion analysis
- 🟡 Technical debt introduced or resolved
- 🟡 API contract / schema / service boundary impacts
- 🟡 Concrete file:line recommendations
- 🟡 Verdict: APPROVE / NEEDS_REFACTOR / BLOCK
- 🟡 🔴 N+1 queries, missing indexes, unbounded result sets
- 🟡 🟠 Algorithmic complexity and memory usage
- 🟡 💡 Caching, concurrency, and scalability opportunities
- 🟡 Complexity and scalability verdict
- 🟡 Coverage analysis of changed code
- 🟡 Test quality assessment (assertion strength, isolation, determinism)
- 🟡 AI-generated test pattern detection
- 🟡 Missing test case identification
- 🟡 A final APPROVE / NEEDS_MORE_TESTS / BLOCK verdict
- 🟡 The
ghCLI (gh pr view 12357 --repo Significant-Gravitas/AutoGPT) requires explicit approval to run. - 🟡
WebFetchfor the GitHub URL also requires permission to execute. - 🟡 The PR metadata passed in (title, author, description, diff) was all empty.
- 🟡 PR claims: (Unknown — no title or description provided)
- 🟡 Actual behavior: (Unknown — no diff or changed files available)
- 🟡 Match: ❓ Cannot Assess
- 🟡 None can be identified without PR content.
- 🟡 ❓ Keyboard accessible — cannot assess
- 🟡 ❓ Screen reader friendly — cannot assess
- 🟡 The PR payload provided to this review session is completely empty (no title, author, description, diff, or changed files). A meaningful product review cannot be performed without this data.
- 🟡 Cannot be assessed — no review timestamps or post-review commit activity available.
ed66e74 to
2ccfb4e
Compare
Add admin write API endpoints for LLM registry management:
- POST /api/llm/models - Create model
- PATCH /api/llm/models/{slug} - Update model
- DELETE /api/llm/models/{slug} - Delete model
- POST /api/llm/providers - Create provider
- PATCH /api/llm/providers/{name} - Update provider
- DELETE /api/llm/providers/{name} - Delete provider
All endpoints require admin authentication via requires_admin_user.
Request/response models defined in admin_model.py:
- CreateLlmModelRequest, UpdateLlmModelRequest
- CreateLlmProviderRequest, UpdateLlmProviderRequest
Implementation coming in follow-up commits (currently returns 501 Not Implemented).
This builds on:
- PR #12357: Schema foundation
- PR #12359: Registry core
- PR #12371: Public read API
Implement full CRUD operations for admin API: Database layer (db_write.py): - create_provider, update_provider, delete_provider - create_model, update_model, delete_model - refresh_runtime_caches - invalidates in-memory registry after mutations - Proper validation and error handling Admin routes (admin_routes.py): - All endpoints now functional (no more 501) - Proper error responses (400 for validation, 404 for not found, 500 for server errors) - Lookup by slug/name before operations - Cache refresh after all mutations Features: - Provider deletion blocked if models exist (FK constraint) - All mutations refresh registry cache automatically - Proper logging for audit trail - Admin auth enforced on all endpoints Based on original implementation from PR #11699 (upstream-llm branch). Builds on: - PR #12357: Schema foundation - PR #12359: Registry core - PR #12371: Public read API
|
This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request. |
|
Closing in favor of the LLM registry restack: the schema is now #13605 (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. |
Summary
Add Prisma schema, migration, and seed data for dynamic LLM model registry - Part 1 of 5 in incremental implementation.
This PR contains the database schema foundation and initial seed data - no business logic, routes, or UI. PRs #12359, #12371, #12467, and #12468 build on this schema to provide the full registry functionality.
Changes
Schema additions (5 models)
Seed data
Key features
Review Feedback Addressed
LlmModelMigration(sourceModelSlug, targetModelSlug → LlmModel.slug)@@index([credentialProvider])on LlmModelCost@@index([isReverted])on LlmModelMigrationcredentialProviderfield purposeMigrations
20260310_add_llm_registry_schema/migration.sql20260310_seed_llm_registry/migration.sqlplatformschema with@@mapdirectivesTesting
Stacked PRs