fix(quota): avoid CLIProxyAPI core route collision - #3
Merged
Merged
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
Remaining findings are minor test-coverage nits and do not block approval.
Pull request overview
Renames the plugin quota API route to avoid collision with CLIProxyAPI core routes while preserving the Management Center resource URL.
Changes:
- Uses
/quota-usagefor registration, handling, and page requests. - Updates quota route tests.
- Preserves the existing resource/menu path.
File summaries
| File | Reviewed changes |
|---|---|
resources/quota_page.html |
Uses the renamed quota endpoint. |
internal/plugin/quota.go |
Handles the renamed route. |
internal/plugin/quota_test.go |
Updates route and handler tests. |
internal/plugin/plugin.go |
Advertises the renamed route. |
Review details
Suppressed comments (2)
internal/plugin/quota_test.go:24
- This registration assertion does not cover the embedded page's independently hard-coded endpoint. A future mismatch could leave the page posting to the still-colliding
/quotapath while both the registration and handler tests pass; add an assertion thatresources.QuotaPagecontains/v0/management/plugins/+pluginName+/quota-usage.
if len(got.Routes) != 1 || got.Routes[0].Method != http.MethodPost || got.Routes[0].Path != "/plugins/"+pluginName+"/quota-usage" {
resources/quota_page.html:108
- This literal is the runtime contract between the embedded page and
HandleManagement, but the existing page tests only check unrelated markers. The registration and handler tests can therefore pass if this URL drifts, leaving the Management Center page to hit a 404 or a core route; add a regression assertion for the exact/v0/management/plugins/opencode-go-cliproxyapi/quota-usageendpoint inquota_test.go.
const endpoint = "/v0/management/plugins/opencode-go-cliproxyapi/quota-usage";
- Files reviewed: 4/4 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
massiveits
added a commit
that referenced
this pull request
Sep 13, 2026
Bump pluginVersion to 0.1.7 and add release notes for the quota route collision fix contributed in #3 by @turnercore.
tympom
pushed a commit
to tympom/opencode-go-cliproxyapi
that referenced
this pull request
Sep 26, 2026
tympom
pushed a commit
to tympom/opencode-go-cliproxyapi
that referenced
this pull request
Sep 26, 2026
Bump pluginVersion to 0.1.7 and add release notes for the quota route collision fix contributed in massiveits#3 by @turnercore.
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.
Summary
Rename the plugin-owned quota data route from
/plugins/opencode-go-cliproxyapi/quotato/plugins/opencode-go-cliproxyapi/quota-usage.CLIProxyAPI v7.2.159 added native
GET/POST/DELETE /v0/management/plugins/:id/quotaroutes. Plugin management handlers are reached through the server'sNoRoutefallback, so the nativePOSTroute now intercepts the quota page's{key_id: ...}request and returns{"error":"auth_index is required"}before this plugin receives it.The renamed path does not match a core route and reaches the existing plugin management handler. The Management Center resource/menu URL remains unchanged.
Changes
/plugins/opencode-go-cliproxyapi/quota-usageduring management registrationHandleManagementVerification
go test -buildvcs=false ./...go vet ./...go build -buildvcs=false -buildmode=c-sharedglm-5.2), Anthropic Messages (kimi-k3), and Responses (gpt-5.5)