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

Aperta
#5,143 1 commento 1 reazione 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
30/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
macos, swift
Ambito
cli

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Swift
Stelle
23.3k
Fork
2.2k
Merge medio
1g 18h
PR unite (30g)
231

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di steipete/CodexBar

Tutte le issue di steipete/CodexBar

Issue simili

Altre issue su Swift

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.