Skip to content

Add backend timeout configuration for llm providers and mcp proxy#1328

Open
menakaj wants to merge 4 commits into
wso2:mainfrom
menakaj:main
Open

Add backend timeout configuration for llm providers and mcp proxy#1328
menakaj wants to merge 4 commits into
wso2:mainfrom
menakaj:main

Conversation

@menakaj

@menakaj menakaj commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Purpose

Describe the problems, issues, or needs driving this feature/fix and include links to related issues in the following format: Resolves issue1, issue2, etc.

This should be merged after upgrading to the latest gateway. (1.2.0)

Resolves #828

Goals

Describe the solutions that this feature/fix will introduce to resolve the problems described above

Approach

Describe how you are implementing the solutions. Include an animated GIF or screenshot if the change affects the UI (email documentation@wso2.com to review all UI text). Include a link to a Markdown file or Google doc if the feature write-up is too long to paste here.

User stories

Summary of user stories addressed by this change>

Release note

Brief description of the new feature or bug fix as it will appear in the release notes

Documentation

Link(s) to product documentation that addresses the changes of this PR. If no doc impact, enter �N/A� plus brief explanation of why there�s no doc impact

Training

Link to the PR for changes to the training content in https://github.com/wso2/WSO2-Training, if applicable

Certification

Type �Sent� when you have provided new/updated certification questions, plus four answers for each question (correct answer highlighted in bold), based on this change. Certification questions/answers should be sent to certification@wso2.com and NOT pasted in this PR. If there is no impact on certification exams, type �N/A� and explain why.

Marketing

Link to drafts of marketing content that will describe and promote this feature, including product page changes, technical articles, blog posts, videos, etc., if applicable

Automation tests

  • Unit tests

    Code coverage information

  • Integration tests

    Details about the test cases and coverage

Security checks

Samples

Provide high-level details about the samples related to this feature

Related PRs

List any other related PRs

Migrations (if applicable)

Describe migration steps and platforms on which migration has been tested

Test environment

List all JDK versions, operating systems, databases, and browser/versions on which this feature/fix was tested

Learning

Describe the research phase and any blog posts, patterns, libraries, or add-ons you used to solve the problem.

Summary by CodeRabbit

  • New Features
    • Added configurable resilience timeouts (request timeout + idle timeout) for LLM providers, LLM proxies, and MCP endpoints, including API/deployment exposure.
    • Added UI controls and validation for resilience timeouts with sensible defaults.
  • Bug Fixes
    • Preserve existing resilience settings when updates omit resilience.
    • Apply provider-derived resilience defaults and ensure explicit proxy settings take precedence.
    • Improved “not found” handling for missing proxy records.
  • Tests / Documentation
    • Added/updated unit tests and updated the OpenAPI specification and API models.

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: cde28fed-45ef-40e3-b7b3-6987297666be

📥 Commits

Reviewing files that changed from the base of the PR and between e46bd79 and 4a3259f.

📒 Files selected for processing (5)
  • agent-manager-service/services/mcp_proxy_deployment.go
  • agent-manager-service/services/mcp_proxy_deployment_test.go
  • console/workspaces/pages/llm-providers/src/form/schema.ts
  • console/workspaces/pages/mcp-proxies/src/subComponents/EndpointFormFields.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/MCPProxyConnectionTab.tsx
🚧 Files skipped from review as they are similar to previous changes (5)
  • console/workspaces/pages/llm-providers/src/form/schema.ts
  • console/workspaces/pages/mcp-proxies/src/subComponents/EndpointFormFields.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/MCPProxyConnectionTab.tsx
  • agent-manager-service/services/mcp_proxy_deployment_test.go
  • agent-manager-service/services/mcp_proxy_deployment.go

📝 Walkthrough

Walkthrough

Adds configurable request and idle timeouts for LLM providers, LLM proxies, and MCP endpoints. The change spans API contracts, backend validation, persistence, deployment generation, console forms, and missing-record error handling.

Changes

Resilience timeout configuration

Layer / File(s) Summary
Resilience contracts and conversion
agent-manager-service/docs/api_v1_openapi.yaml, agent-manager-service/models/*, agent-manager-service/spec/*, agent-manager-service/utils/spec_converter.go, console/workspaces/libs/types/src/api/*
Adds optional timeout fields, generated API models, validation, TypeScript types, and bidirectional conversion.
Console configuration
console/workspaces/libs/shared-component/*, console/workspaces/pages/llm-providers/*, console/workspaces/pages/mcp-proxies/*
Adds shared timeout inputs, duration validation, dirty-state handling, and conditional request payloads.
Backend validation and deployment propagation
agent-manager-service/controllers/llm_controller.go, agent-manager-service/services/llm_*, agent-manager-service/services/mcp_proxy_deployment.go
Validates resilience values, preserves omitted provider settings, derives proxy defaults, and emits deployment YAML.
MCP persistence and deployment
agent-manager-service/services/mcp_proxy_service.go, agent-manager-service/services/agent_configuration_service.go, agent-manager-service/services/mcp_proxy_deployment.go
Persists endpoint resilience, returns it in DTOs, copies it into agent proxy configuration, and supports upstream URLs or references.
Mapping handle backfill
agent-manager-service/repositories/*
Shares LLM proxy handle backfill logic and applies it to fetched mapping records.
Proxy not-found error mapping
agent-manager-service/services/gateway_internal_service.go, agent-manager-service/services/llm_proxy_apikey_service.go, agent-manager-service/services/llm_proxy_deployment_service.go
Maps missing proxy records to utils.ErrLLMProxyNotFound across service flows.

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

Possibly related issues

  • wso2/api-platform#2024 — Adds provider-level timeout configuration and deployment propagation overlapping this change.

Possibly related PRs

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (3 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning Most required sections are empty or placeholder text; only Purpose is partially filled, so the template is not followed. Fill in Goals, Approach, User stories, Release note, Documentation, Tests, Security checks, and the remaining required sections.
Out of Scope Changes check ⚠️ Warning The PR adds MCP proxy resilience/UI/deployment work and unrelated error-handling/refactor changes beyond [#828]. Remove nonessential MCP proxy and unrelated service/repository changes, or document them as separate linked work if intended.
Docstring Coverage ⚠️ Warning Docstring coverage is 78.95% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding backend timeout configuration for LLM providers and MCP proxy.
Linked Issues check ✅ Passed The PR implements the requested timeout override for [#828] with validation, UI, and backend propagation.
✨ 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: 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 `@agent-manager-service/services/mcp_proxy_deployment.go`:
- Around line 459-476: Update the Main upstream extraction in the deployment
generation flow to copy main.Ref into upstream.Ref alongside the existing URL
mapping. Revise the validation error to state that either an upstream URL or Ref
is required, preserving the existing acceptance of either field.

In `@console/workspaces/pages/llm-providers/src/form/schema.ts`:
- Line 21: Update the duration validation regex used by DURATION_PATTERN in
console/workspaces/pages/llm-providers/src/form/schema.ts at lines 21-21 to
accept optional fractional values while preserving the existing units. Apply the
same regex change in
console/workspaces/pages/mcp-proxies/src/subComponents/EndpointFormFields.tsx at
lines 87-88, and reuse an exported shared constant if appropriate to avoid
duplication.

In
`@console/workspaces/pages/mcp-proxies/src/subComponents/MCPProxyConnectionTab.tsx`:
- Around line 48-49: Update the DURATION_PATTERN validation regex in
MCPProxyConnectionTab to accept an optional decimal fraction before the existing
ms, s, m, or h units, while preserving validation of integer durations and
rejecting malformed values.
🪄 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: bb9bb7f4-7753-492a-bc64-b535cbea0420

📥 Commits

Reviewing files that changed from the base of the PR and between 2541eba and e46bd79.

⛔ Files ignored due to path filters (1)
  • cli/pkg/clients/amsvc/gen/types.gen.go is excluded by !**/gen/**
📒 Files selected for processing (39)
  • agent-manager-service/controllers/llm_controller.go
  • agent-manager-service/docs/api_v1_openapi.yaml
  • agent-manager-service/models/llm_provider.go
  • agent-manager-service/models/llm_proxy.go
  • agent-manager-service/models/mcp_proxy.go
  • agent-manager-service/models/upstream.go
  • agent-manager-service/models/upstream_test.go
  • agent-manager-service/repositories/agent_configuration_repository.go
  • agent-manager-service/repositories/env_agent_model_mapping_repository.go
  • agent-manager-service/services/agent_configuration_service.go
  • agent-manager-service/services/gateway_internal_service.go
  • agent-manager-service/services/llm_deployment_service.go
  • agent-manager-service/services/llm_deployment_service_test.go
  • agent-manager-service/services/llm_provider_service.go
  • agent-manager-service/services/llm_proxy_apikey_service.go
  • agent-manager-service/services/llm_proxy_deployment_service.go
  • agent-manager-service/services/llm_proxy_deployment_service_test.go
  • agent-manager-service/services/llm_proxy_service.go
  • agent-manager-service/services/mcp_proxy_deployment.go
  • agent-manager-service/services/mcp_proxy_deployment_test.go
  • agent-manager-service/services/mcp_proxy_service.go
  • agent-manager-service/spec/model_create_llm_provider_request.go
  • agent-manager-service/spec/model_llm_provider_response.go
  • agent-manager-service/spec/model_llm_proxy_config.go
  • agent-manager-service/spec/model_mcp_proxy_endpoint.go
  • agent-manager-service/spec/model_resilience.go
  • agent-manager-service/spec/model_update_llm_provider_request.go
  • agent-manager-service/utils/spec_converter.go
  • console/workspaces/libs/shared-component/src/components/ResilienceTimeoutFields.tsx
  • console/workspaces/libs/shared-component/src/components/index.ts
  • console/workspaces/libs/types/src/api/llm-providers.ts
  • console/workspaces/libs/types/src/api/mcp-proxies.ts
  • console/workspaces/pages/llm-providers/src/form/schema.ts
  • console/workspaces/pages/llm-providers/src/subComponents/AddLLMProviderForm.tsx
  • console/workspaces/pages/llm-providers/src/subComponents/LLMProviderConnectionTab.tsx
  • console/workspaces/pages/llm-providers/src/utils/llmProviderPayload.ts
  • console/workspaces/pages/mcp-proxies/src/subComponents/EndpointFormFields.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/MCPProxyConnectionTab.tsx
  • console/workspaces/pages/mcp-proxies/src/subComponents/mcpEndpoints.ts

Comment thread agent-manager-service/services/mcp_proxy_deployment.go
Comment thread console/workspaces/pages/llm-providers/src/form/schema.ts Outdated
Comment thread console/workspaces/pages/mcp-proxies/src/subComponents/MCPProxyConnectionTab.tsx Outdated
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.

LLM Service Providers: provide timeout override option

1 participant