Skip to content
← All reviews
stablyai/orca #9325 · xianjianlf2 · 4mo ago

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

Panel verdict

The panel surfaced minor issues worth a look before merge.

1
raised by reviewers
1
kept by the panel

Findings

MediumSecurityconfidence 0.85

Potential race condition: drain listener fires before state is updated

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'.

3 reviewers · deepseek/deepseek-v4-pro · reviewed in 1m 7s · 5 files, +137 −0

Ship the PR.
Skip the noise.

Free on 2 repositories · No credit card · Advisory only—never blocks a merge