Skip to content

Codex/UI redesign#55

Merged
Abdulmuiz44 merged 2 commits into
mainfrom
codex/ui-redesign
Apr 6, 2026
Merged

Codex/UI redesign#55
Abdulmuiz44 merged 2 commits into
mainfrom
codex/ui-redesign

Conversation

@Abdulmuiz44
Copy link
Copy Markdown
Collaborator

No description provided.

…redit-check

Allow chats when free-plan credits remain by removing post-generation hard block
@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 6, 2026

Deploy Preview for tera-ai ready!

Name Link
🔨 Latest commit c85779b
🔍 Latest deploy log https://app.netlify.com/projects/tera-ai/deploys/69d2f86294da52000848f071
😎 Deploy Preview https://deploy-preview-55--tera-ai.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.

@Abdulmuiz44 Abdulmuiz44 merged commit c77f70d into main Apr 6, 2026
4 of 6 checks passed
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: c85779b506

ℹ️ 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 thread app/actions/generate.ts
Comment on lines 145 to 147
const tokenCost = Math.max(1, generationResult.usage.totalTokens || 0)

// Enforce token credit limit before returning content if request exceeded remaining balance
if (tokenCost > creditsRemaining) {
const cap = getPlanCreditCap(userProfile.subscriptionPlan)
const resetLabel = resetDate
? new Date(resetDate).toLocaleDateString('en-US', { month: 'short', day: 'numeric' })
: 'in 30 days'
const errorMessage = `You've reached your monthly credit cap (${cap}). Upgrade your plan now, or wait until your credits reset on ${resetLabel}.`
return {
answer: errorMessage,
sessionId: sessionId,
chatId: chatId,
error: errorMessage
}
}

const currentSessionId = sessionId || crypto.randomUUID()
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 Badge Block responses that exceed remaining credits

After this change, the only credit gate is creditsRemaining <= 0 before generation, so a user with a small positive balance can still receive a response whose tokenCost is much larger than their remaining monthly credits (e.g., 1 remaining credit, 400-token response). Because incrementUserCredits in lib/free-plan-credits.ts always records the full cost and does not reject overages, this effectively bypasses the monthly cap by one arbitrarily large request and can create unbounded spend versus the configured plan cap.

Useful? React with 👍 / 👎.

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