v0.5.7 — Recover terminal width + guard upstream rate_limits bug
Recover the terminal width that Claude Code hides — and guard against an upstream rate-limits bug
Two upstream Anthropic bugs that affect every claude-status user, fixed in one focused release. Most user-visible improvement since v0.5.4.
1. Terminal width recovery
Claude Code spawns the statusLine subprocess with stdin piped — no TTY, no `COLUMNS` env — so naive `shutil.get_terminal_size()` always returns the fallback `(100, 24)`. Result: every user with a terminal wider than 100 cols saw Line 2 silently trimmed even when there was room to spare.
v0.5.7 walks a 7-step fallback chain until one returns a plausible value: stdin `terminal.columns` (forward-compat for whenever Anthropic ships it) → `COLUMNS` env → `shutil.get_terminal_size` → `os.get_terminal_size(fd)` for stderr/stdout/stdin → `stty size < /dev/tty` → `tput cols 2>/dev/tty` → existing fallback. Plausible-range guard `[20, 4000]` covers ultrawide / 8K / multi-monitor tmux setups.
End-to-end win for a 165-col terminal: Line 2 grows from 5 sections (~83 chars) to 11 sections (~137 chars). Previously hidden: rate_limits, context_size, clock, effort, version, last:N, style:N, dirs:+N — all recovered automatically.
Tracked upstream at anthropics/claude-code#22115 — open since January 2026, no upstream fix.
2. Defensive guard against upstream rate_limits bug
anthropics/claude-code#52326 — still open. On a fresh 5h or 7d window with no usage data yet, Claude Code returns the `resets_at` epoch timestamp (~1.7e9) in `used_percentage` instead of 0/null. v0.5.6 and earlier silently turned this into a false `5h:100% (red)` alarm on every fresh session for Pro/Max subscribers.
v0.5.7 detects the bug pattern (values >= 1e6) and hides the section — matching what Anthropic should send. Values 101-999999 still flow through to the existing clamp(0,100) so a future "overage" indicator above 100% wouldn't be silently swallowed.
Diagnostics
`--doctor` now reports both the naive `shutil` width and the detected fallback width side-by-side:
```
Terminal:
TERM: xterm-256color
Columns: 165 (shutil naive: 100)
Layout: full (>= 150 cols)
```
Try it
```
pip install -U claude-status
```
No restart of Claude Code needed for an upgrade — Claude Code re-runs the installed binary on every render cycle, so the wider Line 2 appears immediately.
Tests
352 total (was 332, +18 new + 2 updated to match the new clamp/drop semantics). All Linux/macOS/Windows × Python 3.8-3.14 CI jobs green. 4 internal review agents + Gemini consulted before merge.
Closes: #79