Repository navigation
Conversation
GET /zen/go/v1/usage returns usage.rolling.percent with an absolute resetsAt, not the flat rollingUsage.usagePercent with a relative resetInSec the adapter validated. Every response therefore failed validation and the card degraded to the authenticated-only /models check, hiding all three quota windows. Both shapes are now accepted, so an older deployment is unchanged. Signed-off-by: Álvaro Tejero Cantero <[email protected]>
bernardopg
marked this pull request as ready for review
November 8, 2026 18:18
6 of 10 tasks
Owner
|
Thank you @alvorithm, this was a precise catch: the live payload in the description made the change easy to confirm, and other clients that read I carried this forward as #104 rather than waiting on the draft. Your commit is kept as-is, with you as its author, and one follow-up commit sits on top:
The CHANGELOG |
Owner
|
Merged as part of #104 with your commit and authorship intact. Thank you again @alvorithm! |
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.
/zen/go/v1/usageno longer returns the envelope the adapter validates. A live response today is:{"usage":{"rolling":{"status":"ok","percent":0,"resetsAt":"2026-11-08T15:24:56.000Z"}, "weekly":{"status":"ok","percent":19,"resetsAt":"2026-11-09T00:00:00.000Z"}, "monthly":{"status":"ok","percent":75,"resetsAt":"2026-11-14T14:38:46.000Z"}}}The adapter requires a top-level
rollingUsage/weeklyUsage/monthlyUsagewithusagePercentand a relativeresetInSec(providers/native/opencode.bash), so validation fails on every response and the provider degrades to the authenticated-only/modelscheck. The card reads "Authenticated, quota endpoint unavailable" and none of the three windows that #22 added is shown.This PR makes the adapter accept both envelopes, so the provider reads the live windows and an older deployment that still returns the flat shape is unchanged (fix(opencode): accept the nested).
Verifications
tests/test-opencode.shgains a case that answers with the nested envelope and asserts the source, the three percentages and the absolute reset, and it still covers the flat envelope.tests/test-cov-c2-opencode.sh, the rest of the offline fixture suites,scripts/check-changelog --base origin/mainandscripts/check-dco origin/mainpass.Shell lint ran with shellcheck 0.10.0. It reports no new findings on the changed file. The four pre-existing
SC2034findings inproviders/get-provider-usagereproduce at this version; that file is untouched here.Not verified: no live request was made from CI, since the suite stays offline and uses the captured payload above.
Out of scope
statusfield. The adapter accepts a window whenever its percentage is in range, as it did before.resetAtprecision. The nested shape carries an absolute timestamp that is passed through as-is; the flat shape still computes one fromresetInSec.