Skip to content

feat: update supercode-cli to version 0.1.85 and enhance request handling:#227

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

feat: update supercode-cli to version 0.1.85 and enhance request handling:#227
yashdev9274 merged 1 commit into
mainfrom
supercode-cli

Conversation

@yashdev9274

@yashdev9274 yashdev9274 commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Description

  • Bumped version in package.json to 0.1.85.
  • Introduced JSON body size limit for requests, configurable via environment variable.
  • Added error handling middleware to respond with appropriate messages for oversized requests.
  • Improved progress display messaging in AI response to provide clearer user updates.
  • Enhanced diff functionality to include line numbers and better context visualization for changes.

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 clearer, more compact progress updates in CLI chat.
    • Introduced improved collapsed and expanded thought displays, including tool summaries and subagent activity.
    • Enhanced code snapshots with line numbers, folding, syntax highlighting, and clearer change markers.
    • Added configurable request size limits for server requests.
  • Bug Fixes

    • Preserved streamed chat content when terminal output is interrupted or unavailable.
    • Improved cleanup after interrupted skill, tool, or streaming operations.
    • Centered chat footers more accurately in the terminal.

…ling:

- Bumped version in package.json to 0.1.85.
- Introduced JSON body size limit for requests, configurable via environment variable.
- Added error handling middleware to respond with appropriate messages for oversized requests.
- Improved progress display messaging in AI response to provide clearer user updates.
- Enhanced diff functionality to include line numbers and better context visualization for changes.
@vercel

vercel Bot commented Jul 23, 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 23, 2026 4:45pm
supercli-client Ready Ready Preview, Comment Jul 23, 2026 4:45pm
supercli-docs Ready Ready Preview, Comment Jul 23, 2026 4:45pm

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

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The CLI updates streamed response fallback handling, skill cleanup, thought-chain and tool-snapshot rendering, server JSON body limits, and the package version.

Changes

CLI chat and transcript rendering

Layer / File(s) Summary
Streaming fallback and skill cleanup
apps/supercode-cli/server/src/cli/utils/markdown-stream.ts, apps/supercode-cli/server/src/cli/ai/chat/chat.ts
MarkdownStream renders captured fallback responses, while chat turns persist tagged skill messages, clear skill state during failures, and adjust progress and footer output.
Codex transcript and snapshot rendering
apps/supercode-cli/server/src/cli/ai/chat/thinking.ts, apps/supercode-cli/server/src/cli/utils/tool-snapshot.ts
Thought chains use Codex-style collapsed output, and snapshots render numbered, folded, editor-style diffs.

JSON request body limits

Layer / File(s) Summary
Configurable JSON body limit
apps/supercode-cli/server/src/index.ts
Express JSON parsing uses SUPERCODE_JSON_BODY_LIMIT, defaulting to 10mb, and oversized requests return HTTP 413.

Package release metadata

Layer / File(s) Summary
Server package version
apps/supercode-cli/server/package.json
The package version changes from 0.1.84 to 0.1.85.

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

Sequence Diagram(s)

sequenceDiagram
  participant ChatLoop
  participant streamAIResponse
  participant MarkdownStream
  participant SkillContext
  ChatLoop->>streamAIResponse: stream chat response
  streamAIResponse->>MarkdownStream: setFallback(fullResponse)
  MarkdownStream-->>ChatLoop: render buffered or fallback content
  ChatLoop->>SkillContext: clearSkill()
Loading

Possibly related PRs

Poem

A rabbit watched the thoughts unfold,
With numbered lines and stories told.
Fallback words now safely stream,
Skills clear out from every dream.
“Hop!” says Bun, “the chat is bright!”

🚥 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 matches the main changes: a version bump plus request-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 63b2f93 into main Jul 23, 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: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/supercode-cli/server/src/cli/ai/chat/chat.ts (1)

2126-2151: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Persist assistant replies for skill/message slash turns.

The result.type === "message" branch streams aiResult but skips addMessage(conversation.id, "assistant", aiResult.content), so multi-turn /skill <message> conversations keep the user prompt in history but drop the assistant response. Add the same persistence as the main turn path, handling aborted separately if needed.

🤖 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/chat/chat.ts` around lines 2126 - 2151,
In the result.type === "message" branch, persist the streamed assistant reply by
adding aiResult.content through addMessage after streamAIResponse succeeds,
matching the main turn path. Handle aborted responses separately so incomplete
replies are not persisted, while preserving the existing output, footer
rendering, and clearSkill cleanup.
🤖 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/index.ts`:
- Line 68: Update the SUPERCODE_JSON_BODY_LIMIT configuration near
JSON_BODY_LIMIT to distinguish missing or empty values from malformed non-empty
values: default only when unset or empty, otherwise parse and validate the value
using the same bytes-compatible rules before constructing express.json. Fail
startup with a clear configuration error when validation fails, rather than
allowing middleware construction to throw.

---

Outside diff comments:
In `@apps/supercode-cli/server/src/cli/ai/chat/chat.ts`:
- Around line 2126-2151: In the result.type === "message" branch, persist the
streamed assistant reply by adding aiResult.content through addMessage after
streamAIResponse succeeds, matching the main turn path. Handle aborted responses
separately so incomplete replies are not persisted, while preserving the
existing output, footer rendering, and clearSkill cleanup.
🪄 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: d1fc7547-1d15-4529-b605-7da7e2f2e352

📥 Commits

Reviewing files that changed from the base of the PR and between c758528 and a6642cb.

📒 Files selected for processing (6)
  • apps/supercode-cli/server/package.json
  • apps/supercode-cli/server/src/cli/ai/chat/chat.ts
  • apps/supercode-cli/server/src/cli/ai/chat/thinking.ts
  • apps/supercode-cli/server/src/cli/utils/markdown-stream.ts
  • apps/supercode-cli/server/src/cli/utils/tool-snapshot.ts
  • apps/supercode-cli/server/src/index.ts

"minimax-m3",
"hy3",
])
const JSON_BODY_LIMIT = process.env.SUPERCODE_JSON_BODY_LIMIT || "10mb"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Locate target file"
fd -a 'index\.ts$' . | sed 's#^\./##' | rg 'apps/supercode-cli/server/src/index\.ts|index\.ts$' || true

echo
echo "Relevant sections"
sed -n '1,150p' apps/supercode-cli/server/src/index.ts

echo
echo "Find package versions/imports"
rg -n '"express"|body-parser|`@types/express`|json-body-limit|SUPERCODE_JSON_BODY_LIMIT' -S .

echo
echo "List package files"
git ls-files | rg '(^|/)package\.json$|bun\.lock|bun\.lockb$|pnpm-lock|yarn\.lock' || true

echo
echo "Show dependency snippets"
python3 - <<'PY'
from pathlib import Path
for p in [Path('package.json'), Path('apps/supercode-cli/server/package.json')]:
    if p.exists():
        import json
        print(f'--- {p} ---')
        data=json.loads(p.read_text())
        print(json.dumps({k:data.get(k) for k in ('dependencies','devDependencies') if k in data}, indent=2, sort_keys=True))
PY

Repository: yashdev9274/supercli

Length of output: 19086


🌐 Web query:

Express body-parser JSON limit option bytes lib source malformed limit value parse limit throw

💡 Result:

In the Express body-parser middleware, the limit option controls the maximum request body size [1][2]. If the provided limit is a number, it is interpreted directly as the number of bytes [1][3]. If the limit is a string, it is passed to the bytes library for parsing (e.g., '100kb', '1mb') [1][2][3]. If a malformed string is provided to the limit option, the bytes library will typically throw an error during the initialization of the middleware [1][2][3]. Because this initialization happens when the middleware is configured (usually at application startup), an invalid limit value will cause the application to crash or fail to start, rather than throwing an error during individual request processing [1][3]. Regarding other related errors: - If a request body exceeds the configured limit, the middleware will throw an error with the status code 413 ('entity.too.large') [1][2][4]. - If a request is considered malformed because the 'Content-Length' header does not match the actual received body size, the middleware throws an error with the status code 400 ('request.size.invalid') [1][2][5]. - Errors encountered during JSON parsing (e.g., invalid JSON syntax) also typically result in a 400 'Bad Request' status code [6].

Citations:


🌐 Web query:

Express 5.2 json middleware raw-body limit option malformed limit source

💡 Result:

In Express 5 (including version 5.2), the express.json middleware—which internally uses the raw-body package—handles request body size constraints through the limit option [1][2][3]. When encountering issues related to limits or malformed requests, Express distinguishes between two primary error types based on the raw-body library's behavior [4][5]: 1. entity.too.large (Status 413): This occurs when the request body size exceeds the configured limit option [6][4]. The error object includes properties such as limit (the byte limit) and length (the actual size of the request body) [6][5]. 2. request.size.invalid (Status 400): This occurs when the actual size of the request stream does not match the value provided in the Content-Length header [6][4]. This is typically indicative of a malformed request, often caused when the Content-Length header was calculated based on character count rather than byte count [6][4]. To handle these errors effectively, it is recommended to implement a custom error-handling middleware with four parameters (err, req, res, next) [2]. This allows you to differentiate the error type using the err.type property and respond with appropriate status codes (413 for size limits or 400 for malformed/mismatched lengths) instead of exposing default stack traces [2]. The limit option itself defaults to '100kb' if not specified and accepts either a number (bytes) or a string compatible with the bytes library [6][3].

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
from pathlib import Path
p = Path("apps/supercode-cli/server/node_modules/express")
if not p.exists():
    print("node_modules/express not present")
else:
    files = list(p.glob("**/*.js"))
    for f in files:
        text = f.read_text(errors="ignore")
        if "rawBody" in text and ('limit' in text):
            print(f"--- {f.relative_to(Path.cwd())} ---")
            for i, line in enumerate(text.splitlines(), 1):
                if "rawBody" in line or "limit" in line or "body" in line.lower():
                    if 90 <= i <= 170 or "rawBody" in line or "limit" in line:
                        print(f"{i}: {line}")
PY

node - <<'JS'
try {
  const bytesLib = require('bytes');
  for (const value of ['notalimit', 'abc123mb', '100', 1024]) {
    try {
      console.log(`${JSON.stringify(value)} -> ${JSON.stringify(bytesLib(value))}`);
    } catch (err) {
      console.error(`${JSON.stringify(value)} -> ${err.name}: ${err.message}`);
    }
  }
} catch (err) {
  console.log(`bytes module unavailable: ${err.name}: ${err.message}`);
}

try {
  const express = require('express');
  const app = express.default();
  for (const value of ['abc', '10mb', 1024]) {
    let ok = true;
    try { app.use(express.json({ limit: value })); }
    catch (err) { ok = false; console.error(`express.json limit ${JSON.stringify(value)} INIT ERROR ${err.name}: ${err.message}`); }
    if (ok) console.log(`express.json limit ${JSON.stringify(value)} initialized successfully`);
  }
} catch (err) {
  console.log(`express module unavailable: ${err.name}: ${err.message}`);
}
JS

Repository: yashdev9274/supercli

Length of output: 403


🌐 Web query:

raw-body JavaScript limit option string parse limit undefined throws Error bytes

💡 Result:

The raw-body package in JavaScript uses the limit option to define the maximum size of a request body in bytes [1][2]. When this limit is exceeded, raw-body explicitly throws an error with a 413 (Payload Too Large) status code and the error type 'entity.too.large' [3][2][4]. Regarding the behavior when the limit is undefined, raw-body does not typically throw a 413 error unless a limit is configured. However, if you are experiencing an error involving string parsing and limits (such as 'ERR_STRING_TOO_LONG'), this is often a separate limitation of the V8 JavaScript engine [5]. V8 imposes a hard limit on the maximum length of a string (typically around 512 MB, depending on the version and environment), which is independent of the raw-body package [5]. If the data being processed exceeds this V8 limit, the environment will throw an error regardless of whether a limit option was set in raw-body [5]. In summary: 1. If the error is a 413 'entity.too.large', it is caused by the raw-body limit option being configured and exceeded [3][6]. 2. If the error is related to string size (e.g., 'ERR_STRING_TOO_LONG'), it is likely a V8 engine memory limitation, not a raw-body specific configuration error [5].

Citations:


🌐 Web query:

bytes JavaScript parse "abc" throws Error invalid unit

💡 Result:

The error message "invalid unit" or similar validation failures when parsing byte strings in JavaScript typically occurs when using popular utility libraries like bytes or related packages designed to convert human-readable strings (e.g., "1KB") into numeric byte values [1][2][3][4]. When you pass a string like "abc" to these functions, it fails because the libraries expect a numeric component followed by a recognized unit [2][3][4]. 1. Why it throws an error: These libraries generally use regular expressions to parse the input string. They expect a specific format: a number (e.g., "1", "1.5") followed by a valid unit (e.g., "KB", "MB", "GB", "KiB") [3][4]. When the input is "abc", there is no numeric component, or the "unit" part cannot be parsed as a known scale, triggering an error or returning null/undefined [2][3][4]. 2. Typical Library Behavior: - Some libraries, such as @jsxx/bytes, are designed to throw an explicit Error when the input string format is invalid, citing issues like "Invalid byte string" or "Invalid format" [1][2]. - Other libraries, like format-byte-size, are designed to be safer by returning null or undefined instead of throwing an error when provided with unparseable inputs like "abc" [3][4]. 3. Troubleshooting: If your code is throwing an error: - Ensure the input is a valid string containing both a number and a unit (e.g., "100MB") [2][3]. - Wrap the call in a try...catch block if the library is known to throw errors [2]. - Verify which specific "bytes" library you are using, as behaviors regarding error handling (throwing vs. returning null) vary between implementations [1][3][4]. If you are using a library named exactly bytes (e.g., npm install bytes), it is commonly used to parse strings like "1kb" or "10mb". If you pass "abc" to a strict parser, it will fail because it cannot identify the multiplier associated with the unit [2]. Always check your package.json to identify the specific library documentation for your project [3][4].

Citations:


Validate SUPERCODE_JSON_BODY_LIMIT before constructing the JSON parser.

express.json({ limit }) accepts byte counts or bytes-compatible strings like 10mb; any non-empty malformed value such as abc will fail while configuring the middleware. Fall back to 10mb only for missing/empty values, otherwise parse and validate the configured limit at startup with a clear config error.

🧰 Tools
🪛 ast-grep (0.44.1)

[warning] 68-68: Express application should use Helmet
Context: express()
Note: [CWE-693] Protection Mechanism Failure (Express app without Helmet security headers).

(missing-helmet-typescript)

🤖 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/index.ts` at line 68, Update the
SUPERCODE_JSON_BODY_LIMIT configuration near JSON_BODY_LIMIT to distinguish
missing or empty values from malformed non-empty values: default only when unset
or empty, otherwise parse and validate the value using the same bytes-compatible
rules before constructing express.json. Fail startup with a clear configuration
error when validation fails, rather than allowing middleware construction to
throw.

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