Skip to content

Supercode cli - #297

Merged
yashdev9274 merged 4 commits into
mainfrom
supercode-cli
Sep 7, 2026
Merged

Supercode cli#297
yashdev9274 merged 4 commits into
mainfrom
supercode-cli

Conversation

@yashdev9274

Copy link
Copy Markdown
Owner

Description

Please include a summary of the change and which issue is fixed.

Fixes #(issue)

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

… AI streaming

- Introduced a new function to send status heartbeats during upstream processing, preventing client timeouts.
- Enhanced the AI response streaming by splitting reasoning content from user-facing results, ensuring cleaner output.
- Updated various API calls to utilize the new heartbeat mechanism and improved error handling for response bodies.
- Refactored markdown rendering to better separate reasoning and final answers, enhancing user experience during AI interactions.
- Added tests for the new content splitting functionality to ensure proper behavior across different scenarios.
- Bumped version to 0.1.102 in package.json.
- Added new dependencies for @opentui/core and @opentui/react to improve UI capabilities.
- Updated build scripts to include new external dependencies.
- Enhanced TypeScript configuration to support new JSX import source.
- Refactored agent logic to incorporate reasoning and text streaming improvements.
- Improved error handling and response management in AI services.
@greptile-apps

greptile-apps Bot commented Sep 7, 2026

Copy link
Copy Markdown

Too many files changed for review (116 files, 100 file limit).

Bypass the limit by tagging @greptile-apps to review.

@vercel

vercel Bot commented Sep 7, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated
supercli Ready Ready Preview Sep 7, 2026 8:13pm UTC
supercli-client Ready Ready Preview Sep 7, 2026 8:13pm UTC
supercli-docs Ready Ready Preview Sep 7, 2026 8:13pm UTC
vercel-supercodeai-integration Ready Ready Preview Sep 7, 2026 8:13pm UTC

@coderabbitai

coderabbitai Bot commented Sep 7, 2026

Copy link
Copy Markdown

Important

Review skipped

Too many files!

This PR contains 130 files, which is 30 over the limit of 100.

To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch.

Upgrade to a paid plan to raise the limit.

This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: a0e1aa84-f0ec-49ef-acf2-7763cf69dd36

📥 Commits

Reviewing files that changed from the base of the PR and between 745967b and 8f37a03.

⛔ Files ignored due to path filters (2)
  • apps/supercode-desktop/SupercodeDesktop/Resources/AppIcon-backup-pre-round/icon_16.png is excluded by !**/*.png
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (130)
  • .gitignore
  • apps/docs/package.json
  • apps/marketplace/package.json
  • apps/supercode-cli/client/components/ui/button-group.tsx
  • apps/supercode-cli/client/package.json
  • apps/supercode-cli/server/package.json
  • apps/supercode-cli/server/src/agents/lib/harness.ts
  • apps/supercode-cli/server/src/agents/lib/types.ts
  • apps/supercode-cli/server/src/cli/ai/adapters/__tests__/stream-helpers.test.ts
  • apps/supercode-cli/server/src/cli/ai/adapters/google.ts
  • apps/supercode-cli/server/src/cli/ai/adapters/index.ts
  • apps/supercode-cli/server/src/cli/ai/adapters/openai-compatible.ts
  • apps/supercode-cli/server/src/cli/ai/adapters/stream-helpers.ts
  • apps/supercode-cli/server/src/cli/ai/adapters/types.ts
  • apps/supercode-cli/server/src/cli/ai/chat/at-picker.ts
  • apps/supercode-cli/server/src/cli/ai/chat/chat.ts
  • apps/supercode-cli/server/src/cli/ai/chat/chatAgent.ts
  • apps/supercode-cli/server/src/cli/ai/chat/chatTools.ts
  • apps/supercode-cli/server/src/cli/ai/chat/index.ts
  • apps/supercode-cli/server/src/cli/ai/chat/lib/auth.ts
  • apps/supercode-cli/server/src/cli/ai/chat/lib/context-tokens.ts
  • apps/supercode-cli/server/src/cli/ai/chat/lib/index.ts
  • apps/supercode-cli/server/src/cli/ai/chat/lib/modes.ts
  • apps/supercode-cli/server/src/cli/ai/chat/lib/session-state.ts
  • apps/supercode-cli/server/src/cli/ai/chat/lib/skill-state.ts
  • apps/supercode-cli/server/src/cli/ai/chat/lib/system-prompt.ts
  • apps/supercode-cli/server/src/cli/ai/chat/lib/tool-snapshot.ts
  • apps/supercode-cli/server/src/cli/ai/chat/lib/tools-for-turn.ts
  • apps/supercode-cli/server/src/cli/ai/chat/step-status-row.ts
  • apps/supercode-cli/server/src/cli/ai/chat/thinking.ts
  • apps/supercode-cli/server/src/cli/ai/concentrate-service.ts
  • apps/supercode-cli/server/src/cli/ai/google-service.ts
  • apps/supercode-cli/server/src/cli/ai/mergedev-service.ts
  • apps/supercode-cli/server/src/cli/ai/minimax-service.ts
  • apps/supercode-cli/server/src/cli/ai/nvidia-service.ts
  • apps/supercode-cli/server/src/cli/ai/orcarouter-service.ts
  • apps/supercode-cli/server/src/cli/ai/sanitize-messages.ts
  • apps/supercode-cli/server/src/cli/ai/server-proxy-service.ts
  • apps/supercode-cli/server/src/cli/ai/tool-executor.ts
  • apps/supercode-cli/server/src/cli/ai/tool-result.ts
  • apps/supercode-cli/server/src/cli/ai/tools-util.ts
  • apps/supercode-cli/server/src/cli/commands/ai/init.ts
  • apps/supercode-cli/server/src/cli/opentui/index.ts
  • apps/supercode-cli/server/src/cli/runtime/event-bus.ts
  • apps/supercode-cli/server/src/cli/runtime/provider-bridge.ts
  • apps/supercode-cli/server/src/cli/runtime/tool-loader.ts
  • apps/supercode-cli/server/src/cli/runtime/turn-runner.ts
  • apps/supercode-cli/server/src/cli/session/bootstrap.ts
  • apps/supercode-cli/server/src/cli/session/session-controller.ts
  • apps/supercode-cli/server/src/cli/tui/app.tsx
  • apps/supercode-cli/server/src/cli/tui/components/Composer.tsx
  • apps/supercode-cli/server/src/cli/tui/components/Header.tsx
  • apps/supercode-cli/server/src/cli/tui/components/PermissionModal.tsx
  • apps/supercode-cli/server/src/cli/tui/components/StatusBar.tsx
  • apps/supercode-cli/server/src/cli/tui/components/Transcript.tsx
  • apps/supercode-cli/server/src/cli/tui/index.tsx
  • apps/supercode-cli/server/src/cli/tui/launch.ts
  • apps/supercode-cli/server/src/cli/tui/theme.ts
  • apps/supercode-cli/server/src/cli/utils/index.ts
  • apps/supercode-cli/server/src/cli/utils/markdown-stream.ts
  • apps/supercode-cli/server/src/cli/utils/theme/index.ts
  • apps/supercode-cli/server/src/cli/utils/tui.ts
  • apps/supercode-cli/server/src/cli/workspace/context.ts
  • apps/supercode-cli/server/src/cli/workspace/format.ts
  • apps/supercode-cli/server/src/cli/workspace/index.ts
  • apps/supercode-cli/server/src/cli/workspace/prompt/budget.ts
  • apps/supercode-cli/server/src/cli/workspace/prompt/crisp.ts
  • apps/supercode-cli/server/src/cli/workspace/prompt/honesty.ts
  • apps/supercode-cli/server/src/cli/workspace/prompt/identity.ts
  • apps/supercode-cli/server/src/cli/workspace/prompt/index.ts
  • apps/supercode-cli/server/src/cli/workspace/prompt/new-app.ts
  • apps/supercode-cli/server/src/cli/workspace/prompt/principles.ts
  • apps/supercode-cli/server/src/cli/workspace/prompt/review.ts
  • apps/supercode-cli/server/src/cli/workspace/prompt/skills.ts
  • apps/supercode-cli/server/src/cli/workspace/prompt/tone.ts
  • apps/supercode-cli/server/src/cli/workspace/prompt/tools.ts
  • apps/supercode-cli/server/src/cli/workspace/prompt/web-search.ts
  • apps/supercode-cli/server/src/cli/workspace/scanner.ts
  • apps/supercode-cli/server/src/index.ts
  • apps/supercode-cli/server/src/lib/__tests__/split-think-content.test.ts
  • apps/supercode-cli/server/src/lib/citation-tracker.ts
  • apps/supercode-cli/server/src/lib/cli-config.ts
  • apps/supercode-cli/server/src/lib/context-enforcer.ts
  • apps/supercode-cli/server/src/lib/embedded-tool-calls.ts
  • apps/supercode-cli/server/src/lib/exa.ts
  • apps/supercode-cli/server/src/lib/file-search.ts
  • apps/supercode-cli/server/src/lib/firecrawl.ts
  • apps/supercode-cli/server/src/lib/load-env.ts
  • apps/supercode-cli/server/src/lib/openai-compatible-stream.ts
  • apps/supercode-cli/server/src/lib/proxy-tools.ts
  • apps/supercode-cli/server/src/lib/request-counter.ts
  • apps/supercode-cli/server/src/lib/scratch.ts
  • apps/supercode-cli/server/src/lib/split-think-content.ts
  • apps/supercode-cli/server/src/lib/token-budget.ts
  • apps/supercode-cli/server/src/lib/workspace.ts
  • apps/supercode-cli/server/src/runtime/HARDENING.md
  • apps/supercode-cli/server/src/runtime/config/cli-config.ts
  • apps/supercode-cli/server/src/runtime/config/context-enforcer.ts
  • apps/supercode-cli/server/src/runtime/config/load-env.ts
  • apps/supercode-cli/server/src/runtime/config/request-counter.ts
  • apps/supercode-cli/server/src/runtime/config/token-budget.ts
  • apps/supercode-cli/server/src/runtime/events.test.ts
  • apps/supercode-cli/server/src/runtime/events.ts
  • apps/supercode-cli/server/src/runtime/index.ts
  • apps/supercode-cli/server/src/runtime/quality/__tests__/citation-tracker.test.ts
  • apps/supercode-cli/server/src/runtime/quality/citation-tracker.ts
  • apps/supercode-cli/server/src/runtime/research/exa.ts
  • apps/supercode-cli/server/src/runtime/research/firecrawl.ts
  • apps/supercode-cli/server/src/runtime/stream/__tests__/embedded-tool-calls.test.ts
  • apps/supercode-cli/server/src/runtime/stream/embedded-tool-calls.ts
  • apps/supercode-cli/server/src/runtime/stream/openai-compatible-stream.ts
  • apps/supercode-cli/server/src/runtime/stream/proxy-tools.ts
  • apps/supercode-cli/server/src/runtime/stream/split-think-content.test.ts
  • apps/supercode-cli/server/src/runtime/stream/split-think-content.ts
  • apps/supercode-cli/server/src/runtime/workspace/file-search.ts
  • apps/supercode-cli/server/src/runtime/workspace/scratch.ts
  • apps/supercode-cli/server/src/runtime/workspace/workspace.ts
  • apps/supercode-cli/server/tsconfig.json
  • apps/supercode-desktop/SupercodeDesktop/Views/Chat/ChatViews.swift
  • apps/superdesign/package.json
  • apps/web/components/ui/button-group.tsx
  • apps/web/package.json
  • package.json
  • packages/db-terminal/package.json
  • packages/db/package.json
  • packages/db/prisma/schema.prisma
  • packages/db/src/client.ts
  • packages/ui/package.json
  • scripts/postinstall.ts
  • turbo.json

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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.

export function stableArgsKey(args: unknown): string {
if (!args || typeof args !== "object") return JSON.stringify(args ?? null)
const obj = args as Record<string, unknown>
return JSON.stringify(obj, Object.keys(obj).sort())

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

A replacer array is an allow-list applied at every depth, so nested object args lose all their keys and two distinct calls collapse to the same argsKey — the repetition guard then false-positives and kills legit loops. Sorting recursively with a replacer keeps the key stable and lossless:

Suggested change
return JSON.stringify(obj, Object.keys(obj).sort())
export function stableArgsKey(args: unknown): string {
if (!args || typeof args !== "object") return JSON.stringify(args ?? null)
return JSON.stringify(args, (_key, value) =>
value && typeof value === "object" && !Array.isArray(value)
? Object.fromEntries(Object.entries(value).sort(([a], [b]) => (a < b ? -1 : 1)))
: value,
)
}

Comment on lines +167 to +168
const useNative =
toolLoop === "native" || (toolLoop === "auto" && false) // auto → execute

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Dead branch — && false always kills the auto case, and the comment already says auto routes to execute.

Suggested change
const useNative =
toolLoop === "native" || (toolLoop === "auto" && false) // auto → execute
const useNative = toolLoop === "native" // auto → execute

if (event.toolCalls?.length) {
for (const tc of event.toolCalls) {
const a = (tc as any).input ?? {}
const argsKey = JSON.stringify(a, Object.keys(a).sort())

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

tool-result.ts now exports stableArgsKey (the proxy loop uses it) — reuse it here so the adapter loop and the proxy behave identically.

Suggested change
const argsKey = JSON.stringify(a, Object.keys(a).sort())
const argsKey = stableArgsKey(a)

(will need stableArgsKey added to the existing ../tool-result import)

tools: args.tools as any,
stopWhen: stepCountIs(8),
abortSignal: args.signal,
prepareStep: async ({ messages: stepMessages }) => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This prepareStep/onStepFinish guard block is a near-verbatim copy of the one in adapters/openai-compatible.ts (empty-result sentinel, denial loop, repetition guard, inline argsKey). Since stream-helpers.ts is already the shared home for adapter plumbing, extracting a createToolLoopGuards(callbacks) there would stop the two providers drifting — they already have: openai-compatible resets seenStepResults each step, this file doesn't.

Comment on lines +217 to +218
if (toolResults?.length) {
for (const tr of toolResults) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

openai-compatible resets seenStepResults at the start of each onStepFinish so the sentinel only reflects the latest round; here it accumulates across all steps, so the "all empty" notice keeps growing with stale outcomes from earlier rounds.

Suggested change
if (toolResults?.length) {
for (const tr of toolResults) {
if (toolResults?.length) {
seenStepResults.length = 0
for (const tr of toolResults) {

Comment on lines +141 to +143
} catch {
// Fallback: direct build agent.generate when unified path lacks LanguageModel id
const buildAgent = agentService.get("build")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This swallows user aborts from the unified path and then silently starts a second generation through the fallback (which isn't given the signal at all). Rethrow aborts before falling back:

Suggested change
} catch {
// Fallback: direct build agent.generate when unified path lacks LanguageModel id
const buildAgent = agentService.get("build")
} catch (err: any) {
if (err?.name === "AbortError") throw err
// Fallback: direct build agent.generate when unified path lacks LanguageModel id
const buildAgent = agentService.get("build")
if (!buildAgent?.generate) throw new Error("build agent not available")

Comment on lines +288 to +289
process.env.SUPERCODE_AGENT_PROVIDER = provider
if (model) process.env.SUPERCODE_AGENT_MODEL = model

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Smuggling the provider/model into runAgentTurn via process.env is global mutable state — it leaks across sessions and breaks if two sessions ever run in one process. Add provider/model to UnifiedTurnOptions and thread them through runUnifiedTurn instead.

Comment on lines +143 to +149
if (final.reasoning && final.reasoning !== reasoningAcc) {
const extra = final.reasoning.slice(reasoningAcc.length).trim()
if (extra) {
emit({ type: "reasoning", delta: extra })
opts.onReasoning?.(extra)
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

finalizeAnswerVsProcess doesn't guarantee the returned reasoning is a superset of what was already streamed (tagged CoT in the text channel gets folded in too), so slicing by length can emit a mangled fragment. chat.ts guards this with startsWith — same here:

Suggested change
if (final.reasoning && final.reasoning !== reasoningAcc) {
const extra = final.reasoning.slice(reasoningAcc.length).trim()
if (extra) {
emit({ type: "reasoning", delta: extra })
opts.onReasoning?.(extra)
}
}
if (final.reasoning && final.reasoning !== reasoningAcc) {
const extra = final.reasoning.startsWith(reasoningAcc)
? final.reasoning.slice(reasoningAcc.length).trim()
: final.reasoning.trim()
if (extra) {
emit({ type: "reasoning", delta: extra })
opts.onReasoning?.(extra)
}
}

Comment on lines +295 to +298
if (final.reasoning && final.reasoning !== fullReasoning) {
const extra = final.reasoning.slice(fullReasoning.length).trim()
if (extra) opts.onReasoning?.(extra)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Same as the provider-bridge copy — final.reasoning isn't always a superset of fullReasoning, so slicing by length can emit a garbled chunk. Guard with startsWith:

Suggested change
if (final.reasoning && final.reasoning !== fullReasoning) {
const extra = final.reasoning.slice(fullReasoning.length).trim()
if (extra) opts.onReasoning?.(extra)
}
const final = finalizeAnswerVsProcess(fullText, fullReasoning)
if (final.reasoning && final.reasoning !== fullReasoning) {
const extra = final.reasoning.startsWith(fullReasoning)
? final.reasoning.slice(fullReasoning.length).trim()
: final.reasoning.trim()
if (extra) opts.onReasoning?.(extra)
}

Comment on lines +91 to +96
const onParentAbort = opts.signal
? () => controller.abort()
: undefined
if (onParentAbort && opts.signal) {
opts.signal.addEventListener("abort", onParentAbort, { once: true })
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

If the caller's signal is already aborted when the guard is created, the abort event never fires and the request runs un-aborted. Fast-path it:

Suggested change
const onParentAbort = opts.signal
? () => controller.abort()
: undefined
if (onParentAbort && opts.signal) {
opts.signal.addEventListener("abort", onParentAbort, { once: true })
}
const onParentAbort = opts.signal
? () => controller.abort()
: undefined
if (opts.signal?.aborted) {
controller.abort()
} else if (onParentAbort && opts.signal) {
opts.signal.addEventListener("abort", onParentAbort, { once: true })
}

- Modified .gitignore to streamline generated files handling.
- Updated package.json files across multiple apps to specify exact versions for @types/react and @types/react-dom.
- Enhanced turbo.json outputs to include generated files for better build management.
- Refactored postinstall script for consistent Prisma client generation across packages.
- Adjusted Prisma schema output path for improved stability in monorepo setup.
- Specified exact versions for @types/react and @types/react-dom in bun.lock and various package.json files.
- Added @prisma/client-runtime-utils dependency to enhance Prisma functionality in marketplace, web, and db packages.
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