Skip to content

add openrouter fusion#9

Open
sallyom wants to merge 1 commit into
redhat-et:mainfrom
sallyom:openrouter-fusion
Open

add openrouter fusion#9
sallyom wants to merge 1 commit into
redhat-et:mainfrom
sallyom:openrouter-fusion

Conversation

@sallyom

@sallyom sallyom commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

add docs for using openrouter fusion

Summary by CodeRabbit

Release Notes

  • New Features

    • OpenRouter Fusion models are now available in the model picker as an opt-in selection.
    • When Fusion is declared, the operator automatically applies the required Fusion wrapper configuration and preserves any user-specified analysis/judge settings.
  • Documentation

    • Updated user guides, architecture, and platform notes with Fusion setup and model-picker mapping details.
    • Clarified model catalog injection behavior, including how Fusion appears only when explicitly configured.
  • Tests

    • Added coverage for Fusion catalog injection and related configuration handling.

@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: 9dc6930b-5734-485f-a7bd-ebe14c742875

📥 Commits

Reviewing files that changed from the base of the PR and between 49f840c and 6c02e6d.

📒 Files selected for processing (7)
  • docs/adr/0006-dynamic-model-catalog.md
  • docs/adr/0018-centralized-provider-registry.md
  • docs/architecture.md
  • docs/user-guide.md
  • internal/assets/manifests/claw/configmap.yaml
  • internal/controller/claw_configmap_test.go
  • internal/controller/claw_resource_controller.go
✅ Files skipped from review due to trivial changes (3)
  • docs/adr/0018-centralized-provider-registry.md
  • internal/assets/manifests/claw/configmap.yaml
  • docs/user-guide.md
🚧 Files skipped from review as they are similar to previous changes (3)
  • internal/controller/claw_resource_controller.go
  • docs/adr/0006-dynamic-model-catalog.md
  • internal/controller/claw_configmap_test.go

📝 Walkthrough

Walkthrough

Adds OpenRouter Fusion as an opt-in model in the catalog injection pipeline. injectModelCatalog gains a hasOpenRouterProvider flag and new helpers that append the fusion plugin to extraBody.plugins on user-declared fusion model entries when an OpenRouter credential is present, preserving any user-supplied analysis_models and judge model. ADRs, architecture docs, user guide, and embedded ConfigMap are updated to describe the behavior.

Changes

OpenRouter Fusion opt-in model catalog injection

Layer / File(s) Summary
Fusion plugin injection in injectModelCatalog
internal/controller/claw_resource_controller.go
Core implementation adds a hasOpenRouterProvider flag tracked during credential-to-provider resolution; after building default catalog entries, conditionally calls helper functions to locate and mutate fusion model entries (both openrouter/openrouter/fusion and openrouter/fusion key variants), initialize missing params/extraBody maps, and append a fusion plugin if not already present.
Fusion subtest coverage
internal/controller/claw_configmap_test.go
Test suite updates the OpenRouter default-catalog subtest to assert fusion is not included by default; adds four new subtests covering automatic plugin generation (bare fusion model gets injected fusion plugin), user-field preservation (analysis_models and judge model retained when provided), snake_case-to-camelCase translation (params.extra_body becomes params.extraBody), and params omission when no OpenRouter credential is present.
Fusion documentation
docs/adr/0006-dynamic-model-catalog.md, docs/adr/0018-centralized-provider-registry.md, docs/architecture.md, docs/user-guide.md, internal/assets/manifests/claw/configmap.yaml
Design and user-facing documentation updated across ADRs, architecture guide, user guide, and embedded platform documentation: ADR-0006 expands catalog injection steps and marks Fusion opt-in with escape-hatch guidance; ADR-0018 specifies OpenRouter bearer-auth defaults and Fusion opt-in behavior; architecture.md documents automatic extraBody insertion and latency notes; user-guide.md explains opt-in flow and extends spec.config.raw example with Fusion model entry and plugin config; embedded PLATFORM.md clarifies three-segment model-picker key structure and Fusion enablement via CR or config patches.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'add openrouter fusion' is concise and directly reflects the main change—adding OpenRouter Fusion support and documentation throughout the codebase.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 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 and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
internal/controller/claw_configmap_test.go (1)

498-625: ⚡ Quick win

Add coverage for the openrouter/fusion short-key branch.

The controller mutates both openrouter/openrouter/fusion and openrouter/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

📥 Commits

Reviewing files that changed from the base of the PR and between f8c18ad and 49f840c.

📒 Files selected for processing (7)
  • docs/adr/0006-dynamic-model-catalog.md
  • docs/adr/0018-centralized-provider-registry.md
  • docs/architecture.md
  • docs/user-guide.md
  • internal/assets/manifests/claw/configmap.yaml
  • internal/controller/claw_configmap_test.go
  • internal/controller/claw_resource_controller.go

Comment thread internal/controller/claw_configmap_test.go Outdated
Signed-off-by: sallyom <somalley@redhat.com>
@sallyom sallyom force-pushed the openrouter-fusion branch from 49f840c to 6c02e6d Compare June 16, 2026 13:49
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.

1 participant