anthropics / anthropics/claude-code

[BUG] Current session" usage shows high % on a fresh session despite ~12h of prior inactivity; confirmed at account level (claude.ai), not just local CLI display

Đang mở
#91,467 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
area:cost bug platform:macos
Ngôn ngữ chính
Python
Star
145k
Fork
23.1k
Chỉ số merge pull request
Chỉ số pull request đang chờ

Mô tả

### Preflight Checklist

- [x] I have searched [existing issues](https://github.com/anthropics/claude-code/issues?q=is%3Aissue%20state%3Aopen%20label%3Abug) and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code

### What's Wrong?

Opened a brand-new Claude Code terminal session. The local /usage screen immediately showed:

Current session: 70% used
Resets 2:50pm (Europe/Berlin)

But the same /usage screen's own local session stats for that terminal instance read:

Total cost: $0.0000
Total duration (wall): 8s
Total code changes: 0 lines added, 0 lines removed

So this specific terminal instance had done essentially nothing, yet the session bar was already at 70%.

Last actual Claude usage before opening this session was approximately 12 hours earlier. Since the "current session" is documented as a rolling 5-hour window starting from the first message, a gap of ~12h should mean any prior window had already closed, and a new message should start a fresh window near 0%.

To rule out a purely local/CLI display bug, I checked claude.ai > Settings > Usage independently. It also shows elevated session usage (89% used at time of screenshot, "Resets in 2 hr 15 min"), confirming this is not just a stale/local counter in the CLI, the account-wide usage endpoint agrees.

### What Should Happen?

A fresh 5-hour rolling session window should start near 0% usage when there has been no activity in the preceding 5+ hours.

Actual Behavior
Session shows substantial usage (70%, later 89%) despite the described multi-hour gap in activity.

Environment
- Plan: Max (5x)
- Timezone: Europe/Berlin
- Claude Code (local /usage) and claude.ai web (Settings > Usage) both checked

Image

Image

### Error Messages/Logs

```shell

```

### Steps to Reproduce

1. Use Claude (any surface: claude.ai, Claude Code, etc.) normally, then stop using it entirely.
2. Wait approximately 12 hours with no further usage on any device or surface.
3. Open a brand-new Claude Code terminal session and run any command (e.g. a trivial prompt).
4. Immediately check `/usage` in the CLI.

Expected: Since the "current session" is a rolling 5-hour window starting from the first message, and it's been ~12h since any activity, the new window should start near 0%.

Observed: The CLI /usage screen showed "Current session: 70% used" immediately, despite this terminal instance's own local stats showing:
Total cost: $0.0000
Total duration (wall): 8s
Total code changes: 0 lines added, 0 lines removed

5. To rule out a local/CLI-only display bug, independently checked claude.ai > Settings > Usage on the same account.
Result: also showed elevated session usage (89% used, "Resets in 2 hr 15 min"), confirming the discrepancy exists at the account level, not just in the local CLI display.

### Claude Model

None

### Is this a regression?

Yes, this worked in a previous version

### Last Working Version

_No response_

### Claude Code Version

Current version: 2.1.258

### Platform

Anthropic API

### Operating System

macOS

### Terminal/Shell

Terminal.app (macOS)

### Additional Information

_No response_

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Reproduce the report by waiting through the stated inactivity period, opening a new Claude Code terminal, and checking /usage. Compare those results with claude.ai > Settings > Usage to determine whether both surfaces show the same session state. Done means the new rolling session reports near-zero usage after the inactive period, consistently across both surfaces.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
macos
Lĩnh vực
api, cli
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.