feat(config): Add support for XAI providers and migrate config files - #663
Merged
Conversation
haiphucnguyen
commented
Aug 22, 2026
Collaborator
- Enables integration with XAI provider settings and metadata.
- Automatically migrates legacy configuration entries to use OPENAI_COMPATIBLE provider type.
- Ensures configuration compatibility across provider updates.
- Enables integration with XAI provider settings and metadata. - Automatically migrates legacy configuration entries to use OPENAI_COMPATIBLE provider type. - Ensures configuration compatibility across provider updates. BREAKING CHANGE: Old configuration files referencing removed local providers will be migrated to use the OPENAI_COMPATIBLE provider type.
There was a problem hiding this comment.
Pull request overview
This PR adds configuration support for the XAI provider and introduces a one-time migration path for legacy “local provider” config entries so they continue to work under the OPENAI_COMPATIBLE provider type.
Changes:
- Added one-time YAML migration logic to convert legacy
provider_typevalues toOPENAI_COMPATIBLEand backfilltemplate_namewhen missing. - Updated CLI tests to exercise saving contexts for XAI, Anthropic, and OpenAI-compatible (Ollama) providers.
- Updated GraalVM native-image reflection configuration (feature registration + reachability metadata) to include XAI/Anthropic settings accessors.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| shared/src/main/kotlin/io/askimo/core/config/AppConfig.kt | Adds config migration for legacy provider entries during initial load. |
| cli/src/test/kotlin/io/askimo/core/config/AppConfigTest.kt | Updates context save tests to include XAI/Anthropic and OpenAI-compatible template settings. |
| cli/src/main/resources/META-INF/native-image/io.askimo/cli/reachability-metadata.json | Expands reachability metadata for XAI/Anthropic settings (methods + serializers). |
| cli/src/main/kotlin/io/askimo/cli/graal/AskimoFeature.kt | Registers XAI settings for reflection in the native-image feature configuration. |
Suppressed comments (1)
shared/src/main/kotlin/io/askimo/core/config/AppConfig.kt:736
- The migration regex for legacy providers is inconsistent:
legacyWithNullTemplatePatternmatchesDOCKERbut the subsequent mapping /legacyTypePatternexpectsDOCKER_AI. As written, a config withprovider_type: DOCKER_AIwill be migrated toOPENAI_COMPATIBLEwithout populatingtemplate_name, and a config withprovider_type: DOCKERmay keep an unmigrated provider type that can’t be deserialized intoModelProvideranymore. Align the patterns and make the template mapping exhaustive sotemplate_nameis always set correctly for these legacy values.
val legacyWithNullTemplatePattern = Regex(
"""(?ms)(-\s+id:.*?provider_type\s*:\s*"?)(DOCKER|LMSTUDIO|OLLAMA|LOCALAI)("?.*?template_name\s*:\s*)(null|~|""|'')(\s*(?:\n|$))""",
)
val withTemplateNames = legacyWithNullTemplatePattern.replace(raw) { m ->
val legacyType = m.groupValues[2]
val templateName = when (legacyType) {
"DOCKER_AI" -> "DOCKER_AI"
"LMSTUDIO" -> "LMSTUDIO"
"OLLAMA" -> "OLLAMA"
"LOCALAI" -> "LOCALAI"
else -> ""
}
"${m.groupValues[1]}$legacyType${m.groupValues[3]}$templateName${m.groupValues[5]}"
}
val legacyTypePattern = Regex("""(provider_type\s*:\s*"?)(DOCKER_AI|LMSTUDIO|OLLAMA|LOCALAI)("?)""")
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.