Skip to content

fix(onboard): remove 21 dead provider auth flags and add missing --codex-api-key #2341

@alexey-pelykh

Description

@alexey-pelykh

Summary

src/commands/onboard-provider-auth-flags.ts declares 24 provider API-key CLI flags for the remoteclaw onboard command, but only 3 are actually consumed by the live wizard (anthropicApiKey, openaiApiKey, geminiApiKey). The remaining 21 flags are parsed, forwarded into OnboardOptions, and silently ignored. Additionally, --codex-api-key is missing from the flag list even though src/wizard/onboarding.ts reads opts.codexApiKey — so non-interactive Codex onboarding is currently broken.

Evidence

Live flag consumers (3 of 24)

From src/wizard/onboarding.ts:

  • Line 114 — opts.anthropicApiKey → Claude runtime credential
  • Line 219 — opts.anthropicApiKey → OpenCode runtime Anthropic sub-provider credential
  • Line 230 — opts.openaiApiKey → OpenCode runtime OpenAI sub-provider credential
  • Line 153 — opts.geminiApiKey → Gemini runtime credential

Dead flags (21 of 24)

Parsed in onboard-provider-auth-flags.ts, forwarded to OnboardOptions in register.onboard.ts:145-169, but no downstream consumer:

mistralApiKey, openrouterApiKey, kilocodeApiKey, aiGatewayApiKey,
cloudflareAiGatewayApiKey, moonshotApiKey, kimiCodeApiKey, zaiApiKey,
xiaomiApiKey, qianfanApiKey, minimaxApiKey, syntheticApiKey, veniceApiKey,
togetherApiKey, huggingfaceApiKey, opencodeZenApiKey, xaiApiKey,
litellmApiKey, volcengineApiKey, byteplusApiKey

The non-interactive path that would handle these (src/commands/onboard-non-interactive/local/auth-choice.ts::applyNonInteractiveAuthChoice) is an explicit no-op:

// Gutted in RemoteClaw fork (Middleware Boundary Principle)
export async function applyNonInteractiveAuthChoice(..._args): Promise<void> {}

So the flags are parsed, forwarded, and silently dropped.

Missing flag: --codex-api-key

src/wizard/onboarding.ts reads opts.codexApiKey (for the Codex runtime credential flow), but no flag registers this option. Effect: non-interactive Codex onboarding cannot provide an API key via CLI flag. Users running remoteclaw onboard --non-interactive --codex-api-key ... get "unknown option" errors; users trying to pre-configure Codex auth in a scripted environment hit a dead end.

This is a regression — issue #478 ("fix(onboard): wire auxiliary provider auth flags to non-interactive onboarding") was closed, but the Codex flag either was never added or was removed.

Proposed Changes

src/commands/onboard-provider-auth-flags.ts

Reduce the flag list to 4 entries:

export const ONBOARD_PROVIDER_AUTH_FLAGS: ReadonlyArray<OnboardProviderAuthFlag> = [
  { flag: "--anthropic-api-key <key>", ... },
  { flag: "--openai-api-key <key>", ... },
  { flag: "--gemini-api-key <key>", ... },
  { flag: "--codex-api-key <key>", ... },  // NEW
];

(Keep file structure; just remove the 20 dead entries and add the codex one.)

src/commands/onboard-types.ts

Remove 20 dead fields from OnboardOptions (all the dead *ApiKey fields listed above). Keep:

  • anthropicApiKey
  • openaiApiKey
  • geminiApiKey
  • codexApiKey

src/cli/program/register.onboard.ts:145-169

Drop the forwarders for the 20 dead flags. Keep the 4 live forwarders.

Help output

Verify that remoteclaw onboard --help shows only the 4 live flags (and no orphan ones).

Tests

  • Add a test asserting --codex-api-key is accepted and reaches the wizard
  • Update or delete existing tests that reference dead flags (e.g. onboard-non-interactive.provider-auth.test.ts is primarily testing the dead handler surface — see the sibling onboard-auth cluster gut issue; this PR should not duplicate that cleanup)

Acceptance Criteria

  • ONBOARD_PROVIDER_AUTH_FLAGS contains exactly 4 entries: anthropic, openai, gemini, codex
  • OnboardOptions contains exactly 4 *ApiKey fields matching the above
  • register.onboard.ts forwards exactly 4 flags into OnboardOptions
  • remoteclaw onboard --help shows only the 4 live flags
  • New test: --codex-api-key <key> end-to-end: flag is accepted, value reaches opts.codexApiKey, wizard consumes it for Codex runtime setup
  • pnpm check passes
  • pnpm test passes
  • Manual smoke test: remoteclaw onboard --non-interactive --codex-api-key test-key ... creates a Codex auth profile successfully

Out of Scope

  • The dead onboard-auth.* cluster (13 files, ~2,500 LoC) — tracked as a separate gut issue. This issue does not depend on that cluster; the flags file is an independent dead-flag problem.
  • onboard-non-interactive.provider-auth.test.ts deletion — covered by the sibling onboard-auth cluster gut issue.
  • Flags for providers that are not one of the 4 fork runtimes (Claude/Gemini/Codex/OpenCode) — intentionally out of scope per Middleware Boundary Principle.

References

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions