Skip to content
PR Quorum
Sign inStart free
← Review gallery
stablyai/orca #9325openreviewed 5h ago

fix(rate-limits): refetch claude usage when the last live Claude PTY exits

by xianjianlf2+137 05 filesreviewed in 1m 7sView PR on GitHub
minor notesThe panel surfaced minor issues worth a look before merge.1 finding

Reviewer panel

Correctness
deepseek/deepseek-v4-pro
0 found
Security
deepseek/deepseek-v4-pro
1 found
Architecture
deepseek/deepseek-v4-pro
0 found

Findings

01Mmedconf 85%

Potential race condition: drain listener fires before state is updated

src/main/rate-limits/service.ts:490

The drain listener registered in index.ts calls rateLimits?.refreshAfterClaudeLivePtysDrained(). This method checks this.state.claude?.usageMetadata?.deferredByLiveClaudeSession. However, the drain notification is fired synchronously from markClaudePtyExited or confirmSeededClaudeLivePtys, which may occur before the rate limit service has fetched the deferred state (e.g., on startup, if the deferred state is loaded asynchronously). If the drain fires before the initial refresh completes, the guard deferredByLiveClaudeSession will be false, and the refetch will be skipped, leaving the UI stuck on 'Waiting for Claude session'.

Want this on your own pull requests?
The same reviewer panel runs on every PR — one focused review, no noise.
Start freeLive demo