Repository navigation
Conversation
[Medium impact] The change affects Claude Code usage and account status in the agents panel. The previous visibility issue remains partly unfixed, so this PR still needs a change before merging. Findings
SummaryRemoves unnecessary sign-in prompts when Claude Code has a configured API key.
Reviews (8) · Last reviewed commit: "Count registered Claude accounts as Clau..." · Reviewed by Greptile |
|
Reviewed at fac7cc7 and found nothing to change. The bug is real. On a disposable Omarchy VM running current
Codex Medium gave a second opinion and found no defects: the Claude fallback only replaces the two sign-in statuses, both of which return before any network call or cache write, and the Codex Nothing is waiting on you. It is with the maintainer now. |
Claude Code signed in with an API key (pay as you go through the Anthropic Console) has no OAuth credentials, so the collector reported Waiting for auth and the panel asked for a sign-in the key makes unnecessary. Where the subscription would ask for one (there is none, or it expired), a key configured for the CLI now stands in, as omacom#14040 has Codex do: no plan, not even the one a registered account was saved with, no limits, nothing to sign in to, and the same note. The key is the CLI's own, an apiKeyHelper or env block in its user settings, or its exported variables, with the settings' env block applied over them and an ANTHROPIC_API_KEY the CLI was told not to use left out, as Claude Code does. Only whether a key is configured is checked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fac7cc7 to
674d795
Compare
| # network. | ||
| def with_api_key(claude_dir: Path, plan: str, limits: dict[str, Any]) -> tuple[str, dict[str, Any]]: | ||
| if limits["usageStatusText"] in SIGN_IN_STATUSES and api_key_login(claude_dir): | ||
| return "", {"limits": [], "usageStatusText": "", "authHelpText": API_KEY_HELP, "live": True, "fetchedAtMs": 0, "apiKey": True} |
There was a problem hiding this comment.
Before the first session, with_api_key returns an empty plan and no limits, while main leaves ready false without local usage. providerHasData then drops Claude Code from the panel. After a session, it appears but still has no “API key” label: planLabel receives the empty plan, and the empty status hides the help text.
Return a visible API-key tier and mark this login ready, including for registered accounts.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
The label stays empty, as the collector contract #14040 added (docs/agent-usage-collectors.md) has it: tierLabel is the plan as the service names it, never a placeholder, and a login without plan limits shows no status. That leaves a single key-only login with no local usage unlisted, the same as a Codex API-key login on quattro. Readiness now counts credentials as the contract does: where Claude Code is set up, a configured key or two or more registered accounts make the record ready (35b6504, 8a3de67).
There was a problem hiding this comment.
You're right. I conflated record readiness with panel visibility, and recommending an “API key” tier would violate the collector contract. The updated readiness handles configured keys and registered accounts; a key-only login with no local usage and no plan is intentionally unlisted, matching Codex. I withdraw the finding.
The collector contract makes a record ready once the agent is in use on the machine, by a credential or by local usage, and a key standing in for the sign-in is a credential. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each registered account is a credential, which makes the record ready under the collector contract, as Codex's already is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Problem
Claude Code can be signed in with an API key instead of a Claude subscription: a
primaryApiKeyin~/.claude.json, anapiKeyHelperor a key in theenvblock of~/.claude/settings.json, orANTHROPIC_API_KEY/ANTHROPIC_AUTH_TOKENin its environment. That login needs no OAuth credentials, and with none saved,omarchy-agent-usage-claudereportsWaiting for auth, so the agents panel shows Sign-in required under Claude Code even though it works.Fix
Where the subscription would ask for a sign-in (there is none, or it expired), a configured key stands in, the way #14040 handles a Codex API-key login: no plan, no limits and no status. A subscription that isn't asking for a sign-in keeps its plan. The environment checked is the desktop session's, which the panel runs in, and as in Claude Code, the settings'
envblock is applied over it, and anANTHROPIC_API_KEYClaude Code was told not to use doesn't count. Registered accounts read the same way. Only whether a key is configured is checked; the key itself is never recorded.Testing
agent-usage-claude-limits: a key stands in for a missing or expired sign-in and never reaches the record; a refreshable subscription keeps its plan; an exported key counts unless the settings'envblock empties it or Claude Code was told not to use it.agent-usage-accounts: an account on its key has no plan, not even the one its registry entry kept.agent-usage-claude-plan,agent-usage-claude-scanner,agent-usage-partition).quattro's collector reportsWaiting for auth, and this branch's no status.🤖 Generated with Claude Code