Skip to content

feat(onboard): label CLI candidates with subscription vs API-key auth - #122140

Merged
steipete merged 1 commit into
mainfrom
steipete/cli-auth-kind-labels
Aug 12, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/cli-auth-kind-labels

Conversation

@steipete

@steipete steipete commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Onboarding's pitch is "reuses what you already have — nothing new to sign up for." But a detected Codex or Claude Code CLI candidate can be backed by a flat-rate subscription login (ChatGPT Plus/Pro, Claude Pro/Max) or by a metered API key — and OpenClaw is an always-on workload (heartbeats, cron, channels) where a metered key compounds silently. The candidate row just said "logged in", hiding a real billing difference at the exact moment the user picks their inference route.

Why This Change Was Made

Record the fact where it is detected and show it. The candidate detail string now carries the auth kind:

  • logged in · ChatGPT subscription
  • logged in · Claude subscription
  • logged in · API key (usage-billed)
  • unknown auth kind stays plain logged in; indeterminate login state stays installed. Honest unknowns are never guessed.

Codex classification parses codex login status output exactly per the Codex source (openai/codex @ 3b67b03a3f6): codex-rs/cli/src/main.rs:1394-1407 dispatches login status; codex-rs/cli/src/login.rs:439-484 prints Logged in using ChatGPT (subscription) or Logged in using an API key - <masked> (metered), both exit 0; access-token/PAT/Bedrock states intentionally stay unlabeled. Claude Code classification uses only prompt-free signals (credentials file type, apiKeyHelper, ANTHROPIC_API_KEY) — never the macOS keychain, preserving the existing no-prompt invariant.

Display-only by design: ranking, defaults, auto-selection, and gating are unchanged — the billing/quota tradeoff belongs to the operator.

API-surface note: the injectable deps.detectCodexLoginState seam deliberately keeps its boolean signature. That signature is reachable from the exported detectInferenceBackends options type and is therefore part of the plugin-sdk agent-harness API contract; the rich classification lives in a module-local helper so this PR does not bump the contract hash (a code comment records the constraint).

User Impact

Picking an AI candidate during onboarding is now an informed billing decision. The detail strings flow unchanged through openclaw.setup.detect to the macOS onboarding rows and the CLI wizard — no protocol, Swift, or config changes.

Evidence

  • Live proof on a real install: codex login status → Logged in using ChatGPT (exit 0); real detectInferenceBackends path → {"kind":"codex-cli","detail":"logged in · ChatGPT subscription","credentials":true}.
  • Focused suite src/commands/onboard-inference.test.ts: 34/34 locally and on Blacksmith Testbox (run 31511545507), including table-driven Codex classification (ChatGPT / API key / unrecognized), Claude credential-type and env-key labeling, and unchanged logged-out flows.
  • pnpm plugin-sdk:api:check clean on this head (no contract drift by construction).
  • Blacksmith core production typecheck (run 31511791468), test typecheck (run 31512065859), targeted oxlint (run 31512499852): all passed.
  • Autoreview (branch mode): clean, "patch is correct" at 0.99.

@clawsweeper

clawsweeper Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations size: S maintainer Maintainer-authored PR labels Aug 11, 2026
@steipete
steipete marked this pull request as ready for review August 11, 2026 16:37
@steipete
steipete force-pushed the steipete/cli-auth-kind-labels branch from d6a3feb to d30238a Compare August 11, 2026 16:55
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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. labels Aug 11, 2026
@clawsweeper

clawsweeper Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed August 11, 2026, 11:54 PM ET / August 12, 2026, 03:54 UTC.

ClawSweeper review

What this changes

The PR adds display-only onboarding labels for detected Codex and Claude CLIs to distinguish subscription-backed logins from usage-billed API-key authentication.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

Keep this maintainer-authored PR open: it still presents generic Claude OAuth/token credentials as a paid subscription without the plan metadata that the existing parser preserves for that purpose.

Priority: P2
Reviewed head: 3d3d172713fa6e50680cee5fbeefc679e4a5067a

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The feature has focused evidence, but a concrete P2 billing-label error remains in the implementation.
Proof confidence 🌊 off-meta tidepool Not applicable: Repository state identifies the author as a MEMBER, so the external-contributor proof gate does not apply; the PR body also records after-fix live CLI and detector output.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Repository state identifies the author as a MEMBER, so the external-contributor proof gate does not apply; the PR body also records after-fix live CLI and detector output.
Evidence reviewed 6 items Incorrect Claude subscription classification: The PR labels every parsed Claude oauth or token credential as a subscription, regardless of whether a plan is known.
Existing plan metadata: The credential parser retains subscriptionType and rateLimitTier, with a source comment identifying them as the facts usage surfaces need to label subscription windows.
User-visible propagation: Setup detection calls the backend detector and maps its candidate detail into the setup response consumed by onboarding clients.
Findings 1 actionable finding [P2] Gate Claude subscription labels on plan metadata
Security None None.

How this fits together

The Gateway-owned onboarding detector probes local CLIs and credentials, then returns inference candidates to the setup flow. Candidate details are passed unchanged to the CLI wizard and macOS onboarding UI before a selected route is live-tested and saved.

flowchart LR
  A[Local CLI status and credentials] --> B[Inference backend detector]
  B --> C[Authentication label decision]
  C --> D[Gateway setup detection]
  D --> E[CLI setup wizard]
  D --> F[macOS onboarding]
Loading

Before merge

  • Gate Claude subscription labels on plan metadata (P2) - oauth and token are credential transport modes, not proof of a paid plan. The parser already preserves subscriptionType and rateLimitTier for subscription labeling, so an OAuth/token record without either is incorrectly shown as a subscription. Keep it neutral until that metadata is present and cover both absent and present metadata.
  • Resolve merge risk (P1) - Merging as written can tell a user with an unclassified Claude OAuth/token credential that it is a subscription, undermining the billing information this UI is meant to provide.
  • Resolve merge risk (P1) - The Codex status-output contract could not be independently inspected because the required sibling checkout is absent and network access is unavailable; this is a reviewer limitation, not missing contributor proof.
  • Complete next step (P2) - The repair is clear, but this protected maintainer PR should remain human-owned until the existing P2 finding is addressed.

Findings

  • [P2] Gate Claude subscription labels on plan metadata — src/commands/onboard-inference.ts:115-116
Agent review details

Security

None.

PR surface

Source +51, Tests +48. Total +99 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 71 20 +51
Tests 1 53 5 +48
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 124 25 +99

Review metrics

Metric Value Why it matters
Production vs test LOC production +71/-20 (net +51); tests +53/-5 (net +48) The feature adds classification logic and focused onboarding cases; the remaining P2 is correctness, not the justified feature growth.

Merge-risk options

Maintainer options:

  1. Require Claude plan metadata (recommended)
    Gate the Claude subscription detail on parser-provided plan metadata and keep unknown OAuth/token records neutral.

Technical review

Best possible solution:

Show the Claude subscription label only when the parsed credential includes valid plan metadata; otherwise retain the neutral logged-in detail and test both paths.

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

Yes, source-reproducible: a Claude credential with only type: "oauth" or type: "token" reaches the new subscription branch despite having no plan metadata. The read-only checkout prevented executing the focused test.

Is this the best way to solve the issue?

No: the branch has the right owner boundary but ignores existing plan metadata, so it is not yet the safest way to present billing information.

Full review comments:

  • [P2] Gate Claude subscription labels on plan metadata — src/commands/onboard-inference.ts:115-116
    oauth and token are credential transport modes, not proof of a paid plan. The parser already preserves subscriptionType and rateLimitTier for subscription labeling, so an OAuth/token record without either is incorrectly shown as a subscription. Keep it neutral until that metadata is present and cover both absent and present metadata.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.
  • remove merge-risk: 🚨 compatibility: Current PR review merge-risk labels are merge-risk: 🚨 auth-provider.

Label justifications:

  • P2: This is a bounded onboarding-information defect that can mislead an operator's provider choice without changing runtime routing.
  • merge-risk: 🚨 auth-provider: The PR changes authentication and billing labels shown while selecting a provider route, and the Claude label is not supported by its available credential facts.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: Repository state identifies the author as a MEMBER, so the external-contributor proof gate does not apply; the PR body also records after-fix live CLI and detector output.

Evidence

What I checked:

Likely related people:

  • steipete: Peter Steinberger authored both the PR-head classifier and the current-main credential parser that preserves the relevant plan metadata. (role: recent onboarding and credential-path contributor; confidence: high; commits: 3d3d172713fa, 76c7cd73085e; files: src/commands/onboard-inference.ts, src/agents/cli-credentials.ts)

Rank-up moves

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

  • Use subscriptionType or rateLimitTier to gate the Claude subscription label, and add absent-metadata and present-metadata cases.

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 (9 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-11T19:02:46.387Z sha 5c630073c717edb225d9fd4ed0ab216e77b85a1f :: found issues before merge. :: [P2] Verify Codex status output against its source contract
  • reviewed 2026-08-11T20:01:32.940Z sha 9213b13 :: found issues before merge. :: [P2] Accept the legacy API-key status
  • reviewed 2026-08-11T20:55:19.783Z sha cbaa05d :: needs changes before merge. :: [P2] Recognize the legacy API-key status
  • reviewed 2026-08-11T22:02:02.192Z sha cbaa05d :: found issues before merge. :: [P2] Avoid presenting auth mode as a billing plan
  • reviewed 2026-08-11T23:02:18.091Z sha 8e7facc172d65a354841ea63396b5b38da488ec2 :: needs changes before merge. :: [P2] Use entitlement metadata before labeling Claude a subscription
  • reviewed 2026-08-12T01:03:18.312Z sha 290bbd6f12141bce539f5f43c48a7026f682a81b :: found issues before merge. :: [P2] Require plan metadata for the Claude subscription label
  • reviewed 2026-08-12T02:07:29.023Z sha 2adfe0a9ad2710ccdc22cc536c6ce08ab8ccaf68 :: found issues before merge. :: [P2] Require entitlement metadata before showing a Claude subscription
  • reviewed 2026-08-12T03:17:51.631Z sha 049c2fb :: found issues before merge. :: [P1] Preserve the agent-harness-reachable override contract | [P2] Require plan metadata before showing a Claude subscription

@steipete
steipete force-pushed the steipete/cli-auth-kind-labels branch from d30238a to 5c63007 Compare August 11, 2026 18:34
@clawsweeper clawsweeper Bot added merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. 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: 🐚 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. labels Aug 11, 2026
@steipete
steipete force-pushed the steipete/cli-auth-kind-labels branch from 5c63007 to 9213b13 Compare August 11, 2026 19:31
@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Aug 11, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Aug 11, 2026
@openclaw-barnacle openclaw-barnacle Bot reopened this Aug 11, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. and removed P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Aug 11, 2026
@openclaw-barnacle openclaw-barnacle Bot reopened this Aug 11, 2026
@steipete
steipete force-pushed the steipete/cli-auth-kind-labels branch from cbaa05d to 8e7facc Compare August 11, 2026 22:24
@clawsweeper clawsweeper Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Aug 11, 2026
@steipete
steipete force-pushed the steipete/cli-auth-kind-labels branch 3 times, most recently from 2adfe0a to 049c2fb Compare August 12, 2026 03:11
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 12, 2026
@steipete
steipete force-pushed the steipete/cli-auth-kind-labels branch from 049c2fb to 1958067 Compare August 12, 2026 03:26
Detected Codex/Claude Code CLI candidates now say whether they ride a
flat-rate subscription login (ChatGPT, Claude) or a metered API key, so
picking one is an informed billing decision for an always-on assistant.
Codex classification parses `codex login status` output per
codex-rs/cli/src/login.rs; Claude uses prompt-free credential-file and
env/apiKeyHelper signals only (never the keychain). Unknown states keep
the plain 'logged in'. Display-only: ranking and defaults unchanged.
@steipete
steipete force-pushed the steipete/cli-auth-kind-labels branch from 1958067 to 3d3d172 Compare August 12, 2026 03:46
@openclaw-barnacle openclaw-barnacle Bot removed the docs Improvements or additions to documentation label Aug 12, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Aug 12, 2026
@steipete
steipete merged commit 630aac9 into main Aug 12, 2026
134 checks passed
@steipete
steipete deleted the steipete/cli-auth-kind-labels branch August 12, 2026 04:02
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 12, 2026
…openclaw#122140)

Detected Codex/Claude Code CLI candidates now say whether they ride a
flat-rate subscription login (ChatGPT, Claude) or a metered API key, so
picking one is an informed billing decision for an always-on assistant.
Codex classification parses `codex login status` output per
codex-rs/cli/src/login.rs; Claude uses prompt-free credential-file and
env/apiKeyHelper signals only (never the keychain). Unknown states keep
the plain 'logged in'. Display-only: ranking and defaults unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations maintainer Maintainer-authored PR merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S 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