Add Codex historical pace with risk forecasting and backfill#438
Add Codex historical pace with risk forecasting and backfill#438tristanmanchester wants to merge 3 commits intosteipete:mainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: de11d1a0cb
ℹ️ 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".
| func weeklyPace(provider: UsageProvider, window: RateWindow, now: Date = .init()) -> UsagePace? { | ||
| guard provider == .codex || provider == .claude else { return nil } | ||
| guard window.remainingPercent > 0 else { return nil } | ||
| let codexAccountKey = self.codexHistoricalAccountKey() |
There was a problem hiding this comment.
Gate Codex account-key lookup to Codex pace path
weeklyPace computes codexHistoricalAccountKey() unconditionally before the provider-specific branch, so Claude pace rendering also runs Codex account resolution. That path can fall through to codexAccountEmailForOpenAIDashboard() and UsageFetcher.loadAccountInfo() (which synchronously reads ~/.codex/auth.json) while this method is @MainActor, adding avoidable disk I/O to menu-bar updates for non-Codex providers. Move the account-key lookup inside the .codex historical branch so Claude pace stays purely in-memory.
Useful? React with 👍 / 👎.
|
Curious how this compares to my PR #401 yours looks more developed though |
I completely missed your PR! Looks we have different approaches. I guess Peter will merge the best bits of both if he implements this feature. |
Summary
UsagePaceand include rounded risk text in pace detail when eligibility is metKey Implementation Details
HistoricalUsageHistoryStoreUsageStore.weeklyPace(...)andUsageStore+HistoricalPacesource(live/backfill) and optionalaccountKeyTests
HistoricalUsagePaceTestsandHistoricalUsagePaceTestSupportValidation
pnpm checkswift test --filter HistoricalUsagePaceTests --filter UsagePaceTextTests --filter menuBarDisplayTextFormatsPercentAndPace --filter menuBarDisplayTextRequiresProvidedPaceForCodex./Scripts/compile_and_run.shNote
swift teststill hits an existing unrelated crash in this repo (NSConcreteTask terminationStatusin provider version detection / Gemini path)