Fix enterprise account failures and add Org ID field (#940) - #941
Conversation
- 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
There was a problem hiding this comment.
💡 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".
Prevents stale newOrgID state from leaking into non-Claude providers when the Org ID field is not shown. https://claude.ai/code/session_01YQotcG4rFPbYNkyZLt94hr
There was a problem hiding this comment.
💡 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".
| // Enterprise/credit-based accounts return null for five_hour; treat as 0% rather than an error. | ||
| let resolvedSessionPercent = sessionPercent ?? 0.0 |
There was a problem hiding this comment.
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 👍 / 👎.
* 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>
|
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! |
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>
* 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>
Summary
Fixes #940 — enterprise/organization Claude accounts always fail with "Invalid response from Claude API".
nullforfive_hour(andseven_day) instead of utilization data. The parser was throwingFetchError.invalidResponsewhenfive_hourwas absent/null. Now defaultssessionPercentUsedto0.0so enterprise accounts load correctly.organizationIDfor 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 toaddTokenAccount(organizationID:).Changes
ClaudeWebAPIFetcher.swift— replace guard-throw with?? 0.0default for missing session utilizationProviderSettingsDescriptors.swift— addshowsOrganizationField: Bool; updateaddAccountclosure to accept optionalorganizationIDPreferencesProviderSettingsRows.swift— show "Org ID (optional)" text field whenshowsOrganizationFieldis true; pass value toaddAccountPreferencesProvidersPane.swift— enable org field for Claude provider; forwardorganizationIDtoaddTokenAccountPreferencesProvidersPane+Testing.swift— update mock descriptor to match new signatureTest plan
sessionPercentUsedshows 0%https://claude.ai/code/session_01YQotcG4rFPbYNkyZLt94hr
Generated by Claude Code