Skip to content

Fix UI bugs in AI Workspace - #2909

Merged
Tharanidk merged 8 commits into
wso2:mainfrom
Tharanidk:uibugs
Jul 28, 2026
Merged

Fix UI bugs in AI Workspace#2909
Tharanidk merged 8 commits into
wso2:mainfrom
Tharanidk:uibugs

Conversation

@Tharanidk

@Tharanidk Tharanidk commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Purpose

This several UI bugs as follows.

  1. Fix the listing issue in provider templates listing.

  2. Fix the Endpoint URL validation issue under the connection tab of the LLM provider template.
    Resolves: [Bug]: LLM Provider Templates UI Bugs #2891

  3. Fix the issue of a duplicate API key name showing a generic error under LLM provider / LLM proxy

image

Resolves: #2880

  1. Fix the issue of the "Add Guardrails" step never being completed when a guardrail is added.
image

resolves: #2895

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@Tharanidk, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 40 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 7c8e3398-fdca-4ed6-935d-5e05968ccd64

📥 Commits

Reviewing files that changed from the base of the PR and between 03031b1 and 911b13a.

📒 Files selected for processing (24)
  • platform-api/internal/apperror/catalog.go
  • platform-api/internal/apperror/codes.go
  • platform-api/internal/repository/apikey.go
  • platform-api/internal/service/llm.go
  • platform-api/internal/service/llm_apikey.go
  • platform-api/internal/service/llm_proxy_apikey.go
  • platform-api/internal/utils/common.go
  • platform-api/internal/utils/openapi_spec_fetcher_test.go
  • portals/ai-workspace/src/apis/providerTemplateApis.ts
  • portals/ai-workspace/src/clients/choreoApiClient.ts
  • portals/ai-workspace/src/clients/publicApiClient.ts
  • portals/ai-workspace/src/pages/appShell/appShellPages/proxies/LLMProxyDeploymentsCard.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/proxies/LLMProxyOverviewTab.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/quickStart/lllmStepBanner/LLLMStepBanner.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/AddNewProvider/GuardrailsSection.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/EditServiceProvider.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/ProvidersList.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/ServiceProviderConnectionTab.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/ServiceProviderDeploymentsCard.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/ServiceProviderNew.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/ServiceProviderOverview.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/ServiceProviderOverviewTab.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/ServiceProvidersSummaryCard.tsx
  • portals/ai-workspace/src/utils/providerTemplateDisplay.ts
📝 Walkthrough

Walkthrough

The changes add typed duplicate API-key conflicts, external endpoint and context validation, paginated provider-template retrieval, relative URL resolution, shared cost-policy handling, dynamic template logos, and API-derived API-key error messages.

Changes

Provider API and workspace fixes

Layer / File(s) Summary
Duplicate API-key conflict contract
platform-api/internal/apperror/..., platform-api/internal/repository/apikey.go, portals/ai-workspace/src/pages/appShell/appShellPages/{proxies,serviceProvider}/*
Duplicate API-key inserts return API_KEY_EXISTS with HTTP 409, and API-key generation views derive displayed errors through getErrorMessage.
Provider endpoint and context validation
platform-api/internal/utils/common.go, platform-api/internal/service/llm.go, platform-api/internal/utils/openapi_spec_fetcher_test.go, portals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/{ServiceProviderConnectionTab,EditServiceProvider}.tsx
Backend endpoint and context values are validated and normalized; workspace forms provide validation feedback and block invalid updates or submissions.
Template pagination and URL resolution
portals/ai-workspace/src/apis/providerTemplateApis.ts, portals/ai-workspace/src/clients/*
Provider templates are aggregated across pages, and relative URLs resolve against the browser origin.
Cost-policy and guardrail state
portals/ai-workspace/src/utils/providerTemplateDisplay.ts, portals/ai-workspace/src/pages/appShell/appShellPages/{serviceProvider,quickStart}/*
Shared cost-policy rules drive provider creation, guardrail display, and live guardrail completion checks.
Template-specific logo resolution
portals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/{ProvidersList,ServiceProviderOverview,ServiceProvidersSummaryCard}.tsx, portals/ai-workspace/src/utils/providerTemplateDisplay.ts
Template metadata logos are preferred over built-in vendor logo fallbacks.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Suggested reviewers: lasanthas, renuka-fernando, virajsalaka

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description only covers Purpose and issue links; it omits most required sections like Goals, Approach, tests, and security checks. Add the missing template sections: Goals, Approach, User stories, Documentation, Automation tests, Security checks, Samples, Related PRs, and Test environment.
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately reflects the main theme of fixing AI Workspace UI bugs.
Linked Issues check ✅ Passed The changes address the linked bugs: template listing/pagination, endpoint URL validation, duplicate API key errors, and guardrails completion.
Out of Scope Changes check ✅ Passed No clear unrelated code changes stand out; the modified UI, validation, and error-handling code all support the linked issues.
✨ 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.

@Tharanidk Tharanidk changed the title Uibugs Fix UI bugs in AI Workspace Jul 27, 2026

@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: 3

🤖 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 `@gateway/gateway-runtime/policy-engine/internal/analytics/analytics.go`:
- Around line 149-160: Update Process so internal loopback provider events are
suppressed only for analytics publishers, while the traffic-log publisher still
receives them. Preserve the existing suppression behavior for Moesif or other
analytics publishers, using the publisher classification established by
NewAnalytics. Add a regression test covering loopback LlmProvider traffic with
analytics and traffic logging enabled.

In `@platform-api/internal/repository/apikey.go`:
- Around line 58-63: Update the duplicate-error handling in the API key creation
flow to return APIKeyExists only when the violated uniqueness constraint is
specifically (artifact_uuid, handle). Use constraint-specific detection or
verify the conflicting key before mapping the error; leave other duplicate-key
failures on the existing generic error path.

In `@platform-api/internal/service/llm.go`:
- Around line 359-365: Strengthen validation in the metadata endpointUrl
handling around utils.ValidateURL so user-supplied URLs reject userinfo, unsafe
schemes, and private, link-local, metadata, or otherwise unsafe resolved IP
destinations before storage. Apply the same protection consistently to both
create and update flows, or ensure every consumer performs equivalent
resolved-IP and dial-time checks before making network requests.
🪄 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 Plus

Run ID: 62b48acc-bc33-4a17-a8cb-dcd0816db21e

📥 Commits

Reviewing files that changed from the base of the PR and between d8bce70 and f31a2b8.

📒 Files selected for processing (17)
  • gateway/gateway-runtime/policy-engine/internal/analytics/analytics.go
  • gateway/gateway-runtime/policy-engine/internal/analytics/analytics_test.go
  • gateway/gateway-runtime/policy-engine/internal/analytics/publishers/moesif.go
  • gateway/gateway-runtime/policy-engine/internal/analytics/publishers/moesif_test.go
  • platform-api/internal/apperror/catalog.go
  • platform-api/internal/apperror/codes.go
  • platform-api/internal/repository/apikey.go
  • platform-api/internal/service/llm.go
  • portals/ai-workspace/src/apis/providerTemplateApis.ts
  • portals/ai-workspace/src/clients/choreoApiClient.ts
  • portals/ai-workspace/src/clients/publicApiClient.ts
  • portals/ai-workspace/src/pages/appShell/appShellPages/proxies/LLMProxyDeploymentsCard.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/proxies/LLMProxyOverviewTab.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/quickStart/lllmStepBanner/LLLMStepBanner.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/ServiceProviderConnectionTab.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/ServiceProviderDeploymentsCard.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/ServiceProviderOverviewTab.tsx

Comment thread gateway/gateway-runtime/policy-engine/internal/analytics/analytics.go Outdated
Comment thread platform-api/internal/repository/apikey.go Outdated
Comment thread platform-api/internal/service/llm.go

@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/internal/service/llm.go`:
- Around line 217-218: Update the Create validation around ValidateExternalURL
to run only when req.Metadata.EndpointUrl contains a non-empty, trimmed value,
allowing nil, empty, or whitespace-only endpoint URLs to proceed. Preserve the
existing invalid-URL error for supplied values and align the behavior with the
optional endpoint handling in Update.
🪄 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 Plus

Run ID: de73297b-306b-4522-9861-0fd36ff70b5b

📥 Commits

Reviewing files that changed from the base of the PR and between f31a2b8 and afdbb03.

📒 Files selected for processing (21)
  • platform-api/internal/apperror/catalog.go
  • platform-api/internal/apperror/codes.go
  • platform-api/internal/repository/apikey.go
  • platform-api/internal/service/llm.go
  • platform-api/internal/utils/common.go
  • platform-api/internal/utils/openapi_spec_fetcher_test.go
  • portals/ai-workspace/src/apis/providerTemplateApis.ts
  • portals/ai-workspace/src/clients/choreoApiClient.ts
  • portals/ai-workspace/src/clients/publicApiClient.ts
  • portals/ai-workspace/src/pages/appShell/appShellPages/proxies/LLMProxyDeploymentsCard.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/proxies/LLMProxyOverviewTab.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/quickStart/lllmStepBanner/LLLMStepBanner.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/AddNewProvider/GuardrailsSection.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/ProvidersList.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/ServiceProviderConnectionTab.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/ServiceProviderDeploymentsCard.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/ServiceProviderNew.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/ServiceProviderOverview.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/ServiceProviderOverviewTab.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/ServiceProvidersSummaryCard.tsx
  • portals/ai-workspace/src/utils/providerTemplateDisplay.ts
🚧 Files skipped from review as they are similar to previous changes (11)
  • portals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/ServiceProviderOverviewTab.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/proxies/LLMProxyOverviewTab.tsx
  • platform-api/internal/apperror/catalog.go
  • portals/ai-workspace/src/pages/appShell/appShellPages/quickStart/lllmStepBanner/LLLMStepBanner.tsx
  • platform-api/internal/repository/apikey.go
  • platform-api/internal/apperror/codes.go
  • portals/ai-workspace/src/clients/choreoApiClient.ts
  • portals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/ServiceProviderConnectionTab.tsx
  • portals/ai-workspace/src/clients/publicApiClient.ts
  • portals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/ServiceProviderDeploymentsCard.tsx
  • portals/ai-workspace/src/apis/providerTemplateApis.ts

Comment thread platform-api/internal/service/llm.go

@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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
portals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/EditServiceProvider.tsx (1)

45-65: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Allow a blank context to use the backend default.

A blank value is sent as undefined and the backend normalizes it to /, but CONTEXT_PATTERN.test('') disables the form and shows an error. This prevents resetting a context and can block description-only edits for providers with no returned context.

Proposed fix
+  const trimmedContext = context.trim();
   const contextTooLong = context.length > MAX_CONTEXT_LENGTH;
   const contextFormatInvalid =
-    !isReadOnlyProvider && !CONTEXT_PATTERN.test(context.trim());
+    !isReadOnlyProvider &&
+    trimmedContext !== '' &&
+    !CONTEXT_PATTERN.test(trimmedContext);
...
-        context: context.trim() || undefined,
+        context: trimmedContext || undefined,

Also applies to: 94-96, 254-260

🤖 Prompt for 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.

In
`@portals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/EditServiceProvider.tsx`
around lines 45 - 65, Update the context validation in EditServiceProviderForm
so a blank, trimmed context is accepted as valid and can be submitted as
undefined for backend normalization. Preserve CONTEXT_PATTERN validation for
non-blank contexts, including the existing read-only behavior, and ensure the
related submit/disabled checks at the referenced flows allow description-only
edits and context resets.
♻️ Duplicate comments (1)
platform-api/internal/service/llm.go (1)

359-363: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Do not validate an omitted optional endpoint URL.

req.Metadata != nil does not mean EndpointUrl was supplied. A nil or blank endpoint becomes "" and fails with “URL is required,” blocking metadata-only updates. Validate only when the trimmed endpoint is non-empty.

Proposed fix
 if req.Metadata != nil {
   endpointURL := strings.TrimSpace(utils.ValueOrEmpty(req.Metadata.EndpointUrl))
-  if err := utils.ValidateExternalURL(context.Background(), endpointURL); err != nil {
-    return nil, apperror.ValidationFailed.New("The metadata endpointUrl must be a valid, publicly reachable URL.")
+  if endpointURL != "" {
+    if err := utils.ValidateExternalURL(context.Background(), endpointURL); err != nil {
+      return nil, apperror.ValidationFailed.New("The metadata endpointUrl must be a valid, publicly reachable URL.")
+    }
   }
 }
🤖 Prompt for 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.

In `@platform-api/internal/service/llm.go` around lines 359 - 363, Update the
metadata validation block in the request handling flow to call
utils.ValidateExternalURL only when the trimmed endpointURL is non-empty.
Preserve validation and the existing error response for supplied URLs, while
allowing nil or blank EndpointUrl values in metadata-only updates.
🤖 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/internal/utils/common.go`:
- Around line 447-459: Update ValidateExternalURL and its outbound request path
to resolve hostnames and reject any private, loopback, link-local, metadata, or
otherwise non-public addresses, not just IP literals. Add dial-time IP
validation to prevent DNS rebinding, and apply the same validation to redirect
destinations using the existing URL validation flow and relevant HTTP
transport/client hooks.

---

Outside diff comments:
In
`@portals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/EditServiceProvider.tsx`:
- Around line 45-65: Update the context validation in EditServiceProviderForm so
a blank, trimmed context is accepted as valid and can be submitted as undefined
for backend normalization. Preserve CONTEXT_PATTERN validation for non-blank
contexts, including the existing read-only behavior, and ensure the related
submit/disabled checks at the referenced flows allow description-only edits and
context resets.

---

Duplicate comments:
In `@platform-api/internal/service/llm.go`:
- Around line 359-363: Update the metadata validation block in the request
handling flow to call utils.ValidateExternalURL only when the trimmed
endpointURL is non-empty. Preserve validation and the existing error response
for supplied URLs, while allowing nil or blank EndpointUrl values in
metadata-only updates.
🪄 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 Plus

Run ID: 1738a0ff-711b-471a-aaee-7e167c63df16

📥 Commits

Reviewing files that changed from the base of the PR and between afdbb03 and 03031b1.

📒 Files selected for processing (3)
  • platform-api/internal/service/llm.go
  • platform-api/internal/utils/common.go
  • portals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/EditServiceProvider.tsx

Comment thread platform-api/internal/utils/common.go
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 28, 2026
Comment thread platform-api/internal/apperror/catalog.go Outdated
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 28, 2026
Induwara04
Induwara04 previously approved these changes Jul 28, 2026
Comment thread platform-api/internal/apperror/catalog.go Outdated
@Tharanidk
Tharanidk dismissed stale reviews from Induwara04 and coderabbitai[bot] via 47a3a84 July 28, 2026 14:30
@Tharanidk
Tharanidk merged commit 463f2fd into wso2:main Jul 28, 2026
10 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

3 participants