Skip to content

Add generation quality checks before export#35

Merged
Abdulmuiz44 merged 1 commit into
mainfrom
codex/generation-quality-control-loop
May 14, 2026
Merged

Add generation quality checks before export#35
Abdulmuiz44 merged 1 commit into
mainfrom
codex/generation-quality-control-loop

Conversation

@Abdulmuiz44
Copy link
Copy Markdown
Collaborator

Summary

  • add render quality engine for copy-fit, contrast, callout limits, and screenshot presence
  • block generation completion when critical quality checks fail and surface actionable reasons
  • persist quality report metadata per asset and update generate panel copy for quality-failure guidance

Verification

  • npm run typecheck
  • npm run build

@netlify
Copy link
Copy Markdown

netlify Bot commented May 14, 2026

Deploy Preview for launchpix ready!

Name Link
🔨 Latest commit d2e7ea0
🔍 Latest deploy log https://app.netlify.com/projects/launchpix/deploys/6a0604760233b300074d614d
😎 Deploy Preview https://deploy-preview-35--launchpix.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d2e7ea0d49

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +120 to +125
if (!qualityReport.pass) {
qualityFailures.push({
assetType: asset.asset_type,
issues: qualityReport.issues.filter((issue) => issue.severity === "error").map((issue) => issue.message)
});
continue;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preflight quality before rendering assets

In runs where a later asset fails a quality check after earlier assets have passed, this continue lets the loop upload and insert the earlier assets, then line 198 marks the generation failed. Because the latest generation's assets are loaded directly in app/dashboard/projects/[id]/assets/page.tsx and AssetsManager presents them as a generated pack, users can see/download an incomplete failed pack with no ZIP. Validate all deterministicAssets before any rendering/upload, or roll back/delete partial assets when aborting.

Useful? React with 👍 / 👎.

Comment thread lib/render/quality.ts
if (callouts.some((callout) => callout.length > 48)) issues.push({ code: "callout_line_overflow", severity: "error", message: "One or more callouts exceed 48 characters and may overflow." });

if (!cta) issues.push({ code: "cta_missing", severity: "error", message: "CTA text is missing. Add an action-oriented label." });
if (cta.length > 28) issues.push({ code: "cta_overflow", severity: "error", message: `CTA is too long (${cta.length}/28). Keep it concise.` });
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Align CTA quality limit with generated plan schema

When Mistral returns a valid cta_line between 29 and 40 characters, this new check marks every asset as failed because the same CTA is checked for each frame, even though generationPlanSchema still allows CTAs up to 40 characters and the prompt does not state the 28-character cap. Since that text is generated internally before the user can edit it, normal valid plans can now abort with an unactionable quality error; clamp/regenerate the CTA or make the schema/prompt enforce the same limit before quality runs.

Useful? React with 👍 / 👎.

Comment thread lib/render/quality.ts
Comment on lines +71 to +74
if (headline.length > 65) issues.push({ code: "headline_overflow", severity: "error", message: `Headline is too long (${headline.length}/65). Shorten it to avoid text clipping.` });

if (!subheadline) issues.push({ code: "subheadline_missing", severity: "error", message: "Subheadline is missing. Add supporting context for the headline." });
if (subheadline.length > 95) issues.push({ code: "subheadline_overflow", severity: "error", message: `Subheadline is too long (${subheadline.length}/95). Reduce sentence length.` });
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Align copy caps with the fallback plan

When AI planning falls back to createDeterministicGenerationPlan (for example with MISTRAL_API_KEY unset or a planning error), the fallback deliberately emits headlines up to 80 characters and subheadlines up to 120 characters, matching generationPlanSchema; projects with longer names/descriptions therefore pass planning and then fail these new caps before any asset can export. Either clamp the fallback/prompt/schema to 65/95 or allow the same limits here so a valid fallback plan does not abort generation.

Useful? React with 👍 / 👎.

@Abdulmuiz44 Abdulmuiz44 merged commit 004b1a4 into main May 14, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant