A named Claude login reads its own token; the CLI's estimate stays with the only login - #324
Merged
vinzdg merged 1 commit intoSep 23, 2026
Conversation
…th the only login `claude /usage` in print mode gives one answer for the whole machine whatever CLAUDE_CONFIG_DIR says (verified: identical output, requests and sessions included, for ~/.claude and a second config directory). With two logins on a Mac it painted both rings with the same figure. The estimate is now taken only for the default login, and only while it is the sole one. Named profiles, and the default profile once a second one exists, read their own token over the OAuth usage endpoint as before the CLI path was added. The rule is a pure function so it has a test; the login count itself is fixed at one under test so the CLI stubs stay reachable whatever the host Mac has. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This was referenced Sep 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
On a Mac with two Claude logins (
~/.claudeand a secondCLAUDE_CONFIG_DIR), both rings showed the same percentage.claude /usagein print mode answers for the whole machine, whateverCLAUDE_CONFIG_DIRis set to. Verified: identical output, requests and sessions included, for both directories. Its estimate is "based on local sessions on this machine", all of them, so it can only stand in for a ring while there is one login for it to describe.ClaudeOAuthProvider.cliEstimateApplies(slug:loginCount:): the CLI path is taken only for the default login, and only while it is the sole one.Tests
ClaudeCLIEstimateScopeTests: only login may use the estimate; a named profile never does; the default login stops once a second exists.make test: 1737 tests, 0 failures.Related to #321, which handles the other half of the two-login problem (desktop sessions landing on the wrong ring); the two do not overlap in code.
🤖 Generated with Claude Code