Repository navigation
fix(status-bar): guard undefined provider window in usedPercent reduce (crashes d2c1da69, bb74236c) - #10271
Merged
Conversation
…ercent usedSections filtered only s.window !== null, so a partial/rehydrated provider whose session/weekly window is undefined (not null) slipped through and getTightestUsageSection's reduce dereferenced undefined.usedPercent, crashing the status-bar overlay (TypeError in ProviderSegment/CodexAccountUsageSegment). Filter out undefined windows too. Fixes crashes d2c1da69 / bb74236c. Co-authored-by: Orca <[email protected]>
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughUpdated provider usage filtering to exclude both null and undefined windows. Added tests verifying tightest-window calculation and compact 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
enrick-dev
pushed a commit
to enrick-dev/orca
that referenced
this pull request
Oct 15, 2026
…e (crashes d2c1da69, bb74236c) (stablyai#10271) Co-authored-by: Orca <[email protected]>
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.
Description
Fixes a status-bar overlay crash (
overlay.status-barboundary):TypeError: Cannot read properties of undefined (reading 'usedPercent')atgetTightestUsageSection→ProviderSegment/CodexAccountUsageSegment.usedSections()filtered sections withs.window !== null, but a partial/rehydrated provider can carry a window that isundefined(the type declaressession/weeklyasRateLimitWindow | null, yet a missing field isundefinedat runtime). Anundefinedwindow slipped past the null-only filter, sogetTightestUsageSection'sreduce— andproviderMaxUsed— dereferencedundefined.usedPercentand took down the status bar.Fix: filter out
undefinedwindows too (s.window !== null && s.window !== undefined), matching the codebase's existing style. One point covers every consumer ofusedSections.Crash reports:
d2c1da69,bb74236c(macOS, 1.4.152).ELI5
The status bar shows each AI provider's tightest usage window. It listed the windows and skipped the "empty" ones — but it only checked for one kind of empty (
null), not the other (undefined). A provider that came back with a missing window slipped through, and the code tried to read a percentage off nothing, crashing the bar. Now both kinds of empty are skipped.Proof of fix
Regression tests fail on current code, pass after the one-line filter change:
The second test reproduces through the real
ProviderSegmentrender path (the crash's component stack).tscweb typecheck exit 0;oxlintclean.Proof of zero regression
The only behavior change is that a section whose
windowisundefinedis now excluded — such a section was never renderable anyway (every consumer readswindow.usedPercent), so excluding it removes a crash and changes nothing for valid windows.nullwindows were already excluded;undefinednow joins them. Entire status-bar suite green (33 files / 224 tests), including all pre-existing provider/window/tooltip tests.Made with Orca 🐋