Claude CLI source drops "Current week (all models)" when /usage redraws over earlier screen content

Open
#5,143 1 comment 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
30/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
macos, swift
Domain
cli

Research direction

Start with ClaudeCLIScreen replay and weeklyModelName(from:) in the Claude status probe, and see how ClaudeStatusProbe.parse consumes the captured /usage bytes. Reproduce by replaying the saved bytes through parse to confirm weekly=-1 and the Fable-only extra window. Done means the all-models weekly window parses from a capture that starts mid-session, while the full-stream capture still gives weekly=47. Pick one of the three fixes in the issue first, since the thread does not settle which.

Written by the indexing model from the issue text.

Description

clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P2

Summary

With the Claude CLI source, CodexBar shows only the "Fable only" weekly bar. It drops the all-models weekly window, although /usage shows it.

Environment

  • CodexBar 0.84.0 (Homebrew), macOS 27.2, Apple Silicon
  • Claude Code 2.1.330, Ultra plan (weekly limits only, no session row)
  • Source: Auto. OAuth fails with "Claude Code credentials changed … Click Refresh", so Auto falls back to the CLI.

What happens

codexbar usage --provider claude --source cli --json returns primary: null, secondary: null, and one extra window, claude-weekly-scoped-fable (8% used). The probe log reads sessionPercentLeft=-1 weeklyPercentLeft=-1.

/usage in the same probe directory shows:

Current week (all models)
██████████████████████████▌                        53% used
Resets Nov 24 at 4:59am (America/Los_Angeles)
Current week (Fable)
████                                               8% used

Cause

The capture starts when /usage is sent. Claude Code's renderer writes only the cells that differ from the screen it already shows, and that screen predates the capture. ClaudeCLIScreen replays the capture onto a blank screen, so those unchanged cells stay blank. The captured bytes for the label row are:

ESC[3GCur ESC[7Gent week (all models)

The column-6 "r" is never written, and the replayed line reads Cur ent week (all models). weeklyModelName(from:) requires current\s*week\s*\(, so the line is never recognized. The fuzzy all-models match in matchesLabel runs only after that regex matches, so it never runs here. The Fable row is drawn later on rows that were blank, so it survives. Other labels lose characters the same way: Conf g, S ats, Re ets.

Reproduced on 0.84.0 and on main at 5dd48ca by replaying the saved /usage bytes through ClaudeStatusProbe.parse: weekly=-1, extra=["Fable only 8.0"]. A capture of the full PTY stream from process start parses correctly (weekly=47) with the same parser.

Possible fixes

  • Feed the pre-/usage output into the ClaudeCLIScreen replay, so the diff redraw lands on the real prior screen.
  • Or force a full repaint before capturing, for example by sending a redraw or clearing the screen before /usage.
  • Or make weeklyModelName tolerate one dropped character in "current week", as matchesLabel already does for "all models".

The capture also included a "Refreshing usage…" redraw that changed only the percent digit (52% to 53%), so the same replay gap can also report a stale percent.

Dominant language
Swift
Stars
23.3k
Forks
2.2k
Avg merge
1d 18h
Merged PRs (30d)
231

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from steipete/CodexBar

All issues in steipete/CodexBar

Similar issues

More Swift issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.