Skip to content

Lazy-init OpenAI in GPT-5 route + allow GitHub avatars#6

Merged
thefiredev-cloud merged 2 commits intomainfrom
chore/lazy-openai-gpt5-and-image-domain
Sep 20, 2025
Merged

Lazy-init OpenAI in GPT-5 route + allow GitHub avatars#6
thefiredev-cloud merged 2 commits intomainfrom
chore/lazy-openai-gpt5-and-image-domain

Conversation

@thefiredev-cloud
Copy link
Copy Markdown
Owner

This PR implements two small production hardening fixes for sandboxmentoloop.online:

  • perf: Lazy-initialize the OpenAI client in app/api/gpt5/route.ts and return 503 when OPENAI_API_KEY is absent (aligns with documentation route behavior).
  • fix: Add avatars.githubusercontent.com to next.config.ts image domains for next/image optimization used on the landing page.

Sanity checks:

This should reduce fragility during builds and avoid image optimizer blocks. No environment variables or CSP changes included.

@netlify
Copy link
Copy Markdown

netlify Bot commented Sep 20, 2025

Deploy Preview for bucolic-cat-5fce49 ready!

Name Link
🔨 Latest commit ea599d6
🔍 Latest deploy log https://app.netlify.com/projects/bucolic-cat-5fce49/deploys/68cdf707eb21400008a4727e
😎 Deploy Preview https://deploy-preview-6--bucolic-cat-5fce49.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

This PR is being reviewed by Cursor Bugbot

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

Comment thread convex/payments.ts
// Special discount code to force one-cent price (for testing/promotions)
const pennyEnv = process.env.STRIPE_PRICE_ID_ONECENT || process.env.STRIPE_PRICE_ID_PENNY;
const pennyCodes = ["ONECENT","PENNY","PENNY1","ONE_CENT"]; // MENTO12345 removed; now handled as 99.9% discount
const pennyCodes = ["ONECENT","PENNY","PENNY1","ONE_CENT","MENTO12345"];
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: Code Re-addition Overrides Documented Discount Behavior

Re-adding MENTO12345 to pennyCodes contradicts the previous explicit decision to handle it as a 99.9% discount. This change causes MENTO12345 to apply a fixed $0.01 price instead of its intended percentage discount, overriding documented behavior and potentially leading to incorrect pricing.

Fix in Cursor Fix in Web

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 suggestions.

Reply with @codex fix comments to fix any unresolved comments.

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, or 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 fix this CI failure" or "@codex address that feedback".

Comment thread convex/payments.ts
Comment on lines +519 to +523
if (!isPennyCode) {
const metadataType = (couponDoc as any)?.metadata?.type || (couponDoc as any)?.metadata?.Type;
if (typeof metadataType === "string" && metadataType.toLowerCase() === "penny") {
isPennyCode = true;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[P1] Override price when coupon metadata marks code as penny

The new metadata check sets isPennyCode to true when a Stripe coupon’s metadata type equals penny, but it does not apply the one‑cent price override that happens for codes listed in pennyCodes. As a result, any coupon whose code isn’t in pennyCodes but is marked type=penny in Stripe will skip discount application yet still use the original stripePriceId, charging the full plan price instead of $0.01. Either add those coupons to pennyCodes before the earlier override or trigger the same price substitution when the metadata path sets isPennyCode.

Useful? React with 👍 / 👎.

@thefiredev-cloud thefiredev-cloud merged commit 1f0cbcf into main Sep 20, 2025
10 of 14 checks passed
thefiredev-cloud added a commit that referenced this pull request Dec 13, 2025
Squash-merge PR #6 to main. Changes: lazy-init OpenAI client in /api/gpt5 returning 503 when absent; add avatars.githubusercontent.com to next/image domains. Type-check/lint clean. Deploy preview is green; monitoring production deploy next.
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