Skip to content

[Bug]:Title Users can use more credits than allotted #189

Description

@kstij1

Summary

Users are able to consume more credits than their allocated/available balance. The system allows overage beyond the allotted limit instead of preventing the action or failing fast.

Steps to reproduce

  1. Allocate a user a small number of credits (e.g., 20).
  2. Execute actions that consume credits until reaching the limit (e.g., chats, document processing, model runs).
  3. Continue executing actions beyond the limit.
  4. Observe that usage continues and the balance shows negative or exceeds the allocation.

Expected behavior

  • The system enforces a strict hard cap: when remaining credits ≤ 0, any further credit-consuming operation is rejected with a clear error and no credits are deducted.
  • UI controls should also block or warn, but server must be the source of truth and enforce limits.

Actual behavior

  • Operations continue beyond allocation; resulting values exceed the allowed balance.
  • In some cases, UI displays over-limit values (e.g., 27/20 used) without an error.

Environment

  • OS: macOS 13 (Ventura)
  • Browser: Chrome 128
  • App/Backend branch: main (latest)
  • Workspace with multiple members

Additional context

Likely causes:

  • Limit checks only on client, not on server.
  • Race conditions around concurrent requests; missing transactional check on remaining balance.
  • Usage write occurs before validation, or validation uses stale cached totals.
  • Background/queued jobs bypass the normal guard.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions