Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@PeterDaveHello
Copy link
Contributor

Context

PR #5270 added openai-codex provider but the implementation was incomplete - it included runtime validation and UI metadata, but missed the TypeScript type definition in @kilocode/core-schemas and model mapping in cli/src/config/mapper.ts.

This bug was discovered while developing the CLI providers API command (branch feat/cli-subcommands-discoverability), which needs to enumerate and display all configured providers with their model information. When attempting to add case "openai-codex": to the switch statement, TypeScript reported:

error TS2678: Type '"openai-codex"' is not comparable to type ...

Implementation

packages/core-schemas/src/config/provider.ts:

  • Created openAICodexProviderSchema with apiModelId field
  • Added to providerConfigSchema discriminated union (line 398)
  • Exported OpenAICodexProviderConfig type (line 444)
  • Marked with kilocode_change (per CLAUDE.md - packages/ requires markers)

cli/src/config/mapper.ts:

  • Added openai-codex case alongside openai-native (both use apiModelId)

openai-codex now matches the pattern of openai-native and can be properly handled in type-safe code.

Screenshots

N/A (type definition fix)

How to Test

pnpm check-types  # All 20 packages should pass

Get in Touch

@PeterDaveHello

@changeset-bot
Copy link

changeset-bot bot commented Jan 23, 2026

🦋 Changeset detected

Latest commit: e4076d9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@kilocode/core-schemas Patch
kilo-code Patch
@kilocode/cli Patch
@kilocode/agent-runtime Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@PeterDaveHello PeterDaveHello marked this pull request as draft January 23, 2026 19:34
## Problem

PR Kilo-Org#5270 (merged 2026-01-21) added openai-codex provider support
but did not include the TypeScript type definition in
@kilocode/core-schemas. This causes compilation errors when code
attempts to handle openai-codex in switch statements:

  error TS2678: Type '"openai-codex"' is not comparable to type ...

The provider was added to:
- cli/src/constants/providers/validation.ts (runtime validation)
- cli/src/constants/providers/labels.ts (UI labels)
- cli/src/constants/providers/settings.ts (default settings)

But missing from:
- packages/core-schemas/src/config/provider.ts (TypeScript types)
- cli/src/config/mapper.ts (model field mapping)

## Impact

Any code using switch/case on provider.provider that includes
openai-codex will fail TypeScript compilation. This blocks:
- CLI providers API command (needs to map openai-codex model field)
- Any future switch-based provider handling logic

## Solution

This adds the missing type definition:
- Created openAICodexProviderSchema with apiModelId field
- Added to providerConfigSchema discriminated union (line 396)
- Exported OpenAICodexProviderConfig type (line 442)
- Added openai-codex mapping in CLI provider model handling
  (apiModelId)

openai-codex now matches the pattern of openai-native (both use
apiModelId).

## Verification

Type checking:
  pnpm check-types

CLI tests:
  cd cli && pnpm test

Related: Kilo-Org#5270
@PeterDaveHello PeterDaveHello force-pushed the fix/openai-codex-type-definition branch from a93feb3 to e4076d9 Compare January 23, 2026 19:52
@PeterDaveHello PeterDaveHello marked this pull request as ready for review January 23, 2026 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants