Skip to content

fix(deco-ai-gateway): reconcile billing mode for postpaid limit updates#269

Merged
JonasJesus42 merged 2 commits intomainfrom
fix/ai-gateway-postpaid-limit-sync
Mar 2, 2026
Merged

fix(deco-ai-gateway): reconcile billing mode for postpaid limit updates#269
JonasJesus42 merged 2 commits intomainfrom
fix/ai-gateway-postpaid-limit-sync

Conversation

@JonasJesus42
Copy link
Contributor

@JonasJesus42 JonasJesus42 commented Mar 2, 2026

Persist limit period semantics and allow postpaid limit updates to honor explicit billing mode so legacy prepaid rows do not block limit reductions.

Made-with: Cursor


Summary by cubic

Persisted limit reset periods and honored explicit billing mode for postpaid limit updates. Fixes legacy prepaid rows blocking limit reductions, aligns tools around limit_period, and avoids null % in usage when a limit is zero.

  • Bug Fixes

    • Postpaid limit updates now respect explicit billing_mode and limit_period and allow lowering limits.
    • Replaced is_subscription checks with limit_period; kept is_subscription in sync for backwards compatibility. Avoided null percent display when limit ≤ 0.
  • New Features

    • Added limit_period (daily/weekly/monthly) to the DB with auto-migration from is_subscription=true → monthly.
    • Set Limit tool supports limit_period (including "none") and optional billing_mode override; persists updates.
    • Credits and Usage tools now expose limitPeriod and percentUsed with clearer postpaid summaries.

Written for commit 46d6f75. Summary will update on new commits.

Persist limit period semantics and allow postpaid limit updates to honor explicit billing mode so legacy prepaid rows do not block limit reductions.

Made-with: Cursor
@github-actions
Copy link

github-actions bot commented Mar 2, 2026

🚀 Preview Deployments Ready!

Your changes have been deployed to preview environments:

📦 deco-ai-gateway

🔗 View Preview

These previews will be automatically updated with new commits to this PR.


Deployed from commit: d7962b8

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 10 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="deco-ai-gateway/server/tools/usage.ts">

<violation number="1" location="deco-ai-gateway/server/tools/usage.ts:137">
P2: Handle non-positive limits so the summary doesn’t print `null% used` when `d.limit` is 0.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Prevent usage summaries from rendering null percentage values when a postpaid limit is zero or non-positive.

Made-with: Cursor
@JonasJesus42 JonasJesus42 merged commit 49c0989 into main Mar 2, 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