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 request and idle timeouts for LLM providers, LLM proxies, and MCP endpoints.
    • Added UI controls, duration validation, and deployment/API support for resilience settings.
    • MCP deployments can now use either an upstream URL or reference.
  • Bug Fixes
    • Preserve existing resilience settings when updates omit them.
    • Apply sensible derived defaults while honoring explicit proxy settings.
    • Improved handling of missing proxy records.
  • Tests / Documentation
    • Added coverage for resilience validation, defaults, and deployment output.
    • Updated API documentation and models.

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

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

Changes

Resilience timeout configuration

Layer / File(s) Summary
Resilience contracts and conversion
agent-manager-service/docs/..., 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, validation, generated API models, 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_*, agent-manager-service/services/agent_configuration_service.go
Validates resilience values, preserves omitted provider settings, derives proxy defaults, preserves MCP settings, and emits deployment YAML.
Mapping handle backfill
agent-manager-service/repositories/*
Shares LLM proxy handle backfill logic and applies it to fetched mappings.
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

Suggested reviewers: hanzjk

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (3 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The PR also changes handle backfilling and maps not-found errors in unrelated services without evidence that these changes support issue #828. Remove the unrelated repository and error-mapping changes or link them to separate issues with supporting requirements.
Docstring Coverage ⚠️ Warning Docstring coverage is 75.61% 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 provides the purpose and issue link, but nearly all required sections contain only template text and no implementation or testing details. Complete the Goals, Approach, User stories, Release note, Documentation, testing, security, migration, environment, and other applicable sections.
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed For issue #828, the PR adds configurable provider timeouts, validates duration values, preserves settings, and propagates them into deployments.
Title check ✅ Passed The title clearly summarizes the main change: adding backend timeout configuration for LLM providers and the MCP proxy.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 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
AnoshanJ
AnoshanJ previously approved these changes Jul 24, 2026
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

Dependency Validation Results

Dependency name: github.com/golang-jwt/jwt/v5
Version: v5.3.1
Allowed range: >=v5.3.1
Approved: ✅ Yes

Dependency name: github.com/modelcontextprotocol/go-sdk
Version: v1.5.0
Allowed range: >=v1.2.0
Approved: ✅ Yes

Dependency name: golang.org/x/crypto
Version: v0.54.0 (was v0.48.0)
Allowed range: >=v0.31.0
Approved: ✅ Yes

Dependency name: golang.org/x/sync
Version: v0.22.0 (was v0.19.0)
Allowed range: >=v0.16.0
Approved: ✅ Yes

⚠️ Please verify the scope of the dependencies usage is necessary

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

2 participants