Skip to content

fix(server): CLIProxyAPI hubs saved with their panel URL reach the management API - #30234

Open
sidhartha1s wants to merge 2 commits into
pingdotgg:mainfrom
sidhartha1s:fix/cliproxy-panel-url
Open

sidhartha1s wants to merge 2 commits into
pingdotgg:mainfrom
sidhartha1s:fix/cliproxy-panel-url

Conversation

@sidhartha1s

Copy link
Copy Markdown

Problem

Settings → Add a CLIProxyAPI hub accepts the hub's management panel address, for example https://hub.example.com/management.html. That is the address users have open in the browser, so it is the one they paste. The usage reader then requests https://hub.example.com/management.html/v0/management/auth-files. The hub answers 404, and Limits shows only "The hub answered with HTTP 404." The management key is correct. The same key works once the URL is changed to the bare origin.

Fixes #28835

Change

CliproxyApi.management builds every management request. It now drops a trailing /management.html from the hub URL's path before resolving v0/management/<path> against it. The API sits beside the panel page, so a hub under a path prefix (https://tools.test/cliproxy/management.html) still resolves to /cliproxy/v0/management/....

This is done at request time, so hubs already saved with the panel URL work without re-entering them. No contract, client, or settings change is needed.

Scope and approval

This is a very small, focused fix for an obvious bug: one URL is resolved in the wrong place, so every request from a hub saved with its panel address fails. It changes no defaults and adds no option. A hub URL that does not end in /management.html resolves exactly as before.

Verification

  • Turned the existing test "keeps the path of a hub served under a prefix" in apps/server/src/usage/cliproxyApi.test.ts into a table with a …/cliproxy/management.html row.
    • On main that row fails: Tests 1 failed | 2 passed | 16 skipped.
    • With the fix the whole file passes: vp test run src/usage/cliproxyApi.test.ts → Tests 18 passed (18).
  • vp run typecheck in apps/server: pass. vp run check:changed: format, lint, knip and graphql pass.
  • Not checked: a live CLIProxyAPI hub. The test uses the file's existing HTTP client fixture.
  • On this Windows checkout, the web test step of check:changed fails to optimize dependencies because the repo path contains a space (Automation%20Projects). That step does not touch these files.

Written with Claude Opus 5.5 in Claude Code.

…nagement API

Pasting the hub panel address (/management.html) as Hub URL built
/management.html/v0/management/..., so every read got a 404. The API sits
beside the panel page, so drop that page from the base before resolving.

Fixes pingdotgg#28835

Written with Claude Opus 5.5 in Claude Code.

Co-Authored-By: Claude <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-03T15:21:59.378712Z 958120b PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Nov 3, 2026
@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Walkthrough

The management request builder removes a trailing /management.html from the hub URL path before resolving the endpoint. Tests cover URLs ending in /cliproxy and /cliproxy/management.html.

Changes: CLIProxyAPI hub URL normalization

Layer / File(s) Summary
Normalize management URL
apps/server/src/usage/cliproxyApi.ts, apps/server/src/usage/cliproxyApi.test.ts
The management request builder removes a trailing /management.html and ensures the hub path ends in /. Tests verify the /cliproxy/v0/management/ path prefix for both URL forms.

Estimated code review effort: 2 (Simple) | ~7 minutes

Change: Bug fix · Severity of issue fixed: Low

Possibly related PRs

  • pingdotgg/t3code#25579: This PR also removes a trailing management.html from a CLIProxy hub URL before resolving the management endpoint.

Suggested labels: bugfix

Suggested reviewers: juliusmarminge

Merge Risk: Minimal · up to 4b4fb

No actionable merge-blocking risk remains in the reviewed change.

Pre-merge checks: Passed 4
Check name Status Explanation
Title check Passed The title is concise, conventional, and clearly identifies the main fix: making CLIProxyAPI hubs saved with their panel URL reach the management API.
Description check Passed The description includes all required sections. It explains the problem, implementation, scope rationale, focused verification, known limitations, and the environment-specific check failure.
Linked Issues check Passed Active direct issue #28835 requires a coding solution for CLIProxyAPI panel URLs that cause management API requests to use the wrong path. CliproxyApi.management removes a trailing `/management.html…
Out of Scope Changes check Passed The whole pull request changes only apps/server/src/usage/cliproxyApi.ts and its existing test. The source change fixes URL resolution for issue #28835. The test change verifies the panel URL and pa…
Full details: Linked Issues check

Explanation

Active direct issue #28835 requires a coding solution for CLIProxyAPI panel URLs that cause management API requests to use the wrong path. CliproxyApi.management removes a trailing /management.html from the parsed pathname before resolving v0/management/${path}. The change preserves path prefixes and unchanged behavior for other URLs. The updated test covers both /cliproxy and /cliproxy/management.html and verifies the /cliproxy/v0/management/ request path. The reported test run passes all 18 tests.

Full details: Out of Scope Changes check

Explanation

The whole pull request changes only apps/server/src/usage/cliproxyApi.ts and its existing test. The source change fixes URL resolution for issue #28835. The test change verifies the panel URL and path-prefix cases. No unrelated settings, contract, client, default, or option changes are present.

Finishing Touches
Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

Usage-based review receipt

Note

This review was completed with usage-based billing: files reviewed beyond your plan's included limits are billed at $0.25/file. View usage-based billing.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 958120b and 4b4fb94.

Files selected for processing: 1
  • apps/server/src/usage/cliproxyApi.ts

Limit details: You’ve used all 10 included reviews currently available.

@macroscopeapp

macroscopeapp Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 958120b

Macroscope's review found this PR approvable — Hub URLs ending in /management.html now resolve to the adjacent management API while retaining their origin and deployment prefix. Existing authentication and reset-credit controls are unchanged, keeping the impact limited to endpoint resolution.

Notes:

  • Code review disabled. Approvability was decided on eligibility alone.

You can add or adjust custom eligibility rules. Learn more.

@maria-rcks

Copy link
Copy Markdown
Collaborator

Note

Written by gpt-6.1-sol on behalf of Maria

merged current main into the existing head without rebasing. resolved the management-url conflict by retaining main's hub parameter and the contributor's panel-path normalization. the diff remains two files, with authentication and deployment prefixes preserved.

verified 4b4fb9491fee545cb415967c87fc16c890ed4cf1 with vp run check:changed github/main through blacksmith: format, lint, knip, graphql, three package typechecks, and 19 tests passed, including all 18 CLIProxyAPI tests. two independent read-only reviews found no actionable issues. a live external hub was not exercised.

This branch has not been deployed

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

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: CLIProxyAPI hub source accepts the panel URL (/management.html) and then shows only "The hub answered with HTTP 404."

2 participants