Lazy-init OpenAI in GPT-5 route + allow GitHub avatars#6
Lazy-init OpenAI in GPT-5 route + allow GitHub avatars#6thefiredev-cloud merged 2 commits intomainfrom
Conversation
…e external baseURL
✅ Deploy Preview for bucolic-cat-5fce49 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
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.
| // 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"]; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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".
| if (!isPennyCode) { | ||
| const metadataType = (couponDoc as any)?.metadata?.type || (couponDoc as any)?.metadata?.Type; | ||
| if (typeof metadataType === "string" && metadataType.toLowerCase() === "penny") { | ||
| isPennyCode = true; | ||
| } |
There was a problem hiding this comment.
[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 👍 / 👎.
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.
This PR implements two small production hardening fixes for sandboxmentoloop.online:
app/api/gpt5/route.tsand return 503 whenOPENAI_API_KEYis absent (aligns with documentation route behavior).avatars.githubusercontent.comtonext.config.tsimage domains fornext/imageoptimization used on the landing page.Sanity checks:
npm run type-checkandnpm run lintare clean.This should reduce fragility during builds and avoid image optimizer blocks. No environment variables or CSP changes included.