add openrouter fusion#9
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (7)
✅ Files skipped from review due to trivial changes (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughAdds OpenRouter Fusion as an opt-in model in the catalog injection pipeline. ChangesOpenRouter Fusion opt-in model catalog injection
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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: 1
🧹 Nitpick comments (1)
internal/controller/claw_configmap_test.go (1)
498-625: ⚡ Quick winAdd coverage for the
openrouter/fusionshort-key branch.The controller mutates both
openrouter/openrouter/fusionandopenrouter/fusion, but this block only verifies the former. Add one subtest for the short-key variant to protect that branch from regressions.Suggested subtest shape
+ t.Run("openrouter fusion short key is configured", func(t *testing.T) { + config := map[string]any{ + "models": map[string]any{"providers": map[string]any{}}, + "agents": map[string]any{ + "defaults": map[string]any{ + "models": map[string]any{ + "openrouter/fusion": map[string]any{"alias": "OpenRouter Fusion"}, + }, + }, + }, + } + credentials := []clawv1alpha1.CredentialSpec{ + {Name: "or", Type: clawv1alpha1.CredentialTypeBearer, Provider: "openrouter", Domain: "openrouter.ai"}, + } + + injectModelCatalog(config, testClawWithCredentials(credentials)) + + models := config["agents"].(map[string]any)["defaults"].(map[string]any)["models"].(map[string]any) + fusion := models["openrouter/fusion"].(map[string]any) + params := fusion["params"].(map[string]any) + extraBody := params["extraBody"].(map[string]any) + plugins := extraBody["plugins"].([]any) + require.NotEmpty(t, plugins) + assert.Equal(t, "fusion", plugins[0].(map[string]any)["id"]) + })🤖 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 `@internal/controller/claw_configmap_test.go` around lines 498 - 625, The test coverage for OpenRouter fusion configuration only tests the full model key `openrouter/openrouter/fusion`, but the controller also handles the short-key variant `openrouter/fusion`. Add a new subtest to verify that the fusion configuration injection works correctly for the short-key variant. This test should follow a similar pattern to one of the existing subtests (such as "openrouter fusion config is added when user declares fusion model"), but configure the model using the `openrouter/fusion` key instead of the full key, then verify that the fusion plugin and other configuration are properly injected into the short-key variant as well.
🤖 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 `@internal/controller/claw_configmap_test.go`:
- Around line 515-623: The chained type assertions for extracting nested config
values in each fusion subtest (in "openrouter fusion config removes defaults",
"openrouter fusion config preserves user supplied panel", "openrouter fusion
config preserves snake case extra body", and "openrouter fusion config requires
openrouter provider") can panic before any value assertions run if the config
structure is unexpected. Break each chained assertion sequence into individual
steps, using `require` with the second return value of type assertions (like
`require.True(t, ok)` after checking `value, ok := map[key].(type)`) to validate
the config structure early and provide clear diagnostic messages if setup fails.
---
Nitpick comments:
In `@internal/controller/claw_configmap_test.go`:
- Around line 498-625: The test coverage for OpenRouter fusion configuration
only tests the full model key `openrouter/openrouter/fusion`, but the controller
also handles the short-key variant `openrouter/fusion`. Add a new subtest to
verify that the fusion configuration injection works correctly for the short-key
variant. This test should follow a similar pattern to one of the existing
subtests (such as "openrouter fusion config is added when user declares fusion
model"), but configure the model using the `openrouter/fusion` key instead of
the full key, then verify that the fusion plugin and other configuration are
properly injected into the short-key variant as well.
🪄 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: Organization UI
Review profile: CHILL
Plan: Enterprise
Run ID: f6126c1e-01bf-425a-a604-84e6141a364e
📒 Files selected for processing (7)
docs/adr/0006-dynamic-model-catalog.mddocs/adr/0018-centralized-provider-registry.mddocs/architecture.mddocs/user-guide.mdinternal/assets/manifests/claw/configmap.yamlinternal/controller/claw_configmap_test.gointernal/controller/claw_resource_controller.go
Signed-off-by: sallyom <somalley@redhat.com>
49f840c to
6c02e6d
Compare
add docs for using openrouter fusion
Summary by CodeRabbit
Release Notes
New Features
Documentation
Tests