Refresh usage footer on turn end and stop rotating Claude's OAuth token - #26
Open
emircan-sahin wants to merge 1 commit into
Open
Refresh usage footer on turn end and stop rotating Claude's OAuth token#26emircan-sahin wants to merge 1 commit into
emircan-sahin wants to merge 1 commit into
Conversation
The 15-minute poll timer beat against the 5-minute staleness floor, so a snapshot could sit unrefreshed for a quarter hour. The timer now ticks every minute while both providers keep the 5-minute floor, and a finished Claude or Codex turn refreshes its own chip within two minutes. MonoCode no longer refreshes Claude Code's OAuth token. Those credentials belong to the claude CLI, which MonoCode spawns for every turn and which refreshes them itself; a rotation MonoCode could not persist left the CLI holding a dead refresh token. The footer now only reads, and an expired token shows as expired until the next turn renews it. The usage endpoint 429s at 30-60s polling without sending Retry-After, so a throttle backs off for 30 minutes and the chip falls back to a dash with the reason in its tooltip. Also: - a provider that was not signed in at launch is retried every 15 minutes instead of never - clicking refresh mid-poll is queued instead of swallowed - an idle terminal no longer forks a ps every second to name its foreground process, since the check that makes that pointless ran after the spawn rather than before
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 changed
The usage footer refreshes when a turn ends and polls on a cadence that can actually deliver a fresh snapshot, plus four related fixes.
Addresses #20.
Why
#20 is right that the data was already on hand: the fetch floor was five minutes but the UI timer ticked every fifteen, so a snapshot could sit unused for ten minutes. The timer now ticks every minute and a snapshot lands as soon as it is eligible, and a finished Claude or Codex turn marks the provider stale so the number moves when the user has just spent some. Both providers keep the five-minute floor between reads.
Also in #20's list, a provider that was not signed in at launch stayed "not connected" for the life of the process; it is now retried every 15 minutes so signing in later recovers on its own. Clicking refresh during a background poll did nothing at all — the click is now queued and runs right after. A 429 backs off for 30 minutes rather than retrying on the normal cadence, with the reason in the chip's tooltip.
The footer no longer refreshes Claude Code's OAuth token. Those credentials belong to the
claudeCLI, which MonoCode already spawns for every turn and which rotates them itself. Writing to its keychain entry meant a rotation MonoCode could not save left the CLI holding a dead refresh token. The footer is now a read-only view: an expired token showsexpireduntil the next Claude turn renews it.One unrelated-looking line rides along because it is the same polling story: an idle terminal forked a
psevery second per pane to name its foreground process, and now bails before the fork when the foreground pid is the shell itself.UI
The footer's number updates sooner. A throttled provider shows the reason in the chip tooltip; an expired token shows
expired.Checklist
npm run check