Skip to content

fix: keep Windsurf quota visible when extra usage balance is missing#346

Open
prayzey wants to merge 2 commits intorobinebers:mainfrom
prayzey:Windsurf
Open

fix: keep Windsurf quota visible when extra usage balance is missing#346
prayzey wants to merge 2 commits intorobinebers:mainfrom
prayzey:Windsurf

Conversation

@prayzey
Copy link
Copy Markdown

@prayzey prayzey commented Apr 5, 2026

Closes

Closes #345

What was going wrong

For some Windsurf accounts, OpenUsage was showing:

Windsurf quota data unavailable. Try again later.

even though Windsurf was still returning usable quota data.

The daily quota, weekly quota, and reset times were present, but the extra usage balance field could be missing or invalid. When that happened, OpenUsage treated the whole response like an error and showed the red error state instead of the quota bars.

What this change does

This PR makes the Windsurf parser more forgiving.

Now OpenUsage will:

  • keep showing daily and weekly quota when that data is available
  • skip the extra usage balance line if Windsurf does not send it
  • skip the extra usage balance line if Windsurf sends an invalid value

This means the app keeps showing the useful quota information instead of failing completely.

Why this matters

Right now, one missing field can make Windsurf look completely broken, even when the main usage data is still available.

With this change, OpenUsage keeps working for Windsurf users even when that extra field is missing.

Before

image

After

image

Testing

Added regression tests for:

  • missing extra usage balance
  • invalid extra usage balance
  • normal Windsurf quota responses continuing to render correctly

Summary by cubic

Keeps Windsurf quota visible when the extra usage balance is missing or invalid, preventing the red “quota unavailable” error and showing daily/weekly bars as long as they’re available.

  • Bug Fixes
    • Do not treat missing/invalid overageBalanceMicros as fatal; render daily and weekly quota when present.
    • Omit the “Extra usage balance” line if Windsurf omits it or sends a non‑finite value.
    • Harden money formatting to return null for non‑finite micros; add tests for missing/invalid balance and normal responses.

Written for commit bbbb6cc. Summary will update on new commits.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

@validatedev validatedev requested a review from Copilot April 5, 2026 18:54
@validatedev
Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Makes the Windsurf plugin’s quota parsing resilient to missing/invalid overageBalanceMicros so daily/weekly quota bars remain visible instead of showing the “quota unavailable” error.

Changes:

  • Treat overageBalanceMicros as optional (missing/invalid no longer fails the whole quota render).
  • Conditionally include the “Extra usage balance” line only when the value parses to a valid dollar amount.
  • Add/adjust regression tests for missing/invalid extra usage balance scenarios.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
plugins/windsurf/plugin.js Loosens quota contract requirements and conditionally renders extra usage balance without failing daily/weekly lines.
plugins/windsurf/plugin.test.js Adds coverage for omitted/invalid extra usage balance and updates the expected behavior accordingly.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

function formatDollarsFromMicros(value) {
var micros = readFiniteNumber(value)
if (micros === null) return null
if (!Number.isFinite(micros)) return null
Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

readFiniteNumber() already guarantees the returned value is finite (or null), so the extra Number.isFinite(micros) check is redundant and can confuse future readers. Consider removing it, or adding a short comment explaining why the double-check is intentional (e.g., defensive against patched/inconsistent Number.isFinite).

Suggested change
if (!Number.isFinite(micros)) return null

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator

@davidarny davidarny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No chance to test it, but LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windsurf quota disappears when extra usage balance is missing

4 participants