Fix Claude usage loading stalls#1032
Conversation
There was a problem hiding this comment.
💡 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) |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
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.
|
Thanks @rohitjavvadi. I landed this on
Proof run:
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. |
Summary
/usageoutput instead of treating surrounding status meters as usageCloses #1031.
Tests
git diff --checkswift test --filter ClaudeCLITimeoutRetryTestsswift test --filter StatusProbeTestsswift test --filter Claudeswift buildmake formatmake lintswift test