Skip to content

feat: bump supercode-cli version to 0.1.89 and improve error handling for usage limits:#231

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

feat: bump supercode-cli version to 0.1.89 and improve error handling for usage limits:#231
yashdev9274 merged 1 commit into
mainfrom
supercode-cli

Conversation

@yashdev9274

@yashdev9274 yashdev9274 commented Jul 25, 2026

Copy link
Copy Markdown
Owner

Description

  • Updated version in package.json to 0.1.89.
  • Enhanced error responses in server-proxy-service.ts to provide clearer feedback when usage limits are reached, returning structured messages instead of generic errors.

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

  • Bug Fixes
    • Improved handling when AI usage limits or credits are exhausted.
    • Displays a clear message instead of incorrectly reporting that Cloud AI is warming up.
    • Prevents failed requests from triggering unnecessary errors or tool calls.

… for usage limits:

- Updated version in package.json to 0.1.89.
- Enhanced error responses in server-proxy-service.ts to provide clearer feedback when usage limits are reached, returning structured messages instead of generic errors.
@vercel

vercel Bot commented Jul 25, 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 25, 2026 8:53am
supercli-client Ready Ready Preview, Comment Jul 25, 2026 8:53am
supercli-docs Ready Ready Preview, Comment Jul 25, 2026 8:53am

@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 25, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

Credit-limit failures in ServerProxyService now return structured stop or object responses with a user-facing message instead of a warming-up error. The server package version is incremented from 0.1.88 to 0.1.89.

Changes

Credit-limit response handling

Layer / File(s) Summary
Synthetic credit-limit responses
apps/supercode-cli/server/src/cli/ai/server-proxy-service.ts
request() returns a stop response with zero usage and no tool calls, while generateObject() returns a message object for insufficient-credit or exhausted-limit errors.
Server package version update
apps/supercode-cli/server/package.json
The package version is incremented from 0.1.88 to 0.1.89.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Poem

A bunny sees credits run thin,
Yet structured replies now begin.
“Stop,” says the model, calm and clear,
With empty tools and zero gear.
The version hops to eighty-nine—
A tidy change in carrot time!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the version bump and the usage-limit error handling improvements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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 03faf51 into main Jul 25, 2026
4 of 8 checks passed

@coderabbitai coderabbitai 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.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/supercode-cli/server/src/cli/ai/server-proxy-service.ts`:
- Around line 119-125: The usage accumulator in sendMessage() is reset to zero
when constructing the credit-limit response, discarding tokens from earlier
tool-call rounds. Preserve the existing accumulated usage values instead of
replacing them with a zeroed object, while retaining zero defaults only when no
prior usage exists so appendProxyUsage() records the full total.
- Around line 522-524: The credit-limit branch in the generator service returns
an object that does not conform to the generateObject schema. Update this branch
to use the contract’s established typed error/envelope or documented sentinel
shape, including any required discriminator, so callers can parse and surface
the limit response without schema validation failure.
- Around line 116-127: The credit-limit branch must emit its synthetic response
through onChunk because getMessage() derives its result exclusively from that
callback. Update the branch containing the “You've used your limits” response to
pass the response content to onChunk before returning, while preserving the
existing response object and metadata.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8fa53ca9-e7b6-4d9a-96ed-878a881e53d1

📥 Commits

Reviewing files that changed from the base of the PR and between 6aa3c64 and 64cf008.

📒 Files selected for processing (2)
  • apps/supercode-cli/server/package.json
  • apps/supercode-cli/server/src/cli/ai/server-proxy-service.ts

Comment on lines +116 to +127
return {
content: "You've used your limits. Resets in 24hrs.",
finishReason: "stop" as FinishReason,
usage: {
inputTokens: 0,
inputTokenDetails: { noCacheTokens: 0, cacheReadTokens: 0, cacheWriteTokens: 0 },
outputTokens: 0,
outputTokenDetails: { textTokens: 0, reasoningTokens: 0 },
totalTokens: 0,
},
toolCalls: [],
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Emit the synthetic response through onChunk.

getMessage() ignores the value returned by sendMessage() and builds its result exclusively from onChunk. Since this branch only returns content, credit-limit responses make getMessage() return an empty string.

Proposed fix
+        const message = "You've used your limits. Resets in 24hrs."
+        onChunk?.(message)
         return {
-          content: "You've used your limits. Resets in 24hrs.",
+          content: message,
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
return {
content: "You've used your limits. Resets in 24hrs.",
finishReason: "stop" as FinishReason,
usage: {
inputTokens: 0,
inputTokenDetails: { noCacheTokens: 0, cacheReadTokens: 0, cacheWriteTokens: 0 },
outputTokens: 0,
outputTokenDetails: { textTokens: 0, reasoningTokens: 0 },
totalTokens: 0,
},
toolCalls: [],
}
const message = "You've used your limits. Resets in 24hrs."
onChunk?.(message)
return {
content: message,
finishReason: "stop" as FinishReason,
usage: {
inputTokens: 0,
inputTokenDetails: { noCacheTokens: 0, cacheReadTokens: 0, cacheWriteTokens: 0 },
outputTokens: 0,
outputTokenDetails: { textTokens: 0, reasoningTokens: 0 },
totalTokens: 0,
},
toolCalls: [],
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/supercode-cli/server/src/cli/ai/server-proxy-service.ts` around lines
116 - 127, The credit-limit branch must emit its synthetic response through
onChunk because getMessage() derives its result exclusively from that callback.
Update the branch containing the “You've used your limits” response to pass the
response content to onChunk before returning, while preserving the existing
response object and metadata.

Comment on lines +119 to +125
usage: {
inputTokens: 0,
inputTokenDetails: { noCacheTokens: 0, cacheReadTokens: 0, cacheWriteTokens: 0 },
outputTokens: 0,
outputTokenDetails: { textTokens: 0, reasoningTokens: 0 },
totalTokens: 0,
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Preserve usage from earlier tool-call rounds.

sendMessage() replaces its usage accumulator with this zeroed object. If the credit-limit response follows successful tool calls, the final totalTokens becomes 0, causing appendProxyUsage() to skip recording the earlier usage.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/supercode-cli/server/src/cli/ai/server-proxy-service.ts` around lines
119 - 125, The usage accumulator in sendMessage() is reset to zero when
constructing the credit-limit response, discarding tokens from earlier tool-call
rounds. Preserve the existing accumulated usage values instead of replacing them
with a zeroed object, while retaining zero defaults only when no prior usage
exists so appendProxyUsage() records the full total.

Comment on lines +522 to +524
return {
object: { message: "You've used your limits. Resets in 24hrs." },
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
rg -n -C4 '\bgenerateObject\s*\(' apps/supercode-cli/server

Repository: yashdev9274/supercli

Length of output: 5365


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== file outline =="
ast-grep outline apps/supercode-cli/server/src/cli/ai/server-proxy-service.ts --view compact || true

echo "== relevant implementation =="
sed -n '460,535p' apps/supercode-cli/server/src/cli/ai/server-proxy-service.ts

echo "== calls to generateObject or use of returned object =="
rg -n -C3 'generateObject|\.object|serverProxy|ServerProxyService|new .*Service' apps/supercode-cli/server/src || true

echo "== package dependencies mentioning schema/generation =="
fd -a 'package.json' apps/supercode-cli/server | xargs -r cat | rg -n '"(ai|`@ai-sdk`|generateObject|zod)"|(`@types`)?zod' || true

Repository: yashdev9274/supercli

Length of output: 35438


🌐 Web query:

vercel ai SDK generateObject return object shape schema zod

💡 Result:

The Vercel AI SDK's generateObject function generates a typed, structured object by enforcing a schema defined using Zod [1][2]. When calling generateObject, you pass your Zod schema to the schema parameter [1][3]. The function returns a result object containing the property object, which is a typed object that conforms to the shape defined by your Zod schema [1][4]. Key details include: - Schema Usage: You provide a Zod object (e.g., z.object({...})) to the schema property. The AI SDK uses this to validate the generated data at runtime, ensuring type safety [1][3]. - Output Strategies: While the default output is a single object, you can change the output strategy to 'array' if you want the model to return an array of items matching your schema [1][2]. - Integration: The returned object is automatically typed based on the Zod schema provided, allowing for full TypeScript support in your application [1][3]. - Convenience Methods: The result also includes helper methods like toJsonResponse(), which converts the generated object into a JSON response suitable for web frameworks [1][4]. Example Usage: import { generateObject } from 'ai'; import { z } from 'zod'; const { object } = await generateObject({ model: yourModel, schema: z.object({ name: z.string, age: z.number, }), prompt: 'Generate a person profile.', }); // 'object' is typed as { name: string; age: number; } console.log(object.name);

Citations:


Handle the credit-limit sentinel in the generator contract.

generateObject() is meant to return result.objects conforming to the input schema, but this branch returns { object: { message } } with no discriminator. Since ai validates structured generation against the schema, callers can fail to parse a credit-limit response that should be surfaced as a typed error/envelope or a documented sentinel shape.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/supercode-cli/server/src/cli/ai/server-proxy-service.ts` around lines
522 - 524, The credit-limit branch in the generator service returns an object
that does not conform to the generateObject schema. Update this branch to use
the contract’s established typed error/envelope or documented sentinel shape,
including any required discriminator, so callers can parse and surface the limit
response without schema validation failure.

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