test: harden kilocode auth flow and add onboarding regressions#20280
test: harden kilocode auth flow and add onboarding regressions#20280WantedChef wants to merge 7 commits intoopenclaw:mainfrom
Conversation
Add support for Kilo Gateway as a model provider, similar to OpenRouter. Kilo Gateway provides a unified API that routes requests to many models behind a single endpoint and API key. Changes: - Add kilocode provider option to auth-choice and onboarding flows - Add KILOCODE_API_KEY environment variable support - Add kilocode/ model prefix handling in model-auth and extra-params - Add provider documentation in docs/providers/kilocode.md - Update model-providers.md with Kilo Gateway section - Add design doc for the integration
…le model refs and CLI name in docs, fix TS2742
|
|
||
| ## Overview | ||
|
|
||
| This document outlines the design for integrating "Kilo Gateway" as a first-class provider in Moltbot, modeled after the existing OpenRouter implementation. Kilo Gateway uses an OpenAI-compatible completions API with a different base URL. |
There was a problem hiding this comment.
Stale "Moltbot" references in design doc
The design doc references "Moltbot" and MoltbotConfig (lines 5, 116, 155), which is the project's legacy name. The current project name is OpenClaw and the config type is OpenClawConfig. While this is a design doc and not runtime code, it could confuse future readers.
Also, line 29 mentions "Claude Opus 4.5" as the default model, but the actual implementation uses claude-opus-4.6.
Prompt To Fix With AI
This is a comment left during a code review.
Path: docs/design/kilo-gateway-integration.md
Line: 5:5
Comment:
**Stale "Moltbot" references in design doc**
The design doc references "Moltbot" and `MoltbotConfig` (lines 5, 116, 155), which is the project's legacy name. The current project name is OpenClaw and the config type is `OpenClawConfig`. While this is a design doc and not runtime code, it could confuse future readers.
Also, line 29 mentions "Claude Opus 4.5" as the default model, but the actual implementation uses `claude-opus-4.6`.
How can I resolve this? If you propose a fix, please make it concise.| - Kilo Gateway: `kilocode` (`KILOCODE_API_KEY`) | ||
| - Example model: `kilocode/anthropic/claude-opus-4.6` |
There was a problem hiding this comment.
Kilo Gateway listed twice in docs
Kilo Gateway now appears both as its own dedicated subsection (### Kilo Gateway, line 129) and again in the ### Other built-in providers list (lines 143–144). Consider removing the duplicate entry from "Other built-in providers" to avoid redundancy, similar to how Vercel AI Gateway has its own section but isn't repeated in the "Other" list.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix With AI
This is a comment left during a code review.
Path: docs/concepts/model-providers.md
Line: 143:144
Comment:
**Kilo Gateway listed twice in docs**
Kilo Gateway now appears both as its own dedicated subsection (`### Kilo Gateway`, line 129) and again in the `### Other built-in providers` list (lines 143–144). Consider removing the duplicate entry from "Other built-in providers" to avoid redundancy, similar to how Vercel AI Gateway has its own section but isn't repeated in the "Other" list.
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise.
Summary
kilocode-api-keyauth flow to ignore legacy non-API-key profiles (oauth/token)Why
PR #20212 introduced Kilo provider support. The interactive auth branch accepted legacy
oauth/tokenprofiles as valid credentials, which could skip API-key collection and leave Kilo misconfigured.Testing
pnpm vitest run src/agents/models-config.providers.kilocode.test.ts src/commands/onboard-auth.config-core.kilocode.test.ts src/agents/pi-embedded-runner/kilocode.test.tsauth-choice.e2eandonboard-non-interactive.provider-auth.e2ewere updated for coverage (project vitest config currently excludes*.e2e.test.tsin default run)Greptile Summary
This PR integrates Kilo Gateway (
kilocode) as a first-class provider in OpenClaw. It adds the full auth flow (interactive + non-interactive + env-var inference), provider configuration, model definitions, cache TTL eligibility, transcript policy handling, CLI flags, and comprehensive test coverage. The key fix is filtering out legacyoauth/tokenprofiles during the interactivekilocode-api-keyauth flow, ensuring onlyapi_keycredentials are accepted.auth-choice.apply.api-providers.tscorrectly ignores legacy oauth/token profiles and falls through to API-key collection. Non-interactive handler inonboard-non-interactive/local/auth-choice.tsfollows established patterns.buildKilocodeProvider()(implicit resolution) andbuildKilocodeModelDefinition()(onboarding) both define the same model constants — this duplication mirrors how the codebase separates the two code paths but the constants could drift if updated in only one location.kilo-gateway-integration.md) and provider doc (kilocode.md) added. The design doc contains stale references to "Moltbot" (legacy project name) andMoltbotConfig(should beOpenClawConfig). Kilo Gateway is listed twice inmodel-providers.md(dedicated section + "Other" list).Confidence Score: 4/5
docs/design/kilo-gateway-integration.mdhas stale "Moltbot" references.docs/concepts/model-providers.mdhas Kilo Gateway listed in two places.Last reviewed commit: 0901718
(5/5) You can turn off certain types of comments like style here!