fix: production AI plan schema, SSO error handling, and Accelerate URL check - #31
Merged
Merged
Conversation
- Design agent: the plan prompt tells the model to list only components to add, but the plan schema required at least one component, so "add to the existing canvas" turns failed with "response did not match schema" on both attempts. The model now fills a lenient draft schema; sanitizePlanDraft repairs or drops empty fields and aborts with a user-facing message when nothing is left to add. - withSchemaRetry logs finish reason, validation cause, and the start of the response for both attempts. - Sign-in/sign-up: errors from signIn.sso / signUp.sso are logged and shown on the card instead of being ignored. - lib/prisma.ts: fix the Accelerate URL prefix check (prisma+postgres://). - Progress tracker: record the production migration incident and these fixes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 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 |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes found while debugging production (project creation, AI chat, and spec generation failing on
designdraftly.vercel.app).Design agent: "No object generated: response did not match schema"
The plan prompt tells the model that when the canvas already has components it should list only the components to add, but
designPlanSchemarequired at least one component (and non-empty strings). A request that added nothing new returnedcomponents: [], failed validation, failed the single retry the same way, and the turn ended with a generic error.designPlanDraftSchema(same fields, no non-empty rules — the same approach already used for list limits).sanitizePlanDraftdrops unnamed components and incomplete decisions and fills a missing role, responsibility, or summary. The storeddesignPlanSchemais unchanged, so existing sessions keep parsing.PLAN_NOTHING_TO_ADD_MESSAGE, which the session route shows to the user as is.withSchemaRetrylogs finish reason, validation cause, and the start of the response on both attempts, so the next mismatch is diagnosable from logs.Auth
signIn.sso/signUp.ssoresults were ignored, so a failed GitHub/Google redirect did nothing with no console output or message. Errors are now logged and shown on the card.Prisma
lib/prisma.tschecked forprism+postgres://; Accelerate URLs start withprisma+postgres://. Production uses a plainpostgres://URL, so this was latent.Already done outside this PR
The production database was missing the
add_ai_sessionsandadd_project_specmigrations (PrismaP2022: Project.specMdPath does not exist). They were applied manually withprisma migrate deploy. Nothing runs migrations on deploy yet — follow-up.Test plan
pnpm typechecksanitizePlanDraft: empty draft →null; partial draft → repaired and valid againstdesignPlanSchemamain): an "add components" AI turn on an existing canvas in production🤖 Generated with Claude Code