Skip to content

fix: Prevent division by zero in context percentage calculation#1055

Merged
adamdotdevin merged 1 commit intoanomalyco:devfrom
monotykamary:fix/context-percentage
Jul 16, 2025
Merged

fix: Prevent division by zero in context percentage calculation#1055
adamdotdevin merged 1 commit intoanomalyco:devfrom
monotykamary:fix/context-percentage

Conversation

@monotykamary
Copy link
Copy Markdown
Contributor

@monotykamary monotykamary commented Jul 16, 2025

Summary

This PR fixes a bug where the context percentage would display a garbage value when using a custom provider with a context window of 0.

image

This was caused by a division-by-zero error. The code has been updated to check for a zero context window before performing the division.

Test plan

Manually tested with a custom provider with a context window of 0. The percentage now correctly displays 0%.

@adamdotdevin adamdotdevin merged commit 88b58fd into anomalyco:dev Jul 16, 2025
achembarpu pushed a commit to achembarpu/opencode that referenced this pull request Aug 4, 2025
xywsxp pushed a commit to xywsxp/opencode that referenced this pull request Apr 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants