perf(spend): parallelize provider baselines in makeRequest - #3099
perf(spend): parallelize provider baselines in makeRequest#3099Yuxin-Qiao wants to merge 1 commit into
Conversation
Refresh independent spend snapshots concurrently via TaskGroup instead of sequential await, cutting 400ms-6s additive latency when multiple providers (Claude/Cursor/OpenCodex) share the 365-day window.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs real behavior proof before merge. Reviewed August 20, 2026, 6:08 AM ET / 10:08 UTC. ClawSweeper reviewWhat this changesThe PR refreshes eligible non-Codex provider spend snapshots concurrently before building the combined spend-dashboard request. Merge readiness⛔ Blocked until real behavior proof is added - 3 items remain Keep open: source review finds the fully drained task group consistent with the dashboard’s refresh-and-recapture contract, but required after-fix real behavior proof is missing. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — execution before step 1 Assertions:
How this fits togetherCodexBar’s spend dashboard refreshes provider-specific cost snapshots before it captures inputs for the dashboard model. Those inputs then drive the menu and dashboard’s combined usage-and-spend display. flowchart LR
A[Dashboard refresh request] --> B[Provider baselines]
B --> C{Refresh required?}
C -->|Yes| D[Concurrent provider refreshes]
C -->|No| E[Current provider publications]
D --> F[Capture refreshed publications]
E --> F
F --> G[Combined spend dashboard]
G --> H[Menu and dashboard display]
Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the fully drained task group and add redacted after-fix evidence from a real multi-provider dashboard refresh before merge. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a performance optimization, not a separately reported malfunction with a failing reproduction. Is this the best way to solve the issue? Yes: a drained task group is the narrowest maintainable way to overlap independent provider refreshes while retaining the existing post-refresh capture boundary. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a3457dafbe63. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Superseded by larger perf PR (parallel+memoize) per feedback |
Parallelize independent spend snapshot refreshes in
SpendDashboardSource.makeRequest:237.Before:
for baseline where shouldRefresh { await store.refreshProvider / refreshSpendDashboardTokenUsageNow }serially awaited per provider. With 3 independent providers (Claude/Cursor/OpenCodex) each 400ms-3s (Cursor pagination), total 1.2-9s additive.After:
withTaskGroupconcurrent, wall-time = slowest provider only. Cold全部first-paint from ~3-10s → ~2-3s (Codex scan still dominates).Scope: single function, no new persistence, no behavior change beyond concurrency.
SpendDashboardSourceConcurrencyTestscovers same-scope ownership.Fixes P0-4 from spend audit.
Verified:
swiftformat+swiftlint --strictclean.