Skip to content

wizard: add manual endpoint type selection when custom provider detection fails - #23117

Closed
wjonaskr wants to merge 1 commit into
openclaw:mainfrom
wjonaskr:fix/custom-provider-manual-type-selection
Closed

wjonaskr wants to merge 1 commit into
openclaw:mainfrom
wjonaskr:fix/custom-provider-manual-type-selection

Conversation

@wjonaskr

@wjonaskr wjonaskr commented Feb 22, 2026 •

Copy link
Copy Markdown

Summary

  • Problem: When openclaw onboard with "Custom Provider" fails to auto-detect the endpoint type (OpenAI/Anthropic), the wizard only offers retrying URL/model — no way to manually specify the type. The user gets stuck in a loop and ends up with no models.providers entry in config.
  • Why it matters: Blocks all users with custom OpenAI-compatible proxies (Bedrock Access Gateway, LiteLLM, vLLM, corporate gateways) from completing onboarding. They must manually edit openclaw.json with an undocumented schema.
  • What changed: Added "Select endpoint type manually" as the first option in the retry prompt when detection fails. Selecting it lets the user choose OpenAI or Anthropic, then proceeds to write a complete models.providers config entry.
  • What did NOT change (scope boundary): Auto-detection logic, named provider flows, non-interactive onboarding, and applyCustomApiConfig are untouched.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • None

User-visible / Behavior Changes

When endpoint auto-detection fails during openclaw onboard with a custom provider, the retry prompt now shows a new first option: "Select endpoint type manually". Choosing it presents an OpenAI/Anthropic selector and proceeds without re-probing, writing a working models.providers config entry.

Existing retry options (Change base URL / Change model / Change both) remain unchanged.

Security Impact (required)

  • New permissions/capabilities? No
  • Secrets/tokens handling changed? No
  • New/changed network calls? No
  • Command/tool execution surface changed? No
  • Data access scope changed? No

Repro + Verification

Environment

  • OS: macOS 15.7.4
  • Runtime/container: Node 24.13.1
  • Model/provider: Custom OpenAI-compatible Bedrock proxy (AWS API Gateway)
  • Relevant config (redacted): Custom provider base URL pointing to an API Gateway endpoint

Steps

  1. Run openclaw onboard, choose "Custom Provider"
  2. Enter a Bedrock proxy URL + API key + model ID
  3. Choose "Unknown (detect automatically)"
  4. Detection fails → select "Select endpoint type manually" → choose "OpenAI-compatible"

Expected

  • Wizard proceeds and writes a complete models.providers entry to config

Actual (before fix)

  • Only retry options for URL/model; no way to manually specify type; config ends up without provider entry

Evidence

  • Failing test/log before + passing after

New test: allows manual type selection when detection fails — verifies the full flow from detection failure through manual selection to correct config output.

All 13 e2e tests pass: pnpm vitest run src/commands/onboard-custom.e2e.test.ts --config vitest.e2e.config.ts

Human Verification (required)

  • Verified scenarios: Full onboarding flow with a real Bedrock proxy endpoint that fails auto-detection
  • Edge cases checked: Existing retry flows (baseUrl/model/both) still work; test suite confirms
  • What you did not verify: Anthropic-compatible manual selection path (tested OpenAI path only)

Compatibility / Migration

  • Backward compatible? Yes
  • Config/env changes? No
  • Migration needed? No

Failure Recovery (if this breaks)

  • How to disable/revert this change quickly: Revert the single commit
  • Files/config to restore: src/commands/onboard-custom.ts
  • Known bad symptoms reviewers should watch for: Wizard skipping verification when it shouldn't

Risks and Mitigations

  • Risk: User selects wrong endpoint type manually, gets a broken config
    • Mitigation: This is the same risk as explicitly choosing OpenAI/Anthropic in the initial compatibility prompt. The manual selection is an escape hatch, not the default path.

Greptile Summary

Added manual endpoint type selection as an escape hatch when auto-detection fails during custom provider onboarding. This solves the issue where users with OpenAI-compatible proxies that fail detection would get stuck in a retry loop.

Key changes:

  • Added "selectType" option to retry prompt when detection fails
  • Manual selection bypasses verification (intentional escape hatch per PR description)
  • Includes test coverage for the new flow

Critical issue found:

  • Missing selectType handling at line 674 can cause infinite loop when verification fails after explicit compatibility choice (not during detection)

Confidence Score: 2/5

  • Infinite loop bug when selectType is chosen during verification failure makes this unsafe to merge
  • Core feature works (manual type selection during detection failure) but critical logic error at line 674 causes infinite loop when selectType chosen after verification failure with explicit compatibility choice. The missing case handling is a blocker.
  • Pay close attention to src/commands/onboard-custom.ts line 674 - requires additional case handling for selectType

Last reviewed commit: c6fb251

(2/5) Greptile learns from your feedback when you react with thumbs up/down!

@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations size: XS labels Feb 22, 2026

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

2 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@greptile-apps

greptile-apps Bot commented Feb 22, 2026

Copy link
Copy Markdown
Contributor
Additional Comments (1)

src/commands/onboard-custom.ts
Missing handling for selectType choice. When verification fails after an explicit compatibility selection (not "unknown"), selecting selectType at line 674 will cause an infinite loop because:

  1. None of the if statements (675, 683, 686) handle selectType
  2. If compatibilityChoice !== "unknown", compatibility stays set
  3. Loop continues with same values → verifies again → fails → prompts again → infinite loop

Need to add handling similar to lines 622-638.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/commands/onboard-custom.ts
Line: 674-688

Comment:
Missing handling for `selectType` choice. When verification fails after an explicit compatibility selection (not "unknown"), selecting `selectType` at line 674 will cause an infinite loop because:
1. None of the if statements (675, 683, 686) handle `selectType`
2. If `compatibilityChoice !== "unknown"`, `compatibility` stays set
3. Loop continues with same values → verifies again → fails → prompts again → infinite loop

Need to add handling similar to lines 622-638.

How can I resolve this? If you propose a fix, please make it concise.

… detection fails

When `openclaw onboard` with a custom provider fails to auto-detect the
endpoint type, the wizard now offers "Select endpoint type manually" as
the first retry option. This unblocks users with OpenAI-compatible proxies
(Bedrock Access Gateway, LiteLLM, vLLM, corporate gateways) that fail
auto-detection.

Changes:
- Add `selectType` to CustomApiRetryChoice and retry prompt
- Extract `promptManualEndpointType` helper (OpenAI/Anthropic selector)
- Handle `selectType` in detection failure path (break, escape hatch)
- Handle `selectType` in verification failure path (continue, re-verify)
- Add e2e tests for both paths
@wjonaskr

Copy link
Copy Markdown
Author

Superseded by v2 PR rebased on latest main. The original had a missing selectType handler in the verification failure path (caught by Greptile). The new PR fixes both paths and adds tests for each.

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

Labels

commands Command implementations size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant