Skip to content

block creating new versions from built-in LLM provider templates#2764

Merged
Tharanidk merged 3 commits into
wso2:mainfrom
Tharanidk:custom-templates
Jul 21, 2026
Merged

block creating new versions from built-in LLM provider templates#2764
Tharanidk merged 3 commits into
wso2:mainfrom
Tharanidk:custom-templates

Conversation

@Tharanidk

@Tharanidk Tharanidk commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Purpose

Built-in LLM provider templates should be immutable, and new versions are added only by WSO2 via the seed data. Previously, users could add versions directly to a built-in family. This PR blocks that, and users can copy a built-in into their own custom template instead.

Changes

  • platform-api: CreateVersion now rejects built-in (wso2) template families with a new LLMProviderTemplateBuiltInImmutable error (HTTP 403).
  • Reserve the wso2- group_id namespace for built-in templates.
  • Update the group_ids of built-in template YAMLs accordingly.
  • AI Workspace: update the create/overview template screens to reflect that built-in templates cannot have new versions (copy-to-customize flow instead).

UI Changes

  • Cannot create a new version from built-in templates. Can create a copy using the copy button in the overview.
image
  • Provider listing is showing in alphabatical order.
image

Resolves: #2763

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Default LLM provider templates now use wso2-* group IDs. Custom template creation avoids that namespace, built-in version creation returns 403, and the workspace supports copying built-in templates while resolving custom template display names.

Changes

LLM provider template lifecycle

Layer / File(s) Summary
Built-in identifiers and API contract
gateway/gateway-controller/default-llm-provider-templates/*, platform-api/resources/default-llm-provider-templates/*, platform-api/internal/constants/constants.go, platform-api/internal/apperror/*, platform-api/resources/openapi.yaml
Default provider group IDs use the wso2-* namespace, with reserved-prefix constants, immutable-template errors, and OpenAPI documentation updated.
Reserved group IDs and version immutability
platform-api/internal/repository/*, platform-api/internal/service/llm.go, platform-api/internal/service/llm_provider_template_test.go
Custom generated group IDs in the reserved namespace are rewritten, and new versions of WSO2-managed families are rejected after ownership lookup.
Built-in template copy flow
portals/ai-workspace/src/pages/appShell/appShellPages/providerTemplate/*
Built-in templates expose “Create a copy”; the create page initializes copied fields, authentication, token configuration, and resource mappings.
Provider template display resolution
portals/ai-workspace/src/utils/providerTemplateDisplay.ts, portals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/*
Provider views resolve display names from loaded template IDs, family IDs, or group IDs, and template selection is sorted by display name.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

Suggested reviewers: renuka-fernando, ashera96, malinthaprasan, pubudu538, thivindu

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (3 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The alphabetical sorting of provider cards appears unrelated to the linked issue and is an extra UI change beyond the requested template immutability work. Split the provider-card sorting change into a separate PR unless it is required for the linked issue.
Docstring Coverage ⚠️ Warning Docstring coverage is 23.53% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description covers purpose, changes, and UI impact, but most required template sections are missing or unfilled. Add the missing Goals, Approach, User stories, Documentation, Automation tests, Security checks, Samples, Related PRs, and Test environment sections.
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The code matches the linked issue by blocking built-in version creation, reserving wso2- group IDs, supporting copies, and rewriting conflicting prefixes.
Title check ✅ Passed The title matches the main change: built-in templates can no longer be versioned, though users can copy them instead.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@platform-api/resources/openapi.yaml`:
- Around line 1123-1126: Update the copy-operation examples in the OpenAPI
documentation to use the reserved built-in template handle namespace, replacing
openai-v3-0 and openai-v4-0 with corresponding wso2-openai-* handles. If these
examples are intended to represent custom templates, explicitly label them as
such instead.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: fbeb8353-1883-4818-b9c9-58f68fbb303a

📥 Commits

Reviewing files that changed from the base of the PR and between e1426b0 and 259bb0b.

📒 Files selected for processing (28)
  • gateway/gateway-controller/default-llm-provider-templates/anthropic-template.yaml
  • gateway/gateway-controller/default-llm-provider-templates/awsbedrock-template.yaml
  • gateway/gateway-controller/default-llm-provider-templates/azureaifoundry-template.yaml
  • gateway/gateway-controller/default-llm-provider-templates/azureopenai-template.yaml
  • gateway/gateway-controller/default-llm-provider-templates/gemini-template.yaml
  • gateway/gateway-controller/default-llm-provider-templates/mistral-template.yaml
  • gateway/gateway-controller/default-llm-provider-templates/openai-template.yaml
  • platform-api/internal/apperror/catalog.go
  • platform-api/internal/apperror/codes.go
  • platform-api/internal/constants/constants.go
  • platform-api/internal/repository/interfaces.go
  • platform-api/internal/repository/llm.go
  • platform-api/internal/service/llm.go
  • platform-api/internal/service/llm_provider_template_test.go
  • platform-api/resources/default-llm-provider-templates/anthropic-template.yaml
  • platform-api/resources/default-llm-provider-templates/awsbedrock-template.yaml
  • platform-api/resources/default-llm-provider-templates/azureaifoundry-template.yaml
  • platform-api/resources/default-llm-provider-templates/azureopenai-template.yaml
  • platform-api/resources/default-llm-provider-templates/gemini-template.yaml
  • platform-api/resources/default-llm-provider-templates/mistral-template.yaml
  • platform-api/resources/default-llm-provider-templates/openai-template.yaml
  • platform-api/resources/openapi.yaml
  • portals/ai-workspace/src/pages/appShell/appShellPages/providerTemplate/CreateProviderTemplate.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/providerTemplate/ProviderTemplateOverview.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/ProvidersList.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/ServiceProviderOverview.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/ServiceProvidersSummaryCard.tsx
  • portals/ai-workspace/src/utils/providerTemplateDisplay.ts

Comment thread platform-api/resources/openapi.yaml
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 21, 2026
@Tharanidk
Tharanidk merged commit f554808 into wso2:main Jul 21, 2026
24 of 25 checks passed
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.

[Improvement]: Reserve wso2- prefix for built-in LLM provider templates and not allowing to create versions of built in templates

3 participants