fix: provider usage popover reads Claude and Codex again - #321
Closed
arzafran wants to merge 3 commits into
Closed
Conversation
4 tasks
Member
Author
|
Superseded by #322, which carries these three commits unchanged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
Opening the sidebar Provider Usage popover showed "Claude usage could not be read" and "Codex usage could not be read" for both providers, even with both CLIs signed in. Both now load in under a second. A signed-out Claude CLI hides the provider instead of showing an error, and the help and usage icons in the sidebar footer sit a little further apart.
Why it broke
codex app-serverkeeps running after it answers, and its stderr stays silent. The fetcher drained that stderr pipe throughFileHandle.bytes, whose reads go through one shared Foundation IO actor. The blocked stderr read starved the stdout reader, and because the Claude probe runs at the same time, itsauth statusread starved too. Both probes hit the 5 second deadline together. Reproduced in a standalone harness and in-process (a child's stdout lines arrived only at process exit).The fix reads pipes through
readabilityHandlerinstead, and sends the app server's stderr to the null device.claude auth statusalso exits 1 when signed out while still printing{"loggedIn": false}; the fetcher now trusts the parsed answer over the exit status.Review order
Sources/ClaudeQuotaMonitor.swift:ProviderUsagePipeReader, the Claude reader, the Codex runner.programaTests/ClaudeQuotaSnapshotParserTests.swift: the three new tests and thelingerAfterResponsesfake.Sources/SidebarVisuals.swift: one constant.Test plan
testLongLivedServerWithAnIdleStderrPipeDoesNotStallTheResponseReaderandtestSignedOutClaudeCLIExitStatusStillHidesTheProviderInsteadOfFailingin CI (verified locally against the pre-fix source)