Skip to content

fix: keep AI usage working when only Claude Code or Codex is signed in - #29

Merged
M4n0x merged 2 commits into
mainfrom
fix/ai-usage-one-provider
Nov 1, 2026
Merged

M4n0x merged 2 commits into
mainfrom
fix/ai-usage-one-provider

Conversation

@M4n0x

@M4n0x M4n0x commented Nov 1, 2026 •

Copy link
Copy Markdown
Collaborator

Package

AI usage 1.2.6. With the default Providers: both, the widget failed when only one of Claude Code and Codex was signed in on the Mac. On a Mac with only Claude Code it stopped at cat ~/.codex/auth.json, on one with only Codex at the Keychain read, and the bar showed an error instead of the provider that works. #28 lists this package for StableBar's setup to suggest to anyone with claude or codex (stablebox/StableBar#405), so it has to work for people who use just one.

Changes

  • usage.sh: with both, a provider that isn't signed in is skipped and the widget shows the other. The bar and the popup already hide a provider without data (hideWhenEmpty on claudePlan and codexPlan), so config.json doesn't change. With neither signed in, it fails with "Neither Claude Code nor Codex is signed in on this Mac."
  • A provider chosen alone (claude or codex) still fails without its sign-in, now with a sentence that says so instead of the error from security or cat.
  • For Claude, "not signed in" means security exit status 44, item not found. Any other failure, such as denied Keychain access, still fails, with "StableBar couldn't read Claude Code's sign-in from the Keychain.", so a denied prompt doesn't quietly hide Claude.
  • Manifest: version 1.2.6.
  • Preview: 520 × 144 instead of 523 × 144, the size CONTRIBUTING.md asks for, which CI is about to check. The widget runs edge to edge, so it's resized, 0.6% narrower, rather than cropped, which would cut the ends of the pill.

Access

Unchanged: the same Keychain item (Claude Code-credentials), the same ~/.codex/auth.json, the same hosts (api.anthropic.com, chatgpt.com), nothing in requires and no permissions. The script reads the Keychain item once, as before, and adds a check that ~/.codex/auth.json exists before reading it.

Testing

  • STABLEBAR=…/StableBar.app/Contents/MacOS/StableBar ./scripts/check-package.sh packages/ai-usage, with StableBar main (cdafc4b) built by its ./scripts/build.sh: inspect, install into a scratch configuration and validate pass ("Valid configuration: 1 widgets in 5 files").

  • The script offline, with fake security and curl on the PATH and a scratch HOME:

    Providers Claude Code Codex Before After
    both signed in signed in both shown both shown
    both signed in not signed in error from cat Claude shown
    both not signed in signed in error from security (44) Codex shown
    both not signed in not signed in error from security "Neither Claude Code nor Codex is signed in on this Mac."
    both access denied signed in error from security "StableBar couldn't read Claude Code's sign-in from the Keychain."
    claude not signed in signed in error from security "Claude Code isn't signed in on this Mac. …"
    codex signed in not signed in error from cat "Codex isn't signed in on this Mac. …"

    claude and codex with their sign-in still show that provider. When one provider is skipped, the output is valid JSON with only the other provider's fields and list.

  • ShellCheck 0.11.0 passes, and ./scripts/update-readme.sh leaves the README unchanged.

  • Not checked: the real Keychain and APIs, or the widget on a bar. The fakes return the shapes the script parses, and the parsing code didn't change.

Claude Opus 5.5 via Claude Code

The widget runs edge to edge in the 523 × 144 preview, so it's resized (0.6% narrower) rather than cropped, which would cut the ends of the pill.
@M4n0x
M4n0x merged commit c981312 into main Nov 1, 2026
3 checks passed
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