Skip to content

fix(statusline): show the 7-day quota alone when the plan has no 5-hour limit - #18

Merged
AnnatarHe merged 1 commit into
mainfrom
fix/hide-missing-5h-quota
Nov 19, 2026
Merged

AnnatarHe merged 1 commit into
mainfrom
fix/hide-missing-5h-quota

Conversation

@AnnatarHe

@AnnatarHe AnnatarHe commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Some Claude plans no longer have a 5-hour limit. Anthropic's usage API returns "five_hour": null for them, so Claude Code reports only a seven_day rate limit. quotaSegment needed both windows, so the 🚦 segment showed - even though the 7-day figure was there.

Fix

quotaSegment builds its value and meters from the windows that are present:

  • terminal: 🚦 7d:45% (or 🚦 5h:55%), colored by the highest window shown
  • desktop: one bar per window present
  • - only when there are none, still linked to claude.ai usage

This matches shelltime cc statusline after shelltime/cli#354.

Testing

  • segments.test.ts: 7d-only and 5h-only segments, their colors and meters.
  • register.test.ts: an engine that reports only seven_day draws 🚦 7d:45% in the terminal and a single quota bar on desktop. world() now takes the rate limits as a parameter.
  • New noFiveHour fixture, with NoFiveHour stories for Terminal and Desktop, plus terminal and desktop spec checks.
  • claude plugin test plugins/shelltime-statusline: 37 pass. pnpm test: 33 pass. pnpm typecheck is clean. claude plugin validate passes, with only its usual hooks-module warning.
  • tsc -p plugins/shelltime-statusline still reports one error in hooks/sessionEnd.test.ts. That error is also on main, and this PR doesn't touch the file.

🤖 Generated with Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…ur limit

Plans without a 5-hour limit report no five_hour rate limit, and the
quota segment needed both windows, so it showed "🚦 -". It now shows the
windows it has ("🚦 7d:45%", one bar on desktop), colored by the highest,
and a dash only with neither, as `shelltime cc statusline` does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-19T14:23:20.001976Z b0c5c12 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@shelltime

shelltime Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

🤖 Claude Code · Make five-hour usage limits optional in status displays

Updated Claude/ChatGPT usage handling so five-hour limit information is only shown when the provider API actually reports that limit.

💰 Cost 🔢 Tokens ⏱️ Duration 🧠 Models 💬 Prompts ✏️ Lines
$3.42 7.5M 13m (8m active) claude-opus-5-5, claude-haiku-5-5 3 +115 / −79

7.5M tokens: 1.9K input · 36.2K output · 7.3M cache read · 152K cache write

📝 AI summary

Reworked rate-limit and status data handling across the CLI daemon, including cli/daemon/anthropic_ratelimit.go, cc_info_timer.go, and socket.go, to support accounts or plans where a five-hour usage window is absent. The Claude Code statusline command in cli/commands/cc_statusline.go was updated to conditionally render five-hour usage rather than assuming it always exists.

Applied the corresponding behavior to the adjacent Claude Code plugin in claude-code-mods/plugins/shelltime-statusline/hooks/segments.ts. Updated both Go and TypeScript tests (cc_statusline_test.go and segments.test.ts) to cover conditional display behavior and validate usage output when the five-hour limit is unavailable.

View this session on ShellTime →

Updated 2026-11-20 14:21 UTC by ShellTime · totals for the whole session so far · the session page is visible to its owner

@AnnatarHe
AnnatarHe merged commit 3109c58 into main Nov 19, 2026
1 of 3 checks passed
@AnnatarHe
AnnatarHe deleted the fix/hide-missing-5h-quota branch November 19, 2026 14:26
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.

1 participant