Skip to content

Fix enterprise account failures and add Org ID field (#940) - #941

Merged
steipete merged 3 commits into
steipete:mainfrom
clintandrewhall:claude/fix-codexbar-940-L3G1E
May 14, 2026
Merged

Fix enterprise account failures and add Org ID field (#940)#941
steipete merged 3 commits into
steipete:mainfrom
clintandrewhall:claude/fix-codexbar-940-L3G1E

Conversation

@clintandrewhall

Copy link
Copy Markdown
Contributor

Summary

Fixes #940 — enterprise/organization Claude accounts always fail with "Invalid response from Claude API".

  • Parser crash on null quota fields: Enterprise credit-based accounts return null for five_hour (and seven_day) instead of utilization data. The parser was throwing FetchError.invalidResponse when five_hour was absent/null. Now defaults sessionPercentUsed to 0.0 so enterprise accounts load correctly.
  • Missing Org ID UI field: The preferences UI had no way to enter an organizationID for accounts linked to multiple Anthropic organizations, forcing users to manually edit JSON config. Added an optional "Org ID" text field to the Claude token account entry form, wired through to addTokenAccount(organizationID:).

Changes

  • ClaudeWebAPIFetcher.swift — replace guard-throw with ?? 0.0 default for missing session utilization
  • ProviderSettingsDescriptors.swift — add showsOrganizationField: Bool; update addAccount closure to accept optional organizationID
  • PreferencesProviderSettingsRows.swift — show "Org ID (optional)" text field when showsOrganizationField is true; pass value to addAccount
  • PreferencesProvidersPane.swift — enable org field for Claude provider; forward organizationID to addTokenAccount
  • PreferencesProvidersPane+Testing.swift — update mock descriptor to match new signature

Test plan

  • Add a Claude web session key account — verify Label, Token, and Org ID fields appear; submitting with a blank Org ID creates an account with no org override
  • Add a Claude account with an Org ID — verify the value is saved and used when fetching usage
  • With an enterprise Claude session key, verify usage fetches successfully (no "Invalid response" error) and sessionPercentUsed shows 0%
  • Non-Claude token account providers (e.g. Copilot) should not show the Org ID field

https://claude.ai/code/session_01YQotcG4rFPbYNkyZLt94hr


Generated by Claude Code

- Default sessionPercentUsed to 0.0 when five_hour is null (enterprise/credit
  accounts return null for rate-window fields instead of utilization data)
- Add optional Org ID text field to Claude token account entry UI so users
  with multiple organizations can select their target org without editing JSON

https://claude.ai/code/session_01YQotcG4rFPbYNkyZLt94hr

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cdb0a8f442

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread Sources/CodexBar/PreferencesProviderSettingsRows.swift Outdated
claude and others added 2 commits May 13, 2026 19:18
@steipete
steipete merged commit 34d9b18 into steipete:main May 14, 2026
1 check passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 04a270f3da

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +491 to +492
// Enterprise/credit-based accounts return null for five_hour; treat as 0% rather than an error.
let resolvedSessionPercent = sessionPercent ?? 0.0

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve parse failure when session window is absent

parseUsageResponse now treats any missing/unparseable five_hour window as 0.0 usage, not just the enterprise null case. That means malformed or schema-shifted 200 responses can be accepted as success, and StepExecutor.executeAuto will not fall back to CLI because no error is thrown on the web step. In those cases users can get a false 0% session reading instead of the previous fallback behavior. Consider limiting the default-to-zero path to explicit five_hour: null and still throwing for absent/invalid window structures.

Useful? React with 👍 / 👎.

steipete added a commit that referenced this pull request May 14, 2026
* Improve Kiro credits UX

* Add provider changelog links

* Fix changelog menu test

* feat: gate provider changelog links behind setting

* Address Kiro review feedback

* Polish Kiro credit detail styling

* fix: repair stale managed Codex account removal

* fix: handle Claude enterprise web accounts (#941)

Fixes Claude Enterprise/organization web accounts by tolerating null session-window usage and exposing an optional organization ID field for Claude token accounts.

Local verification:
- swift test --filter 'ClaudeWebEnterpriseUsageTests|ProvidersPaneCoverageTests|ClaudeUsageTests'
- make check

Co-authored-by: Claude <noreply@anthropic.com>

* docs: update changelog for Claude enterprise fix

* fix: handle quota and usage edge cases

* Rebalance Kimi provider icon (#912)

* Add zh-Hans translations for Claude peak hour labels (#921)

* docs: update changelog for recent contributor fixes

* Add Tahoe menu bar visibility guidance

Co-authored-by: Piotr Durlej <pdurlej@users.noreply.github.com>

* Coalesce historical pace reset buckets

Co-authored-by: zhulijin1991 <zhulijin1991@users.noreply.github.com>

* Add Codex priority cost pricing

Co-authored-by: Bryan Font <bfont@me.com>

* fix: parse Claude web spend limits

* fix: refresh Gemini credentials without access token

* refactor: split Claude web extra usage helpers

* fix: defer account switcher menu rebuilds

Fixes #944.

Refs #946.

Co-authored-by: Jakub Hašek <kubahasek@users.noreply.github.com>

* docs: fix changelog spacing

* fix: handle unavailable Codex limits gracefully

* docs: update unreleased changelog

* fix: repair update and account menu paths

Co-authored-by: Radek Sienkiewicz <mail@velvetshark.com>

* fix: handle account-scoped usage and menu login bugs

* Add Antigravity account switching (#937)

* Add Antigravity account switching

* Force Antigravity account chooser

* Persist Antigravity selected account updates

* docs: add Antigravity account switching changelog

---------

Co-authored-by: thiagocaltoe <thiago12_fera@hotmail.com>
Co-authored-by: Peter Steinberger <steipete@gmail.com>
Co-authored-by: Clint Andrew Hall <clint@clintandrewhall.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Giuseppe Bisemi <giuseppe.bisemi@gmail.com>
Co-authored-by: HaiTao Wu <whtis@users.noreply.github.com>
Co-authored-by: Piotr Durlej <pdurlej@users.noreply.github.com>
Co-authored-by: zhulijin1991 <167979819+zhulijin1991@users.noreply.github.com>
Co-authored-by: zhulijin1991 <zhulijin1991@users.noreply.github.com>
Co-authored-by: iam-brain <94809115+iam-brain@users.noreply.github.com>
Co-authored-by: Bryan Font <bfont@me.com>
Co-authored-by: Jakub Hašek <kubahasek@users.noreply.github.com>
Co-authored-by: Radek Sienkiewicz <mail@velvetshark.com>
Co-authored-by: Larry Hao(郝卓远) <107194248+hhh2210@users.noreply.github.com>
@clintandrewhall

Copy link
Copy Markdown
Contributor Author

Thanks for the quick turnaround, @steipete -- I don't typically write in Swift, but I thought it was a simple enough fix that I could leave it to Claude. Hope it helped!

LeoLin990405 pushed a commit to LeoLin990405/CodexBar that referenced this pull request Aug 6, 2026
Fixes Claude Enterprise/organization web accounts by tolerating null session-window usage and exposing an optional organization ID field for Claude token accounts.

Local verification:
- swift test --filter 'ClaudeWebEnterpriseUsageTests|ProvidersPaneCoverageTests|ClaudeUsageTests'
- make check

Co-authored-by: Claude <noreply@anthropic.com>
LeoLin990405 pushed a commit to LeoLin990405/CodexBar that referenced this pull request Aug 6, 2026
* Improve Kiro credits UX

* Add provider changelog links

* Fix changelog menu test

* feat: gate provider changelog links behind setting

* Address Kiro review feedback

* Polish Kiro credit detail styling

* fix: repair stale managed Codex account removal

* fix: handle Claude enterprise web accounts (steipete#941)

Fixes Claude Enterprise/organization web accounts by tolerating null session-window usage and exposing an optional organization ID field for Claude token accounts.

Local verification:
- swift test --filter 'ClaudeWebEnterpriseUsageTests|ProvidersPaneCoverageTests|ClaudeUsageTests'
- make check

Co-authored-by: Claude <noreply@anthropic.com>

* docs: update changelog for Claude enterprise fix

* fix: handle quota and usage edge cases

* Rebalance Kimi provider icon (steipete#912)

* Add zh-Hans translations for Claude peak hour labels (steipete#921)

* docs: update changelog for recent contributor fixes

* Add Tahoe menu bar visibility guidance

Co-authored-by: Piotr Durlej <pdurlej@users.noreply.github.com>

* Coalesce historical pace reset buckets

Co-authored-by: zhulijin1991 <zhulijin1991@users.noreply.github.com>

* Add Codex priority cost pricing

Co-authored-by: Bryan Font <bfont@me.com>

* fix: parse Claude web spend limits

* fix: refresh Gemini credentials without access token

* refactor: split Claude web extra usage helpers

* fix: defer account switcher menu rebuilds

Fixes steipete#944.

Refs steipete#946.

Co-authored-by: Jakub Hašek <kubahasek@users.noreply.github.com>

* docs: fix changelog spacing

* fix: handle unavailable Codex limits gracefully

* docs: update unreleased changelog

* fix: repair update and account menu paths

Co-authored-by: Radek Sienkiewicz <mail@velvetshark.com>

* fix: handle account-scoped usage and menu login bugs

* Add Antigravity account switching (steipete#937)

* Add Antigravity account switching

* Force Antigravity account chooser

* Persist Antigravity selected account updates

* docs: add Antigravity account switching changelog

---------

Co-authored-by: thiagocaltoe <thiago12_fera@hotmail.com>
Co-authored-by: Peter Steinberger <steipete@gmail.com>
Co-authored-by: Clint Andrew Hall <clint@clintandrewhall.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Giuseppe Bisemi <giuseppe.bisemi@gmail.com>
Co-authored-by: HaiTao Wu <whtis@users.noreply.github.com>
Co-authored-by: Piotr Durlej <pdurlej@users.noreply.github.com>
Co-authored-by: zhulijin1991 <167979819+zhulijin1991@users.noreply.github.com>
Co-authored-by: zhulijin1991 <zhulijin1991@users.noreply.github.com>
Co-authored-by: iam-brain <94809115+iam-brain@users.noreply.github.com>
Co-authored-by: Bryan Font <bfont@me.com>
Co-authored-by: Jakub Hašek <kubahasek@users.noreply.github.com>
Co-authored-by: Radek Sienkiewicz <mail@velvetshark.com>
Co-authored-by: Larry Hao(郝卓远) <107194248+hhh2210@users.noreply.github.com>
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.

Enterprise/Organization Claude accounts always fail with "Invalid response from Claude API"

3 participants