fix(ai-connectors): preserve workspace fallback chain and node fallbackProviderKey when overrideProviderKey is set
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 78/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- typescript
- Lĩnh vực
- ai, backend-api-design
Hướng nghiên cứu
Start with dispatchWithFallback in packages/ai-connectors/src/gateway.ts and dispatchCompletion in apps/api/src/ai-connectors/ai-connectors.service.ts to trace how provider options reach the gateway and how candidates are ordered. Then read packages/ai-connectors/src/gateway.spec.ts and add coverage for fallback after an overridden provider fails. Done means the override is tried first, configured fallback providers are tried in order, and full-chain failure still triggers handoff.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem Description
-
Node-level
overrideProviderKeydrops all configured backups:
Inpackages/ai-connectors/src/gateway.ts(AiGatewayService.dispatchWithFallback, lines 50-98), whenrequest.overrideProviderKeymatches an active connector,candidatesis populated with only that single provider. Because the remaining workspace connectors (fallbackTier1, 2, 3) and optionalsystemFallbackKeyare wrapped inif (candidates.length === 0)(lines 69 & 92), they are all skipped for that request.
If the overridden provider returns429or times out,dispatchWithFallbackimmediately fails and triggersonFullChainFailureinstead of falling back through the workspace's configured tiers. -
fallbackProviderKeyandfallbackModelIdare ignored:
AiConnectorsService.dispatchCompletion(apps/api/src/ai-connectors/ai-connectors.service.ts, lines 475-494) acceptsoptions.fallbackProviderKeyandoptions.fallbackModelId(andAiCompletionRequestinpackages/types/src/ai-connectors.tslines 95-96 defines them), butmergedRequestnever forwards them andgateway.tsnever reads them.
Expected Behavior
- Setting
overrideProviderKeyshould try that provider first — not discard the rest of the fallback chain. candidatesshould be built as an ordered, deduplicated list:overrideProviderKey/overrideModelId(if set and usable)fallbackProviderKey/fallbackModelId(if set and usable)- Remaining active workspace
connectorssorted byfallbackTier(Tier 1 -> Tier 2 -> Tier 3) - Optional
systemFallbackKey(only if configured)
- If every provider in the chain fails,
onFullChainFailure(Human Handoff) still triggers as before.
Where to Look
packages/ai-connectors/src/gateway.ts(dispatchWithFallback, lines 40-102)apps/api/src/ai-connectors/ai-connectors.service.ts(dispatchCompletion, lines 475-494)packages/types/src/ai-connectors.ts(AiCompletionRequest, lines 88-99)packages/ai-connectors/src/gateway.spec.ts
Solution / Implementation Guide
- Forward fallback options (
ai-connectors.service.ts):- In
dispatchCompletion(lines 490-494), includefallbackProviderKeyandfallbackModelIdinmergedRequestwhen provided inoptions.
- In
- Build a deduplicated ordered
candidateslist (gateway.ts):- Remove the
if (candidates.length === 0)guard around workspaceconnectorsandsystemFallbackKey. - Add a small helper
addCandidate(...)keyed by${providerKey}:${modelId}to append in order:request.overrideProviderKey/request.overrideModelIdrequest.fallbackProviderKey/request.fallbackModelId- Active
connectorssorted byfallbackTier systemFallbackKey(when present)
- Remove the
- Add unit test (
gateway.spec.ts):- Verify that when
overrideProviderKeyfails,dispatchWithFallbackcascades tofallbackProviderKey/ Tier 1 / Tier 2 connectors instead of failing immediately.
- Verify that when
- Ngôn ngữ chính
- TypeScript
- Star
- 2
- Fork
- 1
- Merge trung bình
- 6 phút
- Pull request đã merge (30 ngày)
- 27
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của sumamakhan761/tryinstance
-
backend good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
sumamakhan761/tryinstance#65 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
backend good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
sumamakhan761/tryinstance#64 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
backend good first issue
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
sumamakhan761/tryinstance#63 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
backend good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
sumamakhan761/tryinstance#62 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
backend good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
sumamakhan761/tryinstance#60 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của sumamakhan761/tryinstance
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
makecindy/cindy#15342 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
kwitsch/claude-code-plugin-tooling#219 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
no-repo-link tool-submission
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 74/100
BraveOPotato/NoSignups#2618 ·
-
enhancement good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100