Skip to content

feat(copilot): show raw request counts for premium interactions#316

Open
thatdaveguy1 wants to merge 1 commit intorobinebers:mainfrom
thatdaveguy1:feat/copilot-requests-used
Open

feat(copilot): show raw request counts for premium interactions#316
thatdaveguy1 wants to merge 1 commit intorobinebers:mainfrom
thatdaveguy1:feat/copilot-requests-used

Conversation

@thatdaveguy1
Copy link
Copy Markdown

@thatdaveguy1 thatdaveguy1 commented Mar 22, 2026

Description

Adds a Requests Used text line (e.g. 60 / 300) to the Copilot plugin detail view. This gives users visibility into their exact premium request consumption alongside the existing percentage-based progress bar.

Copilot uses a request-based quota system, but the current plugin only shows "80% remaining" — which is ambiguous without knowing the total. This PR surfaces the raw counts already present in the API response (entitlement and remaining from premium_interactions), requiring no additional API calls.

Scope: Paid tier only. Free tier is unaffected. The line is scoped to detail in plugin.json so it doesn't clutter the overview.

Related Issue

N/A — enhancement request.

Type of Change

  • Bug fix
  • New feature
  • New provider plugin
  • Documentation
  • Performance improvement
  • Other (describe below)

Testing

  • I ran bun run build and it succeeded
  • I ran bun run test and all tests pass (935/935)
  • I tested the change locally with bun tauri dev

4 new tests added:

  • Verifies Requests Used text line present with value 60 / 300 for default paid-tier fixture
  • Verifies absent when entitlement/remaining fields are missing from snapshot
  • Verifies clamping when remaining > entitlement (shows 0 / N)
  • Verifies absent for free tier

Screenshots

No UI changes — this is a plugin-only change. The frontend already renders text lines as label/value pairs.

Checklist

  • I read CONTRIBUTING.md
  • My PR targets the main branch
  • I did not introduce new dependencies without justification

Summary by cubic

Adds a "Requests Used" text line to the Copilot plugin, showing exact premium request consumption (e.g., 60 / 300) alongside the Premium progress bar. This gives paid users clear usage numbers without extra API calls.

  • New Features
    • Computes used = entitlement − remaining from premium_interactions and clamps at 0.
    • Shown only for paid tier and only in the detail view to avoid clutter.
    • Updated provider docs and added tests for presence, absence, clamping, and free tier exclusion.

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

Add a 'Requests Used' text line (e.g. '60 / 300') to the Copilot plugin
detail view, giving users visibility into exact premium request consumption
alongside the existing percentage progress bar.

- Compute used = entitlement - remaining from premium_interactions snapshot
- Guard against missing/invalid fields and clamp negative values to 0
- Scope to detail view in plugin.json to keep overview uncluttered
- Paid tier only; free tier is unaffected
- Add 4 tests covering presence, absence, clamping, and free tier exclusion
- Update docs/providers/copilot.md with new line entry
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 4 files


Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Add one-off context when rerunning by tagging @cubic-dev-ai with guidance or docs links (including llms.txt)
  • Ask questions if you need clarification on any suggestion

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

Adds a paid-tier-only detail metric to the Copilot provider so users can see exact premium request consumption (used vs. entitlement) rather than only percent remaining.

Changes:

  • Add a new Requests Used detail line to the Copilot plugin manifest.
  • Compute and emit the Requests Used text line from premium_interactions.entitlement and premium_interactions.remaining.
  • Add test coverage for presence/absence and clamping behavior, and update provider docs.

Reviewed changes

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

File Description
plugins/copilot/plugin.js Adds logic to derive and emit a Requests Used text line for paid-tier premium interactions.
plugins/copilot/plugin.json Declares the new Requests Used line scoped to detail.
plugins/copilot/plugin.test.js Adds tests for the new line (paid-tier display, missing fields, clamping, free-tier omission).
docs/providers/copilot.md Documents the new displayed line for paid tier.

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

Comment on lines +231 to +235
var used = pi.entitlement - pi.remaining;
lines.push(ctx.line.text({
label: "Requests Used",
value: String(Math.max(0, used)) + " / " + String(pi.entitlement),
}));
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

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

Avoid var here; the rest of this plugin uses const/let. Using const used = ... (or let if you intend to reassign) prevents hoisting-related surprises and keeps style consistent.

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.

@thatdaveguy1 hey, thanks for the PR! Could you please provide screeshots?

@thatdaveguy1
Copy link
Copy Markdown
Author

@davidarny Sure. Main menu is unchanged (undecided on this, personally I would like if this showed requests too)

image

detail view is where it shows

image

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.

Thanks! LGTM!

@validatedev
Copy link
Copy Markdown
Collaborator

I'm not fully sold on this from a UI/UX perspective tbh. Feels like we're showing the same information twice. Curious to hear your thoughts on this too @robinebers

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants