Skip to content

Add AIHubMix prepaid USD balance - #3202

Open
jalenzz wants to merge 1 commit into
steipete:mainfrom
jalenzz:add-aihubmix
Open

Add AIHubMix prepaid USD balance#3202
jalenzz wants to merge 1 commit into
steipete:mainfrom
jalenzz:add-aihubmix

Conversation

@jalenzz

@jalenzz jalenzz commented Aug 26, 2026

Copy link
Copy Markdown

Summary

  • add AIHubMix as a first-party provider that reads prepaid USD remaining from the Manage Key /api/user/self endpoint
  • convert internal quota units with quota / 500000 and show the remaining amount in the menu bar instead of an empty dash
  • accept AIHUBMIX_ACCESS_KEY (or AIHUBMIX_TOKEN) and optional AIHUBMIX_API_URL; inference sk- keys are rejected
  • register branding, docs, generated manifests, and parser/fetch coverage

Test plan

  • swift test --filter AIHubMixUsageFetcherTests
  • make check
  • Confirm Settings → Providers → AIHubMix accepts a Manage Key (System Access Token), not an inference API key
image

Made with Cursor

Read remaining credits from the Manage Key account API and show the
amount in the menu bar instead of an empty dash.

Co-authored-by: Cursor <cursoragent@cursor.com>
@clawsweeper

clawsweeper Bot commented Aug 26, 2026

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@clawsweeper clawsweeper Bot added merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. P2 Normal priority bug or improvement with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 26, 2026
@clawsweeper

clawsweeper Bot commented Aug 26, 2026

Copy link
Copy Markdown

Codex review: needs real behavior proof before merge. Reviewed August 26, 2026, 12:54 AM ET / 04:54 UTC.

ClawSweeper review

What this changes

This PR adds AIHubMix prepaid-balance fetching, provider registration, menu rendering, CLI metadata, tests, and documentation.

Merge readiness

Blocked until stronger real behavior proof is added - 6 items remain

Keep open: this is a new first-party provider with an unresolved credential-routing policy and insufficient real behavior proof; current main does not already provide AIHubMix support.

Priority: P2
Reviewed head: 0ca4b13919ef0f40a9a468ade3e3b820e510becd
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The implementation is scoped and has focused mocked coverage, but real behavior proof is incomplete and the Manage Key destination remains a security-policy question.
Proof confidence 🦪 silver shellfish (2/6) Needs stronger real behavior proof before merge: Authority-chain proof required: the supplied settings screenshot does not show a successful, redacted Manage Key fetch and rendered balance, nor proof of the final credential destination policy; add that after-fix evidence and redact private data. Updating the PR body should trigger re-review; otherwise ask a maintainer to comment @clawsweeper re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦐 gold shrimp (3/6) Security review found an item that needs attention.

Verification

Check Result Evidence
Real behavior Needs proof Needs stronger real behavior proof before merge: Authority-chain proof required: the supplied settings screenshot does not show a successful, redacted Manage Key fetch and rendered balance, nor proof of the final credential destination policy; add that after-fix evidence and redact private data. Updating the PR body should trigger re-review; otherwise ask a maintainer to comment @clawsweeper re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 6 items Current main lacks this provider: The current-main provider registry ends with IBM Bob; AIHubMix is only added by this PR, so the requested capability is not already implemented.
Credential routing reaches arbitrary HTTPS hosts: The new override accepts any normalized HTTPS URL, and the fetcher sends the Manage Key in its Authorization header to that resulting URL.
The broad override is documented as intentional: The new documentation advertises AIHUBMIX_API_URL as an HTTPS URL or bare-host override while also documenting the Authorization header.
Findings None None.
Security Needs attention Constrain custom endpoint credential routing: The override accepts any HTTPS host and the request places the Manage Key in Authorization, so a configured non-provider host receives that credential without a provider-owned-host check.

Live Verification

Command: swift test --filter AIHubMixUsageFetcherTests

Result: FAIL (failed) — execution before step 1 run: sh -lc pnpm install --ignore-scripts --frozen-lockfile failed: ! Corepack is about to download https://registry.npmjs.org/pnpm/-/pnpm-11.24.0.tgz

sh -lc pnpm install --ignore-scripts --frozen-lockfile failed: ! Corepack is about to download https://registry.npmjs.org/pnpm/-/pnpm-11.24.0.tgz

Assertions:

  • FAIL expect_output: Test run with

How this fits together

CodexBar resolves a provider credential, fetches account usage into a shared snapshot, then displays it in the menu bar and provider details. AIHubMix would add a Manage Key-based balance source to that pipeline.

flowchart LR
  A[Manage Key] --> B[AIHubMix provider]
  B --> C[API base selection]
  C --> D[Account balance request]
  D --> E[Usage snapshot]
  E --> F[Menu bar balance]
  E --> G[Account details]
Loading

Decision needed

Question Recommendation
Should AIHUBMIX_API_URL be allowed to send an AIHubMix Manage Key to any HTTPS host, or should this provider restrict requests to AIHubMix-owned endpoints? Restrict credential destinations: Allow the documented AIHubMix endpoint family only and prove an untrusted override is rejected before an Authorization header is sent.

Why: The PR intentionally introduces a configurable network destination for a long-lived credential, and source alone cannot determine whether self-hosted or proxy endpoints are a supported product contract.

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: Authority-chain proof required: the supplied settings screenshot does not show a successful, redacted Manage Key fetch and rendered balance, nor proof of the final credential destination policy; add that after-fix evidence and redact private data. Updating the PR body should trigger re-review; otherwise ask a maintainer to comment @clawsweeper re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve security concern: Constrain custom endpoint credential routing - The override accepts any HTTPS host and the request places the Manage Key in Authorization, so a configured non-provider host receives that credential without a provider-owned-host check.
  • Resolve merge risk (P1) - AIHUBMIX_API_URL can direct a long-lived Manage Key to any HTTPS host, so the supported custom-endpoint boundary needs an explicit maintainer decision.
  • Resolve merge risk (P1) - The submitted screenshot does not show a successful balance fetch or the resulting menu-bar value.
  • Complete next step (P2) - A maintainer must choose the first-party credential-routing contract before any targeted repair can safely proceed.

Findings

  • [medium] Constrain custom endpoint credential routing — Sources/CodexBarCore/Providers/AIHubMix/AIHubMixUsageFetcher.swift:107
Agent review details

Security

Needs attention: No dependency or workflow change was found, but the new endpoint override can send a Manage Key to an arbitrary HTTPS host.

Review metrics

Metric Value Why it matters
Patch surface 27 files, +774/-91 lines The provider addition spans core fetching, app presentation, generated registries, tests, and public documentation.
Production versus tests production +398/-9, tests +220/-4 The substantial focused test addition is useful, while the larger production surface warrants an explicit endpoint-policy review.

Merge-risk options

Maintainer options:

  1. Constrain the Manage Key destination (recommended)
    Before merge, restrict the override to provider-owned hosts and add injected-transport coverage proving an untrusted host receives no Authorization header.
  2. Adopt a custom-endpoint contract
    Retain arbitrary HTTPS overrides only if maintainers explicitly want self-hosted or proxy routing for this first-party provider.

Technical review

Best possible solution:

If maintainers sponsor first-party AIHubMix support, define the endpoint trust boundary, then add redacted live proof of a Manage Key balance fetch and displayed value.

Do we have a high-confidence way to reproduce the issue?

Yes for the credential-routing concern: an injected transport can set a non-AIHubMix HTTPS override and observe that the fetch path sends Authorization to the resulting host; this read-only review did not execute it.

Is this the best way to solve the issue?

Unclear: the provider follows the established registry and snapshot shape, but maintainers must first choose whether arbitrary custom endpoints are a supported credential-routing contract.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 3cde772b9f02.

Labels

Label changes:

  • add P2: This is a bounded provider addition carrying a credential-destination policy decision and no demonstrated active outage.
  • add merge-risk: 🚨 security-boundary: A newly introduced environment override can change which HTTPS host receives the Manage Key Authorization header.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. Authority-chain proof required: the supplied settings screenshot does not show a successful, redacted Manage Key fetch and rendered balance, nor proof of the final credential destination policy; add that after-fix evidence and redact private data. Updating the PR body should trigger re-review; otherwise ask a maintainer to comment @clawsweeper re-review.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: Authority-chain proof required: the supplied settings screenshot does not show a successful, redacted Manage Key fetch and rendered balance, nor proof of the final credential destination policy; add that after-fix evidence and redact private data. Updating the PR body should trigger re-review; otherwise ask a maintainer to comment @clawsweeper re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Label justifications:

  • P2: This is a bounded provider addition carrying a credential-destination policy decision and no demonstrated active outage.
  • merge-risk: 🚨 security-boundary: A newly introduced environment override can change which HTTPS host receives the Manage Key Authorization header.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: Authority-chain proof required: the supplied settings screenshot does not show a successful, redacted Manage Key fetch and rendered balance, nor proof of the final credential destination policy; add that after-fix evidence and redact private data. Updating the PR body should trigger re-review; otherwise ask a maintainer to comment @clawsweeper re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. Authority-chain proof required: the supplied settings screenshot does not show a successful, redacted Manage Key fetch and rendered balance, nor proof of the final credential destination policy; add that after-fix evidence and redact private data. Updating the PR body should trigger re-review; otherwise ask a maintainer to comment @clawsweeper re-review.

Evidence

Security concerns:

  • [medium] Constrain custom endpoint credential routing — Sources/CodexBarCore/Providers/AIHubMix/AIHubMixUsageFetcher.swift:107
    The override accepts any HTTPS host and the request places the Manage Key in Authorization, so a configured non-provider host receives that credential without a provider-owned-host check.
    Confidence: 0.93

What I checked:

Likely related people:

  • Peter Steinberger: Current-main blame attributes the central provider registries and adjacent balance-display path to this author; deeper history is unavailable in the shallow checkout. (role: recent current-main contributor; confidence: medium; commits: 3cde772b9f02, 061593ca15d9; files: Sources/CodexBarCore/Providers/ProviderManifest.swift, Sources/CodexBar/Providers/Shared/ProviderImplementationManifest.swift, Sources/CodexBar/StatusItemController+Animation.swift)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Obtain maintainer direction for AIHUBMIX_API_URL and prove the selected trust boundary before Authorization is sent.
  • Add redacted after-fix evidence showing a real Manage Key balance fetch and the displayed menu-bar balance.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete

Copy link
Copy Markdown
Owner

Thanks for the implementation and the populated menu screenshot. The screenshot is useful visual evidence; it does not yet tie a successful request and freshly built display to the submitted commit. The exact-head CI run is awaiting approval with zero build/test jobs, and the PR's test checklist is still unchecked.

Before we take this further, please add the public evidence required by hosted relay eligibility: identifiable operator/jurisdiction, independently verifiable upstream authorization, and operating track record. This is a request for evidence, not an assertion that the service is unauthorized.

Please also make the intended credential/destination contract explicit. This uses an account-wide Manage Key—the official account API guide uses the same System Access Token for balance reads and key-management operations—and AIHUBMIX_API_URL deliberately permits a user-selected HTTPS host. The shared validator rejects unsafe URL forms, but it does not restrict the first request to AIHubMix. That is explicit configuration, not a demonstrated remote-exfiltration bug; arbitrary proxy support is nevertheless a broader scope than the default vendor balance endpoint and should be justified or left out of this initial integration. Include destination/redirect and account-selection tests for whichever contract is proposed.

After those boundaries are settled, the final integrated head needs focused fetch/settings/rendering tests, the provider architecture gate, make check, and full make test, plus redacted authenticated-read/UI proof tied to that SHA. Do not post a Manage Key, full account payload or unrelated private data. Keeping this open; no local tests or live account calls were run for this maintainer pass.

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

Labels

merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. P2 Normal priority bug or improvement with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants