feat(backends): add custom compatible connectors#30
Conversation
|
Warning Review limit reached
More reviews will be available in 48 minutes and 1 second. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the 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 credits. 🚦 How do rate 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 see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdds three YAML-only backend factory kinds ( ChangesCustom Compatible Backends
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 7 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (7 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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: 2
🤖 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 `@config/config.yaml`:
- Around line 330-331: The sample block for backend_prefix is missing an
enforced validator constraint: it must not contain “/” or “:”. Update the
documentation near the existing backend_prefix and api_key_env_var_root comments
to list this rule alongside the uniqueness and reserved-prefix restrictions so
users can avoid check-config failures.
In `@internal/pluginreg/custom_compatible_build_test.go`:
- Around line 44-52: Replace the use of t.Fatalf inside the httptest handler in
custom_compatible_build_test.go with non-fatal test reporting, because the
handler runs in a separate goroutine. In the server setup for the models
endpoint, and similarly in the other handler blocks in this test file, use
t.Errorf to record the mismatch, then return immediately and optionally send an
appropriate non-200 response so the request fails cleanly. Keep the same checks
around r.URL.Path, the Authorization header, and the handler response body, but
avoid terminating the parent test from inside the HTTP callback.
🪄 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: ASSERTIVE
Plan: Pro
Run ID: 0394a60c-2f0f-48fe-b029-a921a5a688b4
📒 Files selected for processing (17)
config/config.yamldocs/custom-compatible-backends.mddocs/plugin-authoring.mdinternal/infra/runtimebundle/bootstrap_plan.gointernal/infra/runtimebundle/bootstrap_plan_test.gointernal/infra/runtimebundle/build.gointernal/infra/runtimebundle/dual_backend_test.gointernal/pluginreg/backend_prefix_inventory_test.gointernal/pluginreg/backends_install.gointernal/pluginreg/custom_backend_env_keys_test.gointernal/pluginreg/custom_backend_prefix_test.gointernal/pluginreg/custom_backends.gointernal/pluginreg/custom_compatible_build_test.gointernal/pluginreg/spec_bundle_standard_inventory_test.gointernal/pluginreg/standard_table.gointernal/plugins/backends/anthropic/plugin.gointernal/plugins/backends/modeldiscover/http_providers.go
📜 Review details
⏰ Context from checks skipped due to timeout. (1)
- GitHub Check: qa
🧰 Additional context used
📓 Path-based instructions (5)
**/*.go
📄 CodeRabbit inference engine (Custom checks)
For server, CLI, worker, or network code, check that context.Context is propagated correctly, cancellation is respected, and new goroutines cannot leak indefinitely
**/*.go: Avoidanyunless unavoidable at a protocol boundary
Use small interfaces defined where they are consumed
Do not use Java-style interface prefixes. Use idiomatic Go names such asStore,Router,Clock
Every I/O boundary takescontext.Context
Establish explicit ownership for goroutines, channels, buffers, and cancellation
Prefer simple push/pull stream abstractions over ad hoc channel webs
Return errors, do not panic in request paths
Wrap errors with%wand preserve classification metadata
Keep config structs typed and explicit
Avoid circular imports by design
Do not mix frontend codec logic, routing policy, and backend invocation in one package
Add package docs where the boundary is non-obvious
Line length ~120+: break at semantic boundaries where practical. When splitting embedded JSON/SSE in tests or emulators, re-check brace matching
Slices in JSON and returned values: prefer explicit empty initialization (s := []T{}ormake) sonullnever appears in JSON for 'empty list'
Short-lived append-only local buffers may usevar s []Tandappendwhen the value never escapes
JSON presence vs null: when a wire shape must preserve 'field absent' vs explicitnullvs empty containers, reuseinternal/core/jsonpresencepatterns
Files:
internal/pluginreg/spec_bundle_standard_inventory_test.gointernal/infra/runtimebundle/bootstrap_plan.gointernal/infra/runtimebundle/bootstrap_plan_test.gointernal/pluginreg/standard_table.gointernal/pluginreg/backends_install.gointernal/plugins/backends/modeldiscover/http_providers.gointernal/infra/runtimebundle/dual_backend_test.gointernal/pluginreg/custom_backend_prefix_test.gointernal/infra/runtimebundle/build.gointernal/pluginreg/custom_backend_env_keys_test.gointernal/pluginreg/custom_compatible_build_test.gointernal/pluginreg/backend_prefix_inventory_test.gointernal/plugins/backends/anthropic/plugin.gointernal/pluginreg/custom_backends.go
⚙️ CodeRabbit configuration file
**/*.go: Review as production Go code. Prioritize correctness, race conditions, goroutine leaks, context cancellation, timeout handling, error wrapping, nil-pointer risks, resource cleanup, defer placement, API compatibility, interface design, dependency boundaries, and testability. Avoid generic style comments when gofmt/golangci-lint already covers the issue.
Files:
internal/pluginreg/spec_bundle_standard_inventory_test.gointernal/infra/runtimebundle/bootstrap_plan.gointernal/infra/runtimebundle/bootstrap_plan_test.gointernal/pluginreg/standard_table.gointernal/pluginreg/backends_install.gointernal/plugins/backends/modeldiscover/http_providers.gointernal/infra/runtimebundle/dual_backend_test.gointernal/pluginreg/custom_backend_prefix_test.gointernal/infra/runtimebundle/build.gointernal/pluginreg/custom_backend_env_keys_test.gointernal/pluginreg/custom_compatible_build_test.gointernal/pluginreg/backend_prefix_inventory_test.gointernal/plugins/backends/anthropic/plugin.gointernal/pluginreg/custom_backends.go
**/*_test.go
📄 CodeRabbit inference engine (AGENTS.md)
**/*_test.go: Prefer locking invariants (routing, streaming, B2BUA, capability mismatch, no-retry-after-output) through tests
Tests are behavior contracts, not implementation snapshots
Decoder and selector parsers should gain fuzz tests when practical
Keep tests near the package they validate unless a cross-package integration test is required
Files:
internal/pluginreg/spec_bundle_standard_inventory_test.gointernal/infra/runtimebundle/bootstrap_plan_test.gointernal/infra/runtimebundle/dual_backend_test.gointernal/pluginreg/custom_backend_prefix_test.gointernal/pluginreg/custom_backend_env_keys_test.gointernal/pluginreg/custom_compatible_build_test.gointernal/pluginreg/backend_prefix_inventory_test.go
⚙️ CodeRabbit configuration file
**/*_test.go: Review tests for meaningful assertions, table-driven coverage, race-prone tests, t.Parallel misuse, nondeterminism, leaked goroutines, real network or filesystem dependencies, fragile sleeps, and missing edge cases. Prefer testing observable behavior over implementation details.
Files:
internal/pluginreg/spec_bundle_standard_inventory_test.gointernal/infra/runtimebundle/bootstrap_plan_test.gointernal/infra/runtimebundle/dual_backend_test.gointernal/pluginreg/custom_backend_prefix_test.gointernal/pluginreg/custom_backend_env_keys_test.gointernal/pluginreg/custom_compatible_build_test.gointernal/pluginreg/backend_prefix_inventory_test.go
internal/**
⚙️ CodeRabbit configuration file
internal/**: Focus on package boundaries, hidden coupling, unexported API design, concurrency safety, deterministic behavior, and whether logic belongs in this internal package.
Files:
internal/pluginreg/spec_bundle_standard_inventory_test.gointernal/infra/runtimebundle/bootstrap_plan.gointernal/infra/runtimebundle/bootstrap_plan_test.gointernal/pluginreg/standard_table.gointernal/pluginreg/backends_install.gointernal/plugins/backends/modeldiscover/http_providers.gointernal/infra/runtimebundle/dual_backend_test.gointernal/pluginreg/custom_backend_prefix_test.gointernal/infra/runtimebundle/build.gointernal/pluginreg/custom_backend_env_keys_test.gointernal/pluginreg/custom_compatible_build_test.gointernal/pluginreg/backend_prefix_inventory_test.gointernal/plugins/backends/anthropic/plugin.gointernal/pluginreg/custom_backends.go
internal/plugins/**/*.go
📄 CodeRabbit inference engine (AGENTS.md)
Keep provider-specific payload types inside adapters/plugins
Files:
internal/plugins/backends/modeldiscover/http_providers.gointernal/plugins/backends/anthropic/plugin.go
internal/plugins/backends/**/*.go
📄 CodeRabbit inference engine (AGENTS.md)
Use official vendor Go SDKs only inside backend plugins (OpenAI:
openai-go); do not import provider SDKs frominternal/core,pkg/lipapi, orpkg/lipsdk
Files:
internal/plugins/backends/modeldiscover/http_providers.gointernal/plugins/backends/anthropic/plugin.go
🪛 LanguageTool
docs/plugin-authoring.md
[style] ~3-~3: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...e README.md and config/config.yaml. For YAML-only OpenAI/Anthropic-compatible p...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
[style] ~3-~3: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...ds.md`](custom-compatible-backends.md). For the no-key local stub maintainer wo...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
🔇 Additional comments (17)
docs/custom-compatible-backends.md (1)
1-85: LGTM!docs/plugin-authoring.md (1)
3-3: LGTM!internal/plugins/backends/modeldiscover/http_providers.go (1)
54-58: LGTM!Also applies to: 81-95
internal/plugins/backends/anthropic/plugin.go (1)
56-83: LGTM!Also applies to: 99-99, 128-131
internal/pluginreg/custom_backends.go (2)
39-81: LGTM!Also applies to: 115-218
83-95: 🎯 Functional CorrectnessNo issue: prefix matching is case-sensitive end-to-end, so mixed-case custom prefixes cannot shadow a standard connector.
> Likely an incorrect or invalid review comment.internal/pluginreg/backends_install.go (1)
260-282: LGTM!internal/pluginreg/standard_table.go (1)
199-207: LGTM!internal/pluginreg/spec_bundle_standard_inventory_test.go (1)
34-36: LGTM!internal/infra/runtimebundle/build.go (1)
75-77: LGTM!internal/infra/runtimebundle/bootstrap_plan.go (1)
93-95: LGTM!internal/pluginreg/custom_backend_prefix_test.go (1)
8-80: LGTM!internal/pluginreg/custom_backend_env_keys_test.go (1)
11-177: LGTM!internal/pluginreg/backend_prefix_inventory_test.go (1)
34-122: LGTM!internal/pluginreg/custom_compatible_build_test.go (1)
155-283: LGTM!internal/infra/runtimebundle/bootstrap_plan_test.go (1)
93-124: LGTM!internal/infra/runtimebundle/dual_backend_test.go (1)
55-112: LGTM!
Summary
Tests