Skip to content

Add Charm Hyper provider (API key + session) - #2502

Open
steipete wants to merge 4 commits into
mainfrom
codex/charm-hyper-combined
Open

Add Charm Hyper provider (API key + session)#2502
steipete wants to merge 4 commits into
mainfrom
codex/charm-hyper-combined

Conversation

@steipete

Copy link
Copy Markdown
Owner

Summary

  • add Charm Hyper as an opt-in provider with signed-in session and API-key authentication
  • prefer the signed-in browser session in Auto mode, then fall back to HYPER_API_KEY, saved keys, or token accounts
  • request the maintained GET https://hyper.charm.land/v1/credits endpoint and render the returned value as a native HC balance
  • keep balance data honest: no inferred plan limit, usage percentage, quota, or reset timestamp
  • wire settings, diagnostics, CLI, menu/card presentation, widgets, provider counts, docs, and parser metadata

This combines and credits the work from @JavaGT in #2379 and @akshayprabhu200 in #2476 for #2318. Both contributors are recorded as co-authors on the combined commit.

Authentication order

Auto mode follows the existing descriptor pipeline convention used by mixed-auth providers:

  1. hyper.web: a signed-in hyper.charm.land session, imported from Chrome or supplied as a manual Cookie header.
  2. hyper.api: an explicit API key from configuration, HYPER_API_KEY, or a token account.

A missing or expired session may fall back to the API key. Malformed successful responses fail closed so an upstream contract change is not hidden. With neither source configured, CodexBar reports setup guidance instead of a fake empty balance.

Verification

  • swift test --filter Hyper — 14 tests passed
  • make check
  • structured Codex autoreview on the exact rebased branch — clean, no accepted/actionable findings

The focused coverage includes API-key-only routing, session preference when both sources exist, neither-configured guidance, cookie and bearer request construction, login redirects, malformed/short responses, native HC menu/card/CLI presentation, provider registration, and icon availability.

Live verification blocker

Live verification is pending — Peter is on the Charm Hyper waitlist. Do not merge this PR until a real account confirms the combined behavior.

When access arrives, verify all of the following on this exact PR head:

  1. Sign in to hyper.charm.land in Chrome and confirm Auto selects hyper.web, including when an API key is also configured.
  2. Confirm the session-authenticated /v1/credits request returns HTTP 200 with a numeric balance; record the actual cookie/session contract without exposing cookie values or account identity.
  3. Expire or disable the session and confirm Auto falls back to hyper.api without browser or Keychain prompts beyond the expected Chrome cookie access.
  4. Confirm a real API key returns HTTP 200 from /v1/credits and the value matches the Charm dashboard.
  5. Confirm the menu bar, provider card, and CLI show Balance: <amount> HC and never show Cost, / 0, a fabricated limit, or a reset countdown.
  6. Check whether the signed-in response exposes stable additional account, plan, or refresh fields. Only map fields proven by the real response, and keep every identity/plan value sourced from Charm Hyper itself.

No authenticated Hyper request, browser-cookie import, or live account UI capture was performed for this combined head.

Co-authored-by: JavaGT <java@javagrant.com>
Co-authored-by: Akshay Prabhu <12824090+akshayprabhu200@users.noreply.github.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 83c38bd083

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

if context.settings?.hyper?.cookieSource == .off {
[HyperAPIFetchStrategy()]
} else {
[HyperSessionFetchStrategy(), HyperAPIFetchStrategy()]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Honor selected Hyper API-token accounts

When a Hyper token account is selected, the fetch context carries that account's API key in context.env, but Auto mode still tries hyper.web first. If the user is also signed in to Hyper in Chrome, every per-account refresh can succeed with the ambient browser session before the selected account's API key is used, so account snapshots and the active balance can be sourced from the wrong Hyper account. Please skip the session strategy (or force .api) when context.selectedTokenAccountID is set for this API-key token-account provider.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added 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. P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 auth-provider 🚨 Merging this PR could break OAuth, tokens, provider routing, model choice, or credentials. labels Jul 29, 2026
@clawsweeper

clawsweeper Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codex review: needs changes before merge. Reviewed August 12, 2026, 6:09 AM ET / 10:09 UTC.

ClawSweeper review

What this changes

Adds Charm Hyper as an opt-in balance provider using a browser session or API key, with settings, CLI, menu presentation, documentation, and tests.

Merge readiness

Blocked by patch quality or review findings - 6 items remain

This owner-authored provider implementation remains useful, but it needs a rebase onto the current manifest architecture, a selected-token-account routing fix, and real-account session proof before merge.

Priority: P2
Reviewed head: 27b802af3bab6dc85f22eadb5f6505362539cabe

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) PR readiness rating was derived from proof quality, review findings, security review, and reviewer confidence.
Proof confidence 🌊 off-meta tidepool Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🧂 unranked krab (1/6) 2 actionable review findings remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Evidence reviewed 6 items Current bootstrap boundary: Current main bootstraps descriptors from ProviderManifest; Hyper is absent from that manifest, so the branch’s obsolete registry-table addition would not register it after rebase.
Current implementation bootstrap: Current main builds app-side provider implementations from ProviderImplementationManifest rather than the switch modified on the branch.
Provider authoring contract: Current provider documentation requires regenerating both manifests for every first-party provider and says not to edit the manifests manually.
Findings 2 actionable findings [P1] Register Hyper through the current provider manifests
[P2] Bypass sessions for selected Hyper token accounts
Security None None.

How this fits together

CodexBar resolves configured credentials or browser sessions into provider fetch strategies, then displays returned balances in its menu bar, cards, and CLI. This PR adds Charm Hyper to that provider pipeline.

flowchart LR
A[Settings and environment] --> C[Authentication selection]
B[Chrome Hyper session] --> C
C --> D[Credits endpoint]
D --> E[Balance validation]
E --> F[Provider manifests]
F --> G[Menu bar, card, and CLI]
Loading

Before merge

  • Register Hyper through the current provider manifests (P1) - Current main bootstraps first-party providers through generated descriptor and implementation manifests, not these registry tables. Rebase and regenerate both manifests or Hyper will have no runtime descriptor or implementation.
  • Bypass sessions for selected Hyper token accounts (P2) - With a selected API-token account, Auto still tries hyper.web first. An available Chrome session can therefore return another account’s balance; force the API strategy or omit the session strategy for selected token accounts.
  • Resolve merge risk (P1) - Without regenerated manifests, the new provider has no descriptor or implementation at runtime on current main.
  • Resolve merge risk (P1) - A selected saved Hyper API-token account can be shadowed by an unrelated signed-in Chrome session, showing the wrong balance.
  • Resolve merge risk (P2) - The new cookie-session contract and session-to-API-key fallback lack real-account validation.
  • Improve patch quality - Address the highest-priority review finding and re-run the changed-surface validation.

Findings

  • [P1] Register Hyper through the current provider manifests — Sources/CodexBarCore/Providers/ProviderDescriptor.swift:169
  • [P2] Bypass sessions for selected Hyper token accounts — Sources/CodexBarCore/Providers/Hyper/HyperProviderDescriptor.swift:49-54
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Change surface 37 files; +1,154/-132 lines The provider touches registration, credentials, presentation, docs, and tests, making integration parity important.
Production and tests production +775/-54; tests +277/-0 Focused tests are substantial, but they do not replace real authenticated-session verification.

Merge-risk options

Maintainer options:

  1. Rebase and preserve explicit account selection (recommended)
    Regenerate both provider manifests and bypass browser-session routing whenever a Hyper API-token account is selected.
  2. Pause until live account access is available
    Keep the PR paused until a real account validates the session cookie contract and API-key fallback on the rebased head.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Rebase onto current main, regenerate provider manifests, and add a regression test proving a selected Hyper token account bypasses an available browser session.

Technical review

Best possible solution:

Rebase onto current main, regenerate both manifests, make selected token accounts authoritative over ambient sessions, then attach redacted real-account proof for session preference, fallback, and API-key balance display.

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

Not applicable as a bug report; mocked strategy tests exist, but the real session flow has not been exercised on this head.

Is this the best way to solve the issue?

No—the branch needs the current manifest registration path and explicit token-account precedence before its session design can be considered merge-ready.

Full review comments:

  • [P1] Register Hyper through the current provider manifests — Sources/CodexBarCore/Providers/ProviderDescriptor.swift:169
    Current main bootstraps first-party providers through generated descriptor and implementation manifests, not these registry tables. Rebase and regenerate both manifests or Hyper will have no runtime descriptor or implementation.
    Confidence: 0.99
  • [P2] Bypass sessions for selected Hyper token accounts — Sources/CodexBarCore/Providers/Hyper/HyperProviderDescriptor.swift:49-54
    With a selected API-token account, Auto still tries hyper.web first. An available Chrome session can therefore return another account’s balance; force the API strategy or omit the session strategy for selected token accounts.
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.99

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: The optional provider has bounded but user-visible registration and account-correctness blockers.
  • merge-risk: 🚨 compatibility: The branch registers Hyper through superseded registries while current main uses generated manifests.
  • merge-risk: 🚨 auth-provider: Session-first routing can ignore the selected API-token account and the live session contract is unverified.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🌊 off-meta tidepool and patch quality is 🧂 unranked krab.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.

Evidence

Acceptance criteria:

  • [P1] swift test --filter Hyper.
  • [P1] make test.
  • [P1] make check.

What I checked:

Likely related people:

  • steipete: Authored the current manifest refactor and the combined Hyper implementation branch. (role: provider-architecture and feature contributor; confidence: high; commits: a557d0229f90, 83c38bd08336, 27b802af3bab; files: Sources/CodexBarCore/Providers/ProviderManifest.swift, Sources/CodexBar/Providers/Shared/ProviderImplementationManifest.swift, Sources/CodexBarCore/Providers/Hyper/HyperProviderDescriptor.swift)

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.

History

Review history (10 earlier review cycles; latest 8 shown)
  • reviewed 2026-07-30T00:31:46.391Z sha 27b802a :: needs maintainer review before merge. :: none
  • reviewed 2026-07-31T10:42:30.858Z sha 27b802a :: needs maintainer review before merge. :: none
  • reviewed 2026-08-03T11:47:16.751Z sha 27b802a :: found issues before merge. :: [P1] Rebase onto the descriptor-manifest architecture
  • reviewed 2026-08-03T13:54:24.892Z sha 27b802a :: found issues before merge. :: [P1] Register Hyper through the implementation manifest | [P2] Honor selected Hyper API-token accounts
  • reviewed 2026-08-03T15:55:27.916Z sha 27b802a :: found issues before merge. :: [P1] Register Hyper through both provider manifests | [P2] Honor the selected Hyper API-token account
  • reviewed 2026-08-03T19:00:40.016Z sha 27b802a :: found issues before merge. :: [P1] Register Hyper through both current provider manifests | [P2] Bypass sessions for selected Hyper token accounts
  • reviewed 2026-08-03T22:38:57.305Z sha 27b802a :: found issues before merge. :: [P1] Register Hyper through both current provider manifests | [P2] Bypass sessions for selected Hyper token accounts
  • reviewed 2026-08-11T05:01:25.424Z sha 27b802a :: found issues before merge. :: [P1] Register Hyper through the current provider manifests | [P2] Bypass browser sessions for selected Hyper token accounts

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. and removed 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 Jul 30, 2026
My previous merge commit staged unresolved conflict markers. Resolve all
four conflicts for real: keep both the Hyper and xAI provider slugs, icon
cases, and prepaid-balance cost sections; take main's provider ID list with
`hyper` reinserted; bump the advertised provider count to 67 across README,
docs, and all 23 site locales.

Keeping both balance-only cost blocks pushed providerCostSection past the
150-line body limit, so extract the six limit-less prepaid-balance providers
into `balanceOnlyCostSection`.
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. 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. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. 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 Jul 30, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 3, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 auth-provider 🚨 Merging this PR could break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. P2 Normal priority bug or improvement with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant