Skip to content

test: harden kilocode auth flow and add onboarding regressions#20280

Closed
WantedChef wants to merge 7 commits intoopenclaw:mainfrom
WantedChef:wantedchef/kilocode-followup-auth-fixes
Closed

test: harden kilocode auth flow and add onboarding regressions#20280
WantedChef wants to merge 7 commits intoopenclaw:mainfrom
WantedChef:wantedchef/kilocode-followup-auth-fixes

Conversation

@WantedChef
Copy link

@WantedChef WantedChef commented Feb 18, 2026

Summary

  • fix interactive kilocode-api-key auth flow to ignore legacy non-API-key profiles (oauth/token)
  • add regression coverage for interactive Kilo env-key flow
  • add regression coverage for non-interactive Kilo auth-choice (explicit and inferred)

Why

PR #20212 introduced Kilo provider support. The interactive auth branch accepted legacy oauth/token profiles 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.ts
  • auth-choice.e2e and onboard-non-interactive.provider-auth.e2e were updated for coverage (project vitest config currently excludes *.e2e.test.ts in 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 legacy oauth/token profiles during the interactive kilocode-api-key auth flow, ensuring only api_key credentials are accepted.

  • Auth flow: Interactive handler in auth-choice.apply.api-providers.ts correctly ignores legacy oauth/token profiles and falls through to API-key collection. Non-interactive handler in onboard-non-interactive/local/auth-choice.ts follows established patterns.
  • Provider config: buildKilocodeProvider() (implicit resolution) and buildKilocodeModelDefinition() (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.
  • Tests: Good regression coverage added for the env-key flow, legacy profile filtering, non-interactive auth-choice inference, cache TTL eligibility, and provider config application.
  • Docs: New design doc (kilo-gateway-integration.md) and provider doc (kilocode.md) added. The design doc contains stale references to "Moltbot" (legacy project name) and MoltbotConfig (should be OpenClawConfig). Kilo Gateway is listed twice in model-providers.md (dedicated section + "Other" list).

Confidence Score: 4/5

  • This PR is safe to merge — it adds a new provider following well-established patterns with no functional regressions to existing code.
  • The implementation closely follows existing provider patterns (OpenRouter, Moonshot, xAI). The core auth-flow fix correctly filters legacy profiles. Test coverage is thorough. The only concerns are documentation-level: stale naming in the design doc and a duplicate listing in model-providers.md. No runtime issues found.
  • The design doc docs/design/kilo-gateway-integration.md has stale "Moltbot" references. docs/concepts/model-providers.md has Kilo Gateway listed in two places.

Last reviewed commit: 0901718

(5/5) You can turn off certain types of comments like style here!

markijbema and others added 7 commits February 18, 2026 11:40
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
@WantedChef WantedChef mentioned this pull request Feb 18, 2026
18 tasks
@openclaw-barnacle openclaw-barnacle bot added docs Improvements or additions to documentation cli CLI command changes commands Command implementations agents Agent runtime and tooling size: L labels Feb 18, 2026
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

25 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile


## 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.
Copy link
Contributor

Choose a reason for hiding this comment

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

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.

Comment on lines +143 to +144
- Kilo Gateway: `kilocode` (`KILOCODE_API_KEY`)
- Example model: `kilocode/anthropic/claude-opus-4.6`
Copy link
Contributor

Choose a reason for hiding this comment

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

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.

@WantedChef WantedChef closed this Feb 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling cli CLI command changes commands Command implementations docs Improvements or additions to documentation size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants