Add backend timeout configuration for llm providers and mcp proxy - #1328
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds configurable request and idle timeouts for LLM providers, LLM proxies, MCP endpoints, and agent environments. The change updates API contracts, validation, persistence, deployment generation, console forms, configuration propagation, and missing-record error handling. ChangesResilience timeout configuration
Estimated code review effort: 4 (Complex) | ~60 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (3 warnings)
✅ Passed checks (2 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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
⛔ Files ignored due to path filters (1)
cli/pkg/clients/amsvc/gen/types.gen.gois excluded by!**/gen/**
📒 Files selected for processing (39)
agent-manager-service/controllers/llm_controller.goagent-manager-service/docs/api_v1_openapi.yamlagent-manager-service/models/llm_provider.goagent-manager-service/models/llm_proxy.goagent-manager-service/models/mcp_proxy.goagent-manager-service/models/upstream.goagent-manager-service/models/upstream_test.goagent-manager-service/repositories/agent_configuration_repository.goagent-manager-service/repositories/env_agent_model_mapping_repository.goagent-manager-service/services/agent_configuration_service.goagent-manager-service/services/gateway_internal_service.goagent-manager-service/services/llm_deployment_service.goagent-manager-service/services/llm_deployment_service_test.goagent-manager-service/services/llm_provider_service.goagent-manager-service/services/llm_proxy_apikey_service.goagent-manager-service/services/llm_proxy_deployment_service.goagent-manager-service/services/llm_proxy_deployment_service_test.goagent-manager-service/services/llm_proxy_service.goagent-manager-service/services/mcp_proxy_deployment.goagent-manager-service/services/mcp_proxy_deployment_test.goagent-manager-service/services/mcp_proxy_service.goagent-manager-service/spec/model_create_llm_provider_request.goagent-manager-service/spec/model_llm_provider_response.goagent-manager-service/spec/model_llm_proxy_config.goagent-manager-service/spec/model_mcp_proxy_endpoint.goagent-manager-service/spec/model_resilience.goagent-manager-service/spec/model_update_llm_provider_request.goagent-manager-service/utils/spec_converter.goconsole/workspaces/libs/shared-component/src/components/ResilienceTimeoutFields.tsxconsole/workspaces/libs/shared-component/src/components/index.tsconsole/workspaces/libs/types/src/api/llm-providers.tsconsole/workspaces/libs/types/src/api/mcp-proxies.tsconsole/workspaces/pages/llm-providers/src/form/schema.tsconsole/workspaces/pages/llm-providers/src/subComponents/AddLLMProviderForm.tsxconsole/workspaces/pages/llm-providers/src/subComponents/LLMProviderConnectionTab.tsxconsole/workspaces/pages/llm-providers/src/utils/llmProviderPayload.tsconsole/workspaces/pages/mcp-proxies/src/subComponents/EndpointFormFields.tsxconsole/workspaces/pages/mcp-proxies/src/subComponents/MCPProxyConnectionTab.tsxconsole/workspaces/pages/mcp-proxies/src/subComponents/mcpEndpoints.ts
|
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. |
Dependency Validation ResultsDependency name: github.com/golang-jwt/jwt/v5 Dependency name: github.com/modelcontextprotocol/go-sdk Dependency name: golang.org/x/crypto Dependency name: golang.org/x/sync |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
agent-manager-service/services/mcp_proxy_deployment.go (1)
422-430: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winPreserve Ref-only upstream configurations.
This code copies only
Main.URLand rejects an empty URL. IfMain.Refis the optional upstream-reference field added by this PR, a valid Ref-only configuration fails with"upstream URL is required"and the reference is not serialized.Copy
Main.Refintoupstream.Ref. Reject the configuration only when both URL and Ref are empty. Update the error to mention both fields. This repeats the previous missing-Ref finding, so verify the current contract before merging.Proposed fix
if proxy.Configuration.Upstream.Main != nil { - upstream.URL = strings.TrimSpace(proxy.Configuration.Upstream.Main.URL) + main := proxy.Configuration.Upstream.Main + upstream.URL = strings.TrimSpace(main.URL) + upstream.Ref = strings.TrimSpace(main.Ref) - upstreamAuth = proxy.Configuration.Upstream.Main.Auth + upstreamAuth = main.Auth } - if strings.TrimSpace(upstream.URL) == "" { - return nil, fmt.Errorf("upstream URL is required") + if strings.TrimSpace(upstream.URL) == "" && strings.TrimSpace(upstream.Ref) == "" { + return nil, fmt.Errorf("upstream URL or Ref is required") }Run this verification script:
#!/bin/bash set -euo pipefail ast-grep outline agent-manager-service/services/mcp_proxy_deployment.go \ --items all --type function --match 'buildMCPProxyDeploymentYAML' rg -n -C 5 \ 'type MCPProxyUpstream|Ref.*json|Ref.*yaml|Main\.Ref|MCPProxyUpstream\{' \ agent-manager-service --glob '*.go' rg -n -C 8 \ 'Ref|upstream URL|required|buildMCPProxyDeploymentYAML' \ agent-manager-service/services/mcp_proxy_deployment_test.go🤖 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 `@agent-manager-service/services/mcp_proxy_deployment.go` around lines 422 - 430, Update buildMCPProxyDeploymentYAML to copy proxy.Configuration.Upstream.Main.Ref into upstream.Ref, and reject the configuration only when both trimmed upstream.URL and upstream.Ref are empty. Change the validation error to mention both URL and Ref, preserving serialization for Ref-only upstream configurations.
🤖 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.
Outside diff comments:
In `@agent-manager-service/services/mcp_proxy_deployment.go`:
- Around line 422-430: Update buildMCPProxyDeploymentYAML to copy
proxy.Configuration.Upstream.Main.Ref into upstream.Ref, and reject the
configuration only when both trimmed upstream.URL and upstream.Ref are empty.
Change the validation error to mention both URL and Ref, preserving
serialization for Ref-only upstream configurations.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 63c0c0c4-b209-4c11-b222-82d6e58019e0
📒 Files selected for processing (1)
agent-manager-service/services/mcp_proxy_deployment.go
There was a problem hiding this comment.
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 `@console/workspaces/pages/configure-agent/src/ViewLLMProvider.Component.tsx`:
- Around line 70-74: Update DURATION_PATTERN used by validateResilienceDuration
to accept fractional numeric durations such as 1.5s while continuing to support
existing integer values, units, and blank input behavior. Ensure the validator
matches the OpenAPI Resilience schema so valid saved overrides can be
resubmitted.
🪄 Autofix
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: c0a807a4-a0c2-46ba-b2ab-e3f60867ce6d
⛔ Files ignored due to path filters (1)
cli/pkg/clients/amsvc/gen/types.gen.gois excluded by!**/gen/**
📒 Files selected for processing (12)
agent-manager-service/controllers/agent_configuration_controller.goagent-manager-service/docs/api_v1_openapi.yamlagent-manager-service/models/agent_configuration_dto.goagent-manager-service/services/agent_configuration_service.goagent-manager-service/services/agent_manager.goagent-manager-service/services/llm_proxy_deployment_service.goagent-manager-service/services/llm_proxy_deployment_service_test.goagent-manager-service/services/mcp_proxy_deployment.goagent-manager-service/spec/model_env_provider_configuration.goagent-manager-service/spec/model_provider_config.goconsole/workspaces/libs/types/src/api/agent-model-configs.tsconsole/workspaces/pages/configure-agent/src/ViewLLMProvider.Component.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
- agent-manager-service/services/mcp_proxy_deployment.go
| const DURATION_PATTERN = /^\d+(ms|s|m|h)$/; | ||
|
|
||
| function validateResilienceDuration(value: string): string | null { | ||
| if (value.trim() === "" || DURATION_PATTERN.test(value.trim())) return null; | ||
| return "Enter a duration like 5s, 500ms, or 1m"; |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Accept fractional durations in the console validator.
The OpenAPI Resilience schema accepts values such as 1.5s. DURATION_PATTERN rejects them. A valid saved override then loads into this form but cannot be saved.
Match the console pattern to the API contract.
Proposed fix
-const DURATION_PATTERN = /^\d+(ms|s|m|h)$/;
+const DURATION_PATTERN = /^\d+(\.\d+)?(ms|s|m|h)$/;Also applies to: 507-518
🤖 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 `@console/workspaces/pages/configure-agent/src/ViewLLMProvider.Component.tsx`
around lines 70 - 74, Update DURATION_PATTERN used by validateResilienceDuration
to accept fractional numeric durations such as 1.5s while continuing to support
existing integer values, units, and blank input behavior. Ensure the validator
matches the OpenAPI Resilience schema so valid saved overrides can be
resubmitted.
Purpose
This should be merged after upgrading to the latest gateway. (1.2.0)
Resolves #828
LLM Service provide resiliency configuration
Agent Level llm configuration
Goals
Approach
User stories
Release note
Documentation
Training
Certification
Marketing
Automation tests
Security checks
Samples
Related PRs
Migrations (if applicable)
Test environment
Learning
Summary by CodeRabbit