Skip to content

chore: bump version to 0.1.26 and update model references#137

Merged
yashdev9274 merged 1 commit into
mainfrom
supercode-cli
Jun 29, 2026
Merged

chore: bump version to 0.1.26 and update model references#137
yashdev9274 merged 1 commit into
mainfrom
supercode-cli

Conversation

@yashdev9274

@yashdev9274 yashdev9274 commented Jun 29, 2026

Copy link
Copy Markdown
Owner
  • Updated package version to 0.1.26.
  • Changed model references from minimaxai/minimax-m2.7 to minimaxai/minimax-m3 across various services and configurations.
  • Introduced onStepFinish callback in multiple AI service classes to enhance step tracking during tool execution.
  • Added a new StepStatusRow class for live status updates during AI operations, improving user feedback in the CLI.
  • Updated pricing and model information to reflect the new model version.

Summary by CodeRabbit

  • New Features

    • Improved live CLI chat output with clearer per-step status, tool call display, and a toggle to expand the latest reasoning block.
    • Added a /verbose command for more detailed tool logging.
  • Bug Fixes

    • Live status output now updates and closes more cleanly during cancellations and terminal resizing.
    • Better handling of tool-call steps, including flagged or permission-denied results.
  • Updates

    • Refreshed model aliases, defaults, token limits, and pricing entries for newer MiniMax model names.

- Updated package version to 0.1.26.
- Changed model references from `minimaxai/minimax-m2.7` to `minimaxai/minimax-m3` across various services and configurations.
- Introduced `onStepFinish` callback in multiple AI service classes to enhance step tracking during tool execution.
- Added a new `StepStatusRow` class for live status updates during AI operations, improving user feedback in the CLI.
- Updated pricing and model information to reflect the new model version.
@vercel

vercel Bot commented Jun 29, 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 Jun 29, 2026 5:37am
supercli-client Ready Ready Preview, Comment Jun 29, 2026 5:37am
supercli-docs Ready Ready Preview, Comment Jun 29, 2026 5:37am

@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 free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

Introduces a new StepStatusRow animated terminal component and refactors ThoughtChain for per-step live rendering with flagged-tool (red ✗) support. Propagates a typed onStepFinish callback across all AI provider services and the tool executor. Also replaces all minimaxai/minimax-m2.7/minimax-m2-7 model references with minimax-m3 throughout config, pricing, and catalogs.

Changes

Per-step streaming TUI and provider onStepFinish

Layer / File(s) Summary
StepStatusRow component and helpers
apps/supercode-cli/server/src/cli/ai/chat/step-status-row.ts
New StepPhase type and StepStatusRow class with animated in-place terminal rendering, elapsed timing, spinner frames, and extractToolArg/stripAnsiLen helpers.
ThoughtChain refactor with flagged-tool rendering
apps/supercode-cli/server/src/cli/ai/chat/thinking.ts
Removes AgentStatusDisplay and showToolSequence; extends ThoughtTool/ThoughtEntry with flagged and live-render state; rewrites beginAndPrint, printToolRow, finishAndPrint, and markLastToolFlagged for per-step output with red ✗ markers on denied/empty tools.
onStepFinish callback contract across providers
apps/supercode-cli/server/src/cli/ai/provider.ts, tool-executor.ts, openrouter-service.ts, nvidia-service.ts, server-proxy-service.ts, google-service.ts, concentrate-service.ts, minimax-service.ts
AIProvider interface and ToolExecutorCallbacks add a typed onStepFinish callback; all provider services accept and invoke it with normalized stepNumber, toolCalls, and toolResults.
chat.ts wiring: status row, callbacks, Ctrl+T, /verbose
apps/supercode-cli/server/src/cli/ai/chat/chat.ts
Creates per-turn ThoughtChain and StepStatusRow, drives both from onToolCall/onToolResult/onStepFinish handlers, adds Ctrl+T thought-block toggle, /verbose command, terminal resize propagation, and defensive abort/catch cleanup.

MiniMax M3 Model Upgrade

Layer / File(s) Summary
MiniMax M3 references across all config and catalogs
apps/supercode-cli/server/src/config/nvidia.config.ts, src/cli/ai/context-windows.ts, src/lib/pricing.ts, src/cli/ai/openrouter-service.ts, src/cli/ai/provider.ts, src/index.ts, src/cli/commands/slashCommands/..., package.json
Replaces minimaxai/minimax-m2.7/minimax-m2-7 with minimax-m3 in the NVIDIA default config, context window map, pricing table, token-limit maps, provider metadata, help/model slash-command catalogs, and server index fallback.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • yashdev9274/supercli#117: Introduced the onStepFinish callback integration in concentrate-service.ts that this PR now extends with explicit typed payload shapes.
  • yashdev9274/supercli#127: Made prior substantive changes to ThoughtChain/ThoughtEntry/tool-call rendering in thinking.ts, directly overlapping with this PR's per-step rendering refactor.
  • yashdev9274/supercli#133: Changed chat.ts and thinking.ts reasoning-rendering flow for consolidated/collapsed blocks, which this PR further refactors into per-step output.

Poem

🐇 Hop hop, the status row glows,
Each tool step traced as the spinner flows,
Ctrl+T reveals what the rabbit thought,
Flagged in red where the tool came to naught,
MiniMax three takes the stage with a leap—
The CLI's TUI: no secret to keep! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 27.27% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately covers the version bump and model reference updates, which are real parts of the pull request.
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.

@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: 11

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/minimax-service.ts (1)

42-49: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Forward onStepFinish into executeToolLoop().

The parameter is accepted but not passed to the tool executor, so Minimax tool runs never close/update per-step UI through the new callback.

Proposed fix
           system,
           tools,
-          { onChunk, onToolCall, onReasoning, onToolResult, signal },
+          { onChunk, onToolCall, onReasoning, onToolResult, onStepFinish, signal },
         )
🤖 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/minimax-service.ts` around lines 42 -
49, The Minimax tool path in `minimax-service.ts` accepts `onStepFinish` but
does not forward it into `executeToolLoop`, so per-step completion updates never
fire. Update the `executeToolLoop(...)` call inside the `tools &&
Object.keys(tools).length > 0` branch to pass the `onStepFinish` callback
alongside the existing `onChunk`, `onToolCall`, `onReasoning`, `onToolResult`,
and `signal` options, keeping the `executeToolLoop` and `Minimax` service wiring
consistent.
🤖 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/chat/chat.ts`:
- Around line 741-745: The Ctrl+T toggle in chat.ts is placed too late, after
the stdinResolve early return, so it never runs while streaming when activeChain
is available. Move the Ctrl+T handling in the keypress flow above the “No input
handler active” guard, keeping the existing activeChain check and redraw
behavior intact so the thought toggle works during active streaming.
- Around line 427-428: The abort cleanup path in the chat flow leaves
activeChain pointing at the cancelled turn while the success and non-abort error
paths already clear it. Update the abort handling near the
statusRow.stop/activeStatusRow cleanup in chat.ts to also reset activeChain to
null/undefined, matching the existing cleanup behavior used elsewhere in the
same turn execution flow.

In `@apps/supercode-cli/server/src/cli/ai/chat/step-status-row.ts`:
- Around line 156-159: The `render()` logic in `step-status-row` is writing
directly to the current cursor row from timer callbacks without reserving a
fixed line, which can overwrite streaming markdown/tool output. Update the
status rendering flow so `StepStatusRow` uses a dedicated persisted row (or
delegates row placement to the persistent footer) before calling the clear/write
sequence, and keep the cursor positioning stable within `render()` and its
caller setup.

In `@apps/supercode-cli/server/src/cli/ai/chat/thinking.ts`:
- Around line 512-516: Preserve failed-tool markers when toggling a thought by
ensuring `togglePrinted()` does not drop `ThoughtTool.flagged` state when it
re-renders via `renderThought(entry)`. Update the
`renderThought()`/`groupTools()` path so flagged tools still render with their
failed `✗` marker, or route flagged rows through the same per-tool rendering
logic used elsewhere. Verify the symbols `togglePrinted`, `renderThought`,
`groupTools`, and `ThoughtTool.flagged` keep the marker intact after Ctrl+T
re-emission.
- Around line 458-460: The collapse logic in thinking.ts ignores the exposed
keepExpanded option, so callers cannot force an entry to stay expanded unless
hadFlaggedTool is set. Update the entry.collapsed assignment in the chat
thinking flow to explicitly honor keepExpanded before autoCollapse, using the
existing keepExpanded/autoCollapse inputs alongside hadFlaggedTool so forced
expansion wins consistently.
- Around line 413-416: `ThoughtTree.beginAndPrint()` should not create a new
`ThoughtEntry` when a step is already open, since `chat.ts` may call it multiple
times per AI step. Add an idempotent guard in `beginAndPrint()` (and, if needed,
reuse the current open entry from the tree state) so repeated calls return the
existing live block instead of starting another one. Keep the behavior in sync
with `begin()`/`openInProgress` so only one thought block is active until it is
closed.

In `@apps/supercode-cli/server/src/cli/ai/concentrate-service.ts`:
- Around line 41-47: The Concentrate service is capturing onStepFinishRef but
never forwarding it from the SDK step-finish hook, so the chat UI never receives
step completion updates. Update the Concentrate flow in concentrate-service.ts
to wire the SDK’s step-finish callback through to onStepFinishRef, matching the
behavior already used by the Google service. Make sure the callback is invoked
with the step number, toolCalls, and toolResults so chat.ts can collapse/update
the per-step UI correctly.

In `@apps/supercode-cli/server/src/cli/ai/google-service.ts`:
- Around line 55-61: The Google service method is capturing onStepFinish but not
forwarding it into the step handler, so the chat flow never receives step-finish
updates. Update google-service’s streamText step handling to invoke
onStepFinishRef with the step details when a step completes, using the existing
onStepFinish parameter and its callback shape. Keep the fix localized around the
streamText handler and the onStepFinishRef usage so
apps/supercode-cli/server/src/cli/ai/chat/chat.ts can close the Thought block
and advance the status row.

In `@apps/supercode-cli/server/src/cli/ai/openrouter-service.ts`:
- Around line 315-329: The step completion callback in openrouter-service is
using the cumulative tool-call count as stepNumber, which causes multi-tool
iterations to report the wrong step index. Update the onStepFinish payload in
the step-finish block to use the actual per-iteration step index for the current
loop execution, and keep toolCalls/toolResults mapping unchanged. Use the
onStepFinish call site and the surrounding manual polling loop in
openrouter-service to locate the fix, since chat.ts consumes stepNumber as the
completed step count.

In `@apps/supercode-cli/server/src/cli/ai/server-proxy-service.ts`:
- Around line 192-200: The per-step finish callback in server-proxy-service
should report the current step index instead of the cumulative tool-call count.
Update the onStepFinish payload in the step-completion block to use the step’s
position for stepNumber, not this.collectedToolCalls.length, so the chat UI in
chat.ts receives sequential step numbers even when multiple tools are requested
in one step.

In `@apps/supercode-cli/server/src/cli/ai/tool-executor.ts`:
- Around line 164-175: The per-step finish payload in tool-executor’s
onStepFinish block is using a zero-based step index and losing per-call argument
pairing for repeated tool names. Update the step emission to report a 1-based
step count from iter, and build toolResults from the current iteration’s
executed calls/results so each result keeps its own args instead of using find()
by toolName.

---

Outside diff comments:
In `@apps/supercode-cli/server/src/cli/ai/minimax-service.ts`:
- Around line 42-49: The Minimax tool path in `minimax-service.ts` accepts
`onStepFinish` but does not forward it into `executeToolLoop`, so per-step
completion updates never fire. Update the `executeToolLoop(...)` call inside the
`tools && Object.keys(tools).length > 0` branch to pass the `onStepFinish`
callback alongside the existing `onChunk`, `onToolCall`, `onReasoning`,
`onToolResult`, and `signal` options, keeping the `executeToolLoop` and
`Minimax` service wiring consistent.
🪄 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

Run ID: bbc6fec9-e00e-41b7-84cc-26f820f362d0

📥 Commits

Reviewing files that changed from the base of the PR and between 7918d93 and 1999b6e.

📒 Files selected for processing (18)
  • apps/supercode-cli/server/package.json
  • apps/supercode-cli/server/src/cli/ai/chat/chat.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/context-windows.ts
  • apps/supercode-cli/server/src/cli/ai/google-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/openrouter-service.ts
  • apps/supercode-cli/server/src/cli/ai/provider.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/commands/slashCommands/help.ts
  • apps/supercode-cli/server/src/cli/commands/slashCommands/model.ts
  • apps/supercode-cli/server/src/config/nvidia.config.ts
  • apps/supercode-cli/server/src/index.ts
  • apps/supercode-cli/server/src/lib/pricing.ts

Comment on lines +427 to +428
statusRow.stop()
activeStatusRow = null

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 | 🟡 Minor | ⚡ Quick win

Clear activeChain on abort cleanup.

The success and non-abort error paths clear activeChain, but the abort path leaves it pointing at the cancelled turn.

Proposed fix
       }
       statusRow.stop()
       activeStatusRow = null
+      activeChain = null
       md.end()
📝 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
statusRow.stop()
activeStatusRow = null
statusRow.stop()
activeStatusRow = null
activeChain = null
🤖 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 427 - 428,
The abort cleanup path in the chat flow leaves activeChain pointing at the
cancelled turn while the success and non-abort error paths already clear it.
Update the abort handling near the statusRow.stop/activeStatusRow cleanup in
chat.ts to also reset activeChain to null/undefined, matching the existing
cleanup behavior used elsewhere in the same turn execution flow.

Comment on lines +741 to +745
// Ctrl+T — toggle the most recently printed Thought block (collapsed ↔ expanded).
// Cheap in-place redraw: clear the line at the current cursor, rewrite the
// chevron + body in the new state, then move the cursor back down. Only
// works on a TTY because the rendered Thought blocks live in ANSI scrollback.
if (key.ctrl && key.name === "t" && process.stdout.isTTY && activeChain) {

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

Move Ctrl+T handling before the stdinResolve guard.

This block is currently after if (!stdinResolve) return, but during streaming the input promise has already resolved, so Ctrl+T cannot reach activeChain while it is active. Move this handler above the “No input handler active” return.

🤖 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 741 - 745,
The Ctrl+T toggle in chat.ts is placed too late, after the stdinResolve early
return, so it never runs while streaming when activeChain is available. Move the
Ctrl+T handling in the keypress flow above the “No input handler active” guard,
keeping the existing activeChain check and redraw behavior intact so the thought
toggle works during active streaming.

Comment on lines +156 to +159
process.stdout.write("\x1b7")
process.stdout.write("\r\x1b[2K")
process.stdout.write(`${leftBorder} ${inner} ${fillLine}`)
process.stdout.write("\x1b8")

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 | 🏗️ Heavy lift

Reserve a stable row before repainting the status line.

render() clears/writes the current cursor row from timer callbacks, but this component “reserves no row”. During streaming, the current cursor is also used by markdown/tool output, so the status timer can overwrite response text or leave artifacts. Mount a dedicated row or delegate positioning to the persistent footer before clearing/writing.

🤖 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/step-status-row.ts` around lines
156 - 159, The `render()` logic in `step-status-row` is writing directly to the
current cursor row from timer callbacks without reserving a fixed line, which
can overwrite streaming markdown/tool output. Update the status rendering flow
so `StepStatusRow` uses a dedicated persisted row (or delegates row placement to
the persistent footer) before calling the clear/write sequence, and keep the
cursor positioning stable within `render()` and its caller setup.

Comment on lines +413 to +416
beginAndPrint(): ThoughtEntry | null {
if (!process.stdout.isTTY) return null
const entry = this.begin()
entry.openInProgress = 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.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Make beginAndPrint() idempotent while a step is open.

chat.ts calls this for every tool call in a step, but this implementation always starts a new ThoughtEntry. Multiple tool calls in one AI step will leave earlier live blocks visually unclosed and only collapse the last one.

Proposed fix
   beginAndPrint(): ThoughtEntry | null {
     if (!process.stdout.isTTY) return null
+    if (this.current?.openInProgress) return this.current
     const entry = this.begin()
     entry.openInProgress = true
📝 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
beginAndPrint(): ThoughtEntry | null {
if (!process.stdout.isTTY) return null
const entry = this.begin()
entry.openInProgress = true
beginAndPrint(): ThoughtEntry | null {
if (!process.stdout.isTTY) return null
if (this.current?.openInProgress) return this.current
const entry = this.begin()
entry.openInProgress = true
🤖 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/thinking.ts` around lines 413 -
416, `ThoughtTree.beginAndPrint()` should not create a new `ThoughtEntry` when a
step is already open, since `chat.ts` may call it multiple times per AI step.
Add an idempotent guard in `beginAndPrint()` (and, if needed, reuse the current
open entry from the tree state) so repeated calls return the existing live block
instead of starting another one. Keep the behavior in sync with
`begin()`/`openInProgress` so only one thought block is active until it is
closed.

Comment on lines +458 to +460
// keepExpanded (e.g. when a tool was denied/empty) wins over autoCollapse.
entry.collapsed =
entry.hadFlaggedTool ? false : (opts?.autoCollapse ?? 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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Honor the keepExpanded option.

The comment and signature expose keepExpanded, but entry.collapsed only checks hadFlaggedTool, so callers cannot force expansion unless a tool was flagged.

Proposed fix
     // keepExpanded (e.g. when a tool was denied/empty) wins over autoCollapse.
     entry.collapsed =
-      entry.hadFlaggedTool ? false : (opts?.autoCollapse ?? true)
+      entry.hadFlaggedTool || opts?.keepExpanded ? false : (opts?.autoCollapse ?? true)
📝 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
// keepExpanded (e.g. when a tool was denied/empty) wins over autoCollapse.
entry.collapsed =
entry.hadFlaggedTool ? false : (opts?.autoCollapse ?? true)
// keepExpanded (e.g. when a tool was denied/empty) wins over autoCollapse.
entry.collapsed =
entry.hadFlaggedTool || opts?.keepExpanded ? false : (opts?.autoCollapse ?? true)
🤖 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/thinking.ts` around lines 458 -
460, The collapse logic in thinking.ts ignores the exposed keepExpanded option,
so callers cannot force an entry to stay expanded unless hadFlaggedTool is set.
Update the entry.collapsed assignment in the chat thinking flow to explicitly
honor keepExpanded before autoCollapse, using the existing
keepExpanded/autoCollapse inputs alongside hadFlaggedTool so forced expansion
wins consistently.

Comment on lines +41 to +47
onStepFinish?: (params: { stepNumber: number; toolCalls: Array<{ toolName: string; args: unknown }>; toolResults: Array<{ toolName: string; args: unknown; result: string }> }) => void,
) {
try {
const systemMessages = messages.filter(m => m.role === "system")
const nonSystemMessages = messages.filter(m => m.role !== "system")
const system = systemMessages.map(m => m.content).join("\n")
const onStepFinishRef = onStepFinish

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

Propagate the new onStepFinish callback here too.

Like the Google service, this method captures onStepFinishRef but never invokes it from the SDK's step-finish hook. That means apps/supercode-cli/server/src/cli/ai/chat/chat.ts:307-311 never gets the signal to collapse/update the per-step UI for Concentrate sessions.

🤖 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/concentrate-service.ts` around lines 41
- 47, The Concentrate service is capturing onStepFinishRef but never forwarding
it from the SDK step-finish hook, so the chat UI never receives step completion
updates. Update the Concentrate flow in concentrate-service.ts to wire the SDK’s
step-finish callback through to onStepFinishRef, matching the behavior already
used by the Google service. Make sure the callback is invoked with the step
number, toolCalls, and toolResults so chat.ts can collapse/update the per-step
UI correctly.

Comment on lines +55 to +61
onStepFinish?: (params: { stepNumber: number; toolCalls: Array<{ toolName: string; args: unknown }>; toolResults: Array<{ toolName: string; args: unknown; result: string }> }) => void,
) {
try {
const systemMessages = messages.filter(m => m.role === "system")
const nonSystemMessages = messages.filter(m => m.role !== "system")
const system = systemMessages.map(m => m.content).join("\n")
const onStepFinishRef = onStepFinish

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

Forward onStepFinish instead of just capturing it.

This method now exposes the callback, but the streamText step handler below never calls onStepFinishRef. For Google-backed turns, apps/supercode-cli/server/src/cli/ai/chat/chat.ts:307-311 will never receive the step-finish signal that closes the live Thought block and advances the status row.

🤖 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/google-service.ts` around lines 55 - 61,
The Google service method is capturing onStepFinish but not forwarding it into
the step handler, so the chat flow never receives step-finish updates. Update
google-service’s streamText step handling to invoke onStepFinishRef with the
step details when a step completes, using the existing onStepFinish parameter
and its callback shape. Keep the fix localized around the streamText handler and
the onStepFinishRef usage so apps/supercode-cli/server/src/cli/ai/chat/chat.ts
can close the Thought block and advance the status row.

Comment on lines +315 to +329
// Notify chat loop of step finish (OpenRouter uses a manual polling
// loop, so each iteration is a "step" for our purposes).
if (onStepFinish && result.toolCalls.length > 0) {
onStepFinish({
stepNumber: toolCallsThisTurn,
toolCalls: result.toolCalls.map((c: any) => ({ toolName: c.toolName, args: c.args })),
toolResults: result.toolCalls.map((c: any) => {
const tr = allToolResults.find((r) => r.toolName === c.toolName)
return {
toolName: c.toolName,
args: c.args,
result: tr?.result ?? "",
}
}),
})

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

Use a real step index here, not the cumulative tool-call count.

toolCallsThisTurn grows with tool invocations, so a single step that emits multiple tools reports stepNumber 2/3/... instead of 1. apps/supercode-cli/server/src/cli/ai/chat/chat.ts:307-311 uses that value as the completed step count, so the live status row will skip numbers for multi-tool steps.

🤖 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/openrouter-service.ts` around lines 315
- 329, The step completion callback in openrouter-service is using the
cumulative tool-call count as stepNumber, which causes multi-tool iterations to
report the wrong step index. Update the onStepFinish payload in the step-finish
block to use the actual per-iteration step index for the current loop execution,
and keep toolCalls/toolResults mapping unchanged. Use the onStepFinish call site
and the surrounding manual polling loop in openrouter-service to locate the fix,
since chat.ts consumes stepNumber as the completed step count.

Comment on lines +192 to +200

// Per-step finish notification for the chat loop's live per-step UI.
if (onStepFinish && result.toolCalls.length > 0) {
onStepFinish({
stepNumber: this.collectedToolCalls.length,
toolCalls: result.toolCalls.map((c: any) => ({ toolName: c.toolName, args: c.args })),
toolResults: stepResults,
})
}

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

Report the step index here, not total tool calls.

this.collectedToolCalls.length is a cumulative tool-call counter, so the first completed step can already report 2 when the model requested two tools at once. The chat UI in apps/supercode-cli/server/src/cli/ai/chat/chat.ts:307-311 treats this as the step count and will show skipped numbers.

🤖 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
192 - 200, The per-step finish callback in server-proxy-service should report
the current step index instead of the cumulative tool-call count. Update the
onStepFinish payload in the step-completion block to use the step’s position for
stepNumber, not this.collectedToolCalls.length, so the chat UI in chat.ts
receives sequential step numbers even when multiple tools are requested in one
step.

Comment on lines +164 to +175
// Per-step finish notification — used by the chat loop to close
// and auto-collapse the live per-step Thought block.
if (callbacks.onStepFinish && toolCalls.length > 0) {
callbacks.onStepFinish({
stepNumber: iter,
toolCalls: toolCalls.map((tc) => ({ toolName: tc.toolName, args: tc.args })),
toolResults: allToolResults.slice(-toolCalls.length).map((r) => ({
toolName: r.toolName,
args: toolCalls.find((tc) => tc.toolName === r.toolName)?.args ?? {},
result: r.result,
})),
})

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 per-call result args and use a 1-based step count.

stepNumber: iter reports the first completed step as 0, and find() by toolName assigns the first matching args to every same-named tool result. Keep a current-iteration result list while executing tools and emit iter + 1.

Proposed fix
     // Execute each tool call
+    const currentToolResults: Array<{ toolName: string; args: unknown; result: string }> = []
     for (const tc of toolCalls) {
       callbacks.onToolCall?.({ toolName: tc.toolName, args: tc.args })
@@
       allToolResults.push({ toolName: tc.toolName, result: resultStr })
+      currentToolResults.push({ toolName: tc.toolName, args: tc.args, result: resultStr })
@@
     if (callbacks.onStepFinish && toolCalls.length > 0) {
       callbacks.onStepFinish({
-        stepNumber: iter,
+        stepNumber: iter + 1,
         toolCalls: toolCalls.map((tc) => ({ toolName: tc.toolName, args: tc.args })),
-        toolResults: allToolResults.slice(-toolCalls.length).map((r) => ({
-          toolName: r.toolName,
-          args: toolCalls.find((tc) => tc.toolName === r.toolName)?.args ?? {},
-          result: r.result,
-        })),
+        toolResults: currentToolResults,
       })
     }
📝 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
// Per-step finish notification — used by the chat loop to close
// and auto-collapse the live per-step Thought block.
if (callbacks.onStepFinish && toolCalls.length > 0) {
callbacks.onStepFinish({
stepNumber: iter,
toolCalls: toolCalls.map((tc) => ({ toolName: tc.toolName, args: tc.args })),
toolResults: allToolResults.slice(-toolCalls.length).map((r) => ({
toolName: r.toolName,
args: toolCalls.find((tc) => tc.toolName === r.toolName)?.args ?? {},
result: r.result,
})),
})
// Execute each tool call
const currentToolResults: Array<{ toolName: string; args: unknown; result: string }> = []
for (const tc of toolCalls) {
callbacks.onToolCall?.({ toolName: tc.toolName, args: tc.args })
// ...existing execution logic...
allToolResults.push({ toolName: tc.toolName, result: resultStr })
currentToolResults.push({ toolName: tc.toolName, args: tc.args, result: resultStr })
}
// Per-step finish notification — used by the chat loop to close
// and auto-collapse the live per-step Thought block.
if (callbacks.onStepFinish && toolCalls.length > 0) {
callbacks.onStepFinish({
stepNumber: iter + 1,
toolCalls: toolCalls.map((tc) => ({ toolName: tc.toolName, args: tc.args })),
toolResults: currentToolResults,
})
}
🤖 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/tool-executor.ts` around lines 164 -
175, The per-step finish payload in tool-executor’s onStepFinish block is using
a zero-based step index and losing per-call argument pairing for repeated tool
names. Update the step emission to report a 1-based step count from iter, and
build toolResults from the current iteration’s executed calls/results so each
result keeps its own args instead of using find() by toolName.

@yashdev9274
yashdev9274 merged commit c30c070 into main Jun 29, 2026
5 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Jul 7, 2026
14 tasks
@coderabbitai coderabbitai Bot mentioned this pull request Jul 17, 2026
14 tasks
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