Skip to content

Conversation

@jurgenwerk
Copy link
Contributor

@jurgenwerk jurgenwerk commented Jan 29, 2026

Prevents older cycle leftovers from being spent against the current cycle and going negative.

This fix came as a result of observing Luke's monthly balance going below zero - it looks like the previous subscription period's monthly credits for some reason did not get expired (we do expire unused monthly credits at the beginning of a new subscription cycle), which caused our credit spending logic to think there are more monthly credits available than there actually are. If we scope the query to the current subscription period, the issue is solved.

The actual reason for the unexpired monthly credits is unclear to me. Given that Luke's account balance recovered OK with the newest monthly cycle, my hypothesis is that something went wrong with processing of the stripe's monthly subscription webhook, maybe there was an outage or something similar (having retryable event processing jobs would be helpful). Another option is that manual ledger entries had something to do with it. I suggest for now it's not worth exploring this deeper since other accounts are working OK.

Copy link

@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: 9d9c36d8ce

ℹ️ 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".

@github-actions
Copy link

github-actions bot commented Jan 29, 2026

Host Test Results

    1 files  ±0      1 suites  ±0   1h 45m 46s ⏱️ + 3m 48s
1 925 tests ±0  1 908 ✅ ±0  17 💤 ±0  0 ❌ ±0 
1 940 runs  ±0  1 923 ✅ ±0  17 💤 ±0  0 ❌ ±0 

Results for commit 43b0989. ± Comparison against base commit eed5e23.

♻️ This comment has been updated with latest results.

@jurgenwerk jurgenwerk force-pushed the cs-10022-negative-monthly-credit-balance-should-not-be-possible branch from 9d9c36d to 43b0989 Compare January 29, 2026 12:29
@jurgenwerk jurgenwerk requested a review from a team January 29, 2026 13:19
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.

2 participants