Repository navigation
feat(usage): expose Qoder account quota to omp usage - #47
Merged
Merged
Conversation
OMP renders provider quotas from a provider-level `usage` slot that pi's published ProviderConfig lacks, so `omp usage` listed the Qoder account with no data despite a working quota endpoint. Map the already-parsed quota payload onto the host's normalized report: one limit per Credit bucket with numeric used/limit/remaining, the plan expiry when the account has one (Qoder's year-9999 sentinel is not a reset), and the account kind. A quota read is account-wide, so the provider reports `validatesCredentials: false`: a failed read renders as missing data and never marks a working credential unhealthy. The fetch accepts both the host's normalized credential (`accessToken`) and pi's OAuth grant (`access`), and returns null when neither exists.
Owner
|
Merged — thank you! Squash-merged as Verified before merging, beyond the test suite:
One note from my run: two |
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.
What
omp usageshows the Qoder account with no data, even though the extension already fetches and parses Qoder's quota for/qoder-usage.OMP renders provider quotas from a provider-level
usageslot on the registration. pi's publishedProviderConfighas no such field (the extension carries a separatefetchUsagehook onoauthfor pi), so under OMP nothing answers the usage probe.This maps the quota payload the extension already parses onto the host's normalized report:
used/limit/remainingand ausedFractionwhen the bucket has a totalplan expires; Qoder's year-9999 "no expiry" sentinel is dropped instead of rendering a ~8000-year countdownTwo host-contract details, both from OMP's own
packages/ai/src/usage.ts(v18.14.1):validatesCredentials: false— a quota read is account-wide, so a failed read must render as missing data rather than mark a credential unhealthy (packages/ai/src/auth/health.ts:381).accessToken,UsageCredential) and pi's OAuth grant (access,OAuthCredentials), returningnullwhen neither is present.Verification
Against a live OMP 18.14.1 install with this branch built:
--jsoncarries the same mapping (limits[].amount,status,notes). The other OMP surfaces were checked as-is and needed no change:omp modelslists both models,omp loginlistsQoder (Browser OAuth / PAT)andQoder CN (PAT), and a live turn reaches Qoder's authenticated endpoint (this test account answers403 … RESOURCE_LIMITbecause its Credit balance is zero, which is also what the new usage row reports).npm test414 passed (8 new insrc/__tests__/usage-provider.test.ts),npm run checkclean,biome checkclean.Notes
/qoder-usageremains pi's quota view.