Skip to content

feat: bump supercode-cli version to 0.1.87 and enhance token budget management:#229

Merged
yashdev9274 merged 1 commit into
mainfrom
supercode-cli
Jul 24, 2026
Merged

feat: bump supercode-cli version to 0.1.87 and enhance token budget management:#229
yashdev9274 merged 1 commit into
mainfrom
supercode-cli

Conversation

@yashdev9274

@yashdev9274 yashdev9274 commented Jul 24, 2026

Copy link
Copy Markdown
Owner

Description

  • Updated version in package.json to 0.1.87.
  • Integrated daily token budget checks in AI chat and object generation endpoints.
  • Improved user feedback for daily token usage and limits in the usage command.
  • Added proxy usage tracking for better resource management and reporting.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactor (no functional changes)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes.

  • bun test passes
  • bun run typecheck passes
  • bun run lint passes (if applicable)

Checklist:

  • My code follows the project's style guidelines
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works

Summary by CodeRabbit

  • New Features

    • Added per-user daily token usage tracking across supported AI models.
    • Updated /usage to display daily usage, limits, remaining tokens, and reset time.
    • Added proxy usage tracking to daily totals.
    • Improved messaging when AI credit limits are reached.
  • Bug Fixes

    • Requests exceeding the daily token limit now return a clear rate-limit response.
    • BYOK requests are exempt from the standard daily budget when applicable.

…anagement:

- Updated version in package.json to 0.1.87.
- Integrated daily token budget checks in AI chat and object generation endpoints.
- Improved user feedback for daily token usage and limits in the usage command.
- Added proxy usage tracking for better resource management and reporting.
@vercel

vercel Bot commented Jul 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
supercli Ready Ready Preview, Comment Jul 24, 2026 5:48pm
supercli-client Ready Ready Preview, Comment Jul 24, 2026 5:48pm
supercli-docs Ready Ready Preview, Comment Jul 24, 2026 5:48pm

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Your trial has ended. Reactivate Greptile to resume code reviews.

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c5da199b-69bb-42bf-a82a-6de30e4ce19e

📥 Commits

Reviewing files that changed from the base of the PR and between 976b166 and afee560.

📒 Files selected for processing (7)
  • apps/supercode-cli/server/package.json
  • apps/supercode-cli/server/src/cli/ai/concentrate-service.ts
  • apps/supercode-cli/server/src/cli/ai/server-proxy-service.ts
  • apps/supercode-cli/server/src/cli/commands/slashCommands/index.ts
  • apps/supercode-cli/server/src/cli/commands/slashCommands/usage.ts
  • apps/supercode-cli/server/src/index.ts
  • apps/supercode-cli/server/src/lib/token-budget.ts

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.


Walkthrough

The server now enforces daily per-user token budgets, combines database and proxy usage, attributes provider usage to users, maps upstream credit limits, and displays authenticated daily totals through /usage. ConcentrateAI retains OPUS-specific checks while general budget enforcement moves to API endpoints.

Changes

Per-user token budget flow

Layer / File(s) Summary
Daily usage accounting and proxy persistence
apps/supercode-cli/server/src/lib/token-budget.ts
Daily usage combines database events with persisted proxy usage; helper functions expose totals, limits, reset times, and proxy event storage.
AI endpoint enforcement and usage attribution
apps/supercode-cli/server/src/index.ts
Chat and object-generation endpoints enforce user budgets, exempt qualifying BYOK requests, attach user IDs to provider usage records, and return HTTP 429 for daily limits.
Proxy attribution and upstream limit handling
apps/supercode-cli/server/src/cli/ai/server-proxy-service.ts
Proxy requests resolve session users, persist token usage, and translate upstream credit-limit responses into a warming-up error.
CLI daily usage reporting and ConcentrateAI enforcement
apps/supercode-cli/server/src/cli/commands/slashCommands/usage.ts, apps/supercode-cli/server/src/cli/commands/slashCommands/index.ts, apps/supercode-cli/server/src/cli/ai/concentrate-service.ts, apps/supercode-cli/server/package.json
/usage displays current authenticated daily totals, general ConcentrateAI budget checking is removed from sendMessage, OPUS checks remain, and the package version becomes 0.1.87.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant API
  participant TokenBudget
  participant Provider
  participant UsageStore
  Client->>API: Submit AI request
  API->>TokenBudget: Check user daily budget
  TokenBudget->>UsageStore: Read database and proxy usage
  UsageStore-->>TokenBudget: Return combined token total
  TokenBudget-->>API: Allow or reject request
  API->>Provider: Execute model request
  Provider-->>API: Return response and token usage
  API->>UsageStore: Record usage with userId
  API-->>Client: Return response or HTTP 429
Loading

Possibly related PRs

Poem

A bunny counts tokens, one, two, three,
Proxy crumbs join the usage spree.
Budgets guard each model call,
/usage paints the totals tall.
OPUS keeps its hop in line—
A tidy daily limit design!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch supercode-cli

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@yashdev9274
yashdev9274 merged commit af37f12 into main Jul 24, 2026
4 of 8 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