Skip to content

fix(cli): keep balance errors out of the terminal - #13729

Merged
marius-kilocode merged 1 commit into
mainfrom
fix-cli-error
Sep 3, 2026
Merged

fix(cli): keep balance errors out of the terminal#13729
marius-kilocode merged 1 commit into
mainfrom
fix-cli-error

Conversation

@marius-kilocode

Copy link
Copy Markdown
Collaborator

What Problem This Solves

A failed balance lookup writes a raw warning and stack trace over the CLI terminal interface. The error is already handled, but console.warn bypasses the TUI worker's file logger.

Why This Change Was Made

Pass the existing CLI logger into the balance helper and route both HTTP and transport/parse failures through it. Keep the logger optional with the current console default for other gateway callers. This avoids changing global worker logging or adding a gateway dependency on CLI internals.

User Impact

Balance lookup failures no longer overwrite the TUI. The profile can still load with an unavailable balance, and diagnostics remain in the CLI log. Successful balance requests and explicit terminal-log settings keep their existing behavior. This does not fix the underlying network connection failure.

Evidence

  • 38 focused tests pass across the gateway profile and active CLI HTTP handler suites. The three new regression cases fail when the old caller is restored.
  • CLI and gateway typechecks pass. Scoped lint reports no errors and six warnings on unchanged code. The handler also has a pre-existing Prettier difference outside this patch.
  • Exercised the real TUI worker against a local HTTP API with fake credentials: connection refusal, HTTP 503, invalid JSON, then successful recovery. Each failure returned HTTP 200 with balance: null, emitted no raw terminal warning, and wrote a diagnostic to dev.log. Recovery returned the expected balance.
  • The worker was exercised directly; the full visual TUI was not launched.

@kilo-code-bot

kilo-code-bot Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (4 files)
  • .changeset/quiet-balance-errors.md
  • packages/kilo-gateway/src/api/profile.ts
  • packages/opencode/src/kilocode/server/httpapi/handlers/kilo-gateway.ts
  • packages/opencode/test/kilocode/server/kilo-gateway-statuses.test.ts

Reviewed by grok-4.6 · Input: 55.8K · Output: 8K · Cached: 288.1K

Review guidance: REVIEW.md from base branch main

@marius-kilocode
marius-kilocode merged commit 6afe782 into main Sep 3, 2026
33 checks passed
@marius-kilocode
marius-kilocode deleted the fix-cli-error branch September 3, 2026 09:02
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.

2 participants