wso2 / wso2/api-platform

Fix LLM/MCP Configuration not rehydrated after DB reload

Open
#1,322 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area/AIGateway Type/Bug
Dominant language
Go
Stars
71
Forks
111
Avg merge
1d 14h
Merged PRs (30d)
110

Description

Description

When LLM Provider, LLM Proxy, or MCP configurations are loaded from the database (e.g., after controller restart), unmarshalSourceConfig in sql_store.go only populates SourceConfiguration, leaving Configuration as a zero-value api.APIConfiguration. Multiple code paths depend on Configuration.Spec.AsAPIConfigData() and break silently.

Affected code paths:

  1. matchesFilters (llm_deployment.go:829)ListLLMProviders() / ListLLMProxies() with filter parameters (displayName, version, context, vhost) silently return empty results because AsAPIConfigData() errors and matchesFilters returns false for every config.

  2. translateAPIConfig (translator.go:466)TranslateConfigs() iterates all configs including LLM/MCP. Since Configuration.Kind is zero-value, LLM/MCP configs fall through to translateAPIConfig() which fails on the zero-value Spec. xDS snapshots for these APIs are missing after restart.

  3. transformProxy (llm_transformer.go:109) — Deploying a new LLM proxy after restart fails because the referenced provider's Configuration.Spec.AsAPIConfigData() returns an error when reading vhost info.

Root cause:

In pkg/storage/sql_store.go unmarshalSourceConfig(), the RestApi/WebSubApi cases set both cfg.SourceConfiguration and cfg.Configuration, but the LlmProvider, LlmProxy, and Mcp cases only set cfg.SourceConfiguration.

Fix:

After setting SourceConfiguration for each LLM/MCP kind, rehydrate Configuration by building a minimal api.APIConfiguration with basic metadata (DisplayName, Version, Context, Vhosts, Upstream) derived from the source config — mirroring what the transformers produce at deployment time.

Version

No response

Related Issue

No response

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in pkg/storage/sql_store.go at unmarshalSourceConfig and compare the LlmProvider, LlmProxy, and Mcp cases with RestApi and WebSubApi. Trace the affected paths in llm_deployment.go, translator.go, and llm_transformer.go, then verify that filters, TranslateConfigs, and new LLM proxy deployment work after a database reload.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, backend, database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.