Skip to content

Fix Claude usage loading stalls#1032

Closed
rohitjavvadi wants to merge 2 commits into
steipete:mainfrom
rohitjavvadi:fix/claude-usage-loading-stall
Closed

Fix Claude usage loading stalls#1032
rohitjavvadi wants to merge 2 commits into
steipete:mainfrom
rohitjavvadi:fix/claude-usage-loading-stall

Conversation

@rohitjavvadi
Copy link
Copy Markdown
Contributor

Summary

  • detect loading-only Claude /usage output instead of treating surrounding status meters as usage
  • use a bounded single CLI probe in automatic source fallback while preserving the longer explicit CLI retry path
  • add focused coverage for the loading-panel parser path and automatic CLI timeout behavior

Closes #1031.

Tests

  • git diff --check
  • swift test --filter ClaudeCLITimeoutRetryTests
  • swift test --filter StatusProbeTests
  • swift test --filter Claude
  • swift build
  • make format
  • make lint
  • swift test

Copy link
Copy Markdown

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

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: 6cedb81126

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

return try await self.fetcher.loadViaWebAPI()
case .cli:
return try await self.loadViaCLIWithRetry(model: model)
return try await self.loadViaCLI(model: model, timeout: ClaudeUsageFetcher.cliAutoProbeTimeout)
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 Keep CLI retry when auto has no alternate source

The .auto execution path now calls loadViaCLI(..., timeout: 12) directly instead of loadViaCLIWithRetry, which removes the 24s→60s retry behavior for auto-selected CLI. In setups where OAuth/Web are unavailable, executionSteps can contain only .cli, so any transient CLI render/startup delay beyond 12 seconds now fails outright even though the same account would have succeeded before on the retry path; this is a regression in reliability for the default auto mode.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 5291a06. Auto-selected CLI now keeps the 12s first probe for loading stalls, but if CLI is the final/only auto source and the probe times out, it retries with the existing 60s timeout. Added deterministic regression coverage for the final-source timeout path while preserving the fast failure for loading-stall parse errors.

@steipete
Copy link
Copy Markdown
Owner

Thanks @rohitjavvadi. I landed this on main in 1dd2804 with a couple maintainer fixups:

  • loading-only /usage panels are detected from the latest retained terminal panel
  • auto CLI refresh gets a short first probe plus a 60s retry for timeout/loading cases
  • retryable CLI failures are retried before falling through to potentially stale web cookies
  • added regression coverage for retained loading panels, unretryable parse errors, timeout/loading retries, and stale web fallback ordering

Proof run:

  • swift test --filter ClaudeCLITimeoutRetryTests
  • swift test --filter StatusProbeTests
  • make check
  • Codex review clean

I could not fast-forward-update the contributor branch after rebasing/fixups, so I landed the equivalent fixed branch directly with your PR credited in the changelog.

@steipete steipete closed this May 20, 2026
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.

Claude usage never loads

2 participants