fix(cli): keep the wallet-balance readout fresh with a periodic refresh - #7914
Open
JPShag wants to merge 1 commit into
Open
fix(cli): keep the wallet-balance readout fresh with a periodic refresh#7914JPShag wants to merge 1 commit into
JPShag wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a periodic wallet-balance refresh to the CLI TUI so the BAL status-line readout stays up to date even if turn_done is missed or a long delivery-mode turn has no boundary.
Changes:
- Introduces a 60s periodic
balanceTickMsg(tea.Tick) and wiring inInit/Updateto fetch balance and re-arm the timer. - Factors the tick’s work into
balanceRefreshCmds()to make the behavior testable without waiting for real time. - Adds unit tests covering the tick fetch, Update wiring, and Init scheduling; updates repolint baseline ratchet values.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| internal/cli/chat_tui.go | Adds periodic balance tick message, scheduling, and helper commands for refresh + re-arm. |
| internal/cli/statusline_test.go | Adds tests ensuring periodic refresh fetches a fresh balance and is scheduled by Update/Init. |
| tools/repolint/baseline.json | Updates repolint baseline numbers to account for the small size/complexity increase. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| // readout stays current during long delivery turns or when a TurnDone is | ||
| // missed (no turn boundary resets the display). | ||
| func balanceRefreshTick() tea.Cmd { | ||
| return tea.Tick(balanceRefreshInterval, func(time.Time) tea.Msg { return balanceTickMsg{} }) |
Author
There was a problem hiding this comment.
Unnamed parameters are valid in Go function literals when unused (ParameterDecl allows omitting the name). This matches go build / go test locally. elapsedTick uses _ by convention only both forms compile. Resolving as incorrect.
JPShag
force-pushed
the
fix/cli-balance-periodic-refresh
branch
from
August 8, 2026 00:15
0382709 to
b9a41d7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The DeepSeek wallet-balance (
BAL) readout in the CLI status line only refreshed at startup, at turn end, and after a model switch. A missedturn_done— the event-loss the desktop already guards against — or a long delivery-mode turn with no turn boundary froze the readout at the startup value for the rest of the session.This adds a periodic refresh: the TUI re-queries the provider balance every 60s and re-arms the timer, independent of event delivery, so
BALstays roughly current even when no turn ends.Changes
internal/cli/chat_tui.go:balanceTickMsg+balanceRefreshTickperiodic timer armed atInit; the tick fetches a fresh balance and re-arms;balanceRefreshCmdskeeps the fetch/re-arm work testable.internal/cli/statusline_test.go: coverage that a balance tick fetches a fresh balance and re-arms, thatUpdatewires the tick, and thatInitarms the timer.tools/repolint/baseline.json: bumped onlychat_tui.go(complexity 301→302, file-size 4558→4589, function-size 1203→1206); the file sits at its ratchet ceiling.Verification
go test ./internal/cli/ -run TestBalance -count=1passesgo test ./internal/cli/ -count=1(no new failures; pre-existingTestModelSwitchRefreshesCustomStatuslinealso fails on a clean checkout)go test ./internal/tool/builtin/ ./internal/boot/ -count=1passesgo vet ./internal/cli/andgo build ./...cleango run ./tools/repolintcleanDocumentation-impact: none - user-visible change confined to the CLI status-line refresh cadence; no docs describe when the BAL readout updates, and its meaning is unchanged.