Skip to content

feat(cli): show credits and Kilo Pass in sidebar footer#11729

Merged
johnnyeric merged 1 commit into
mainfrom
johnnyeric/balance-cli-tui
Jun 29, 2026
Merged

feat(cli): show credits and Kilo Pass in sidebar footer#11729
johnnyeric merged 1 commit into
mainfrom
johnnyeric/balance-cli-tui

Conversation

@johnnyeric

@johnnyeric johnnyeric commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Context

Show the user's remaining Kilo credits and Kilo Pass usage in the CLI sidebar footer so balance state is visible in the TUI without opening another surface.

Implementation

Adds a Kilo balance refresh helper and wires the sidebar footer to render account credit balance plus Kilo Pass period usage and reset date when profile data includes those fields.

Screenshots / Video

Balance.CLI.mov

How to Test

Manual/local verification

  • Agent: bun test ./test/kilocode/sidebar-footer.test.ts from packages/opencode/ passed: 3 tests, 0 failures.
  • Agent: pre-push bun turbo typecheck passed.

Reviewer test steps

  1. Start the CLI TUI with a signed-in Kilo account that has credits and Kilo Pass usage.
  2. Confirm the sidebar footer shows remaining credits.
  3. Confirm Kilo Pass usage and reset date appear when included in the profile response.

Checklist

  • Issue linked above, or exception explained
  • Tests/verification described
  • Screenshots/video included for visual changes, or marked N/A
  • Changeset considered for user-facing changes
  • I personally reviewed the diff and can explain the changes, including any AI-assisted work.

@johnnyeric johnnyeric marked this pull request as ready for review June 26, 2026 12:01

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 822ca1748a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/opencode/src/kilocode/plugins/sidebar-footer.tsx Outdated
@johnnyeric johnnyeric force-pushed the johnnyeric/balance-cli-tui branch from 822ca17 to 5013930 Compare June 26, 2026 12:04
Comment thread packages/opencode/src/kilocode/plugins/sidebar-footer.tsx Outdated
@kilo-code-bot

kilo-code-bot Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (5 files)
  • .changeset/cli-sidebar-balance.md
  • packages/opencode/src/kilocode/balance-refresh.ts
  • packages/opencode/src/kilocode/kilo-commands.tsx
  • packages/opencode/src/kilocode/plugins/sidebar-footer.tsx
  • packages/opencode/test/kilocode/sidebar-footer.test.ts
Previous Review Summaries (6 snapshots, latest commit 0b808fc)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 0b808fc)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
packages/opencode/src/kilocode/plugins/sidebar-footer.tsx 101 The new balance refresh loop starts uncancelled kilo.profile() requests on load, poll, and billed-turn updates; because this client path disables Bun's default fetch timeout, stalled Gateway calls can accumulate and leak in-flight requests and closures.

Fix these issues in Kilo Cloud

Files Reviewed (5 files)
  • .changeset/cli-sidebar-balance.md - 0 issues
  • packages/opencode/src/kilocode/balance-refresh.ts - 0 issues
  • packages/opencode/src/kilocode/kilo-commands.tsx - 0 issues
  • packages/opencode/src/kilocode/plugins/sidebar-footer.tsx - 1 issue
  • packages/opencode/test/kilocode/sidebar-footer.test.ts - 0 issues

Previous review (commit feb0844)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
packages/opencode/src/kilocode/plugins/sidebar-footer.tsx 101 The new balance refresh loop starts uncancelled kilo.profile() requests on load, poll, and billed-turn updates; because this client path disables Bun's default fetch timeout, stalled Gateway calls can accumulate and leak in-flight requests and closures.

Fix these issues in Kilo Cloud

Files Reviewed (5 files)
  • .changeset/cli-sidebar-balance.md - 0 issues
  • packages/opencode/src/kilocode/balance-refresh.ts - 0 issues
  • packages/opencode/src/kilocode/kilo-commands.tsx - 0 issues
  • packages/opencode/src/kilocode/plugins/sidebar-footer.tsx - 1 issue
  • packages/opencode/test/kilocode/sidebar-footer.test.ts - 0 issues

Previous review (commit cc73bec)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (5 files)
  • .changeset/cli-sidebar-balance.md
  • packages/opencode/src/kilocode/balance-refresh.ts
  • packages/opencode/src/kilocode/kilo-commands.tsx
  • packages/opencode/src/kilocode/plugins/sidebar-footer.tsx
  • packages/opencode/test/kilocode/sidebar-footer.test.ts

Previous review (commit 2c36953)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0

Fix these issues in Kilo Cloud

Issue Details (click to expand)

WARNING

File Line Issue
packages/opencode/src/kilocode/kilo-commands.tsx 233 Team switching continues down the success path after organization.set() returns { error }, so the toast and balance refresh can claim the account changed when it did not.
Files Reviewed (5 files)
  • .changeset/cli-sidebar-balance.md - 0 issues
  • packages/opencode/src/kilocode/balance-refresh.ts - 0 issues
  • packages/opencode/src/kilocode/kilo-commands.tsx - 1 issue
  • packages/opencode/src/kilocode/plugins/sidebar-footer.tsx - 0 issues
  • packages/opencode/test/kilocode/sidebar-footer.test.ts - 0 issues

Previous review (commit 1bae269)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0

Fix these issues in Kilo Cloud

Issue Details (click to expand)

WARNING

File Line Issue
packages/opencode/src/kilocode/plugins/sidebar-footer.tsx 98 refresh() can apply profile responses out of order, so an older poll can overwrite the newly selected account's balance and org state.
Files Reviewed (5 files)
  • .changeset/cli-sidebar-balance.md - 0 issues
  • packages/opencode/src/kilocode/balance-refresh.ts - 0 issues
  • packages/opencode/src/kilocode/kilo-commands.tsx - 0 issues
  • packages/opencode/src/kilocode/plugins/sidebar-footer.tsx - 1 issue
  • packages/opencode/test/kilocode/sidebar-footer.test.ts - 0 issues

Previous review

Status: 2 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 2
SUGGESTION 0

Fix these issues in Kilo Cloud

Issue Details (click to expand)

WARNING

File Line Issue
packages/opencode/src/kilocode/plugins/sidebar-footer.tsx 53 resetLabel() formats nextBillingAt in the local timezone, which can show the wrong renewal day outside UTC.
packages/opencode/src/kilocode/plugins/sidebar-footer.tsx 126 data().balance ?? 0 renders $0.00 when the balance fetch failed and returned null.
Files Reviewed (5 files)
  • .changeset/cli-sidebar-balance.md - 0 issues
  • packages/opencode/src/kilocode/balance-refresh.ts - 0 issues
  • packages/opencode/src/kilocode/kilo-commands.tsx - 0 issues
  • packages/opencode/src/kilocode/plugins/sidebar-footer.tsx - 2 issues
  • packages/opencode/test/kilocode/sidebar-footer.test.ts - 0 issues

Reviewed by gpt-5.4-20260305 · Input: 51.9K · Output: 5.8K · Cached: 213.5K

Review guidance: REVIEW.md from base branch main

@johnnyeric johnnyeric force-pushed the johnnyeric/balance-cli-tui branch 2 times, most recently from 309c40c to 1bae269 Compare June 26, 2026 12:10
Comment thread packages/opencode/src/kilocode/plugins/sidebar-footer.tsx Outdated
@johnnyeric johnnyeric force-pushed the johnnyeric/balance-cli-tui branch from 1bae269 to 2c36953 Compare June 26, 2026 13:39
Comment thread packages/opencode/src/kilocode/kilo-commands.tsx
@johnnyeric johnnyeric force-pushed the johnnyeric/balance-cli-tui branch from 2c36953 to cc73bec Compare June 26, 2026 13:58
@chrarnoldus

Copy link
Copy Markdown
Collaborator

How often does this refresh? We used to have this in the old extension, but removed it because we felt it was hammering the backend too much.

@johnnyeric

Copy link
Copy Markdown
Contributor Author

Currently every minute, but we can increase the interval

@johnnyeric

Copy link
Copy Markdown
Contributor Author

I will remove the timer and update based on events only like session turn end, /teams change, and load.

@johnnyeric johnnyeric force-pushed the johnnyeric/balance-cli-tui branch from cc73bec to feb0844 Compare June 29, 2026 11:03
Comment thread packages/opencode/src/kilocode/plugins/sidebar-footer.tsx Outdated
@johnnyeric johnnyeric force-pushed the johnnyeric/balance-cli-tui branch from feb0844 to 0b808fc Compare June 29, 2026 11:17
@johnnyeric johnnyeric force-pushed the johnnyeric/balance-cli-tui branch from 0b808fc to 6058164 Compare June 29, 2026 11:28
@johnnyeric johnnyeric merged commit 7d64eb7 into main Jun 29, 2026
27 checks passed
@johnnyeric johnnyeric deleted the johnnyeric/balance-cli-tui branch June 29, 2026 12:08
vkeerthivikram pushed a commit to vkeerthivikram/kilocode that referenced this pull request Jun 30, 2026
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