Skip to content

feat(models): wire model selection to semantic router create workflow#2242

Open
MarsKubeX wants to merge 4 commits into
openkaiden:mainfrom
MarsKubeX:add-model-step-semantic-router-wizard
Open

feat(models): wire model selection to semantic router create workflow#2242
MarsKubeX wants to merge 4 commits into
openkaiden:mainfrom
MarsKubeX:add-model-step-semantic-router-wizard

Conversation

@MarsKubeX

@MarsKubeX MarsKubeX commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Add a multi-select model step to the semantic router creation wizard so users can pick backend models from the catalog. Models with llmMetadata.semanticRouter defined are filtered out. Extends ModelSelectionTable with multiSelect support to avoid duplicating the table rendering logic.

Grabacion.de.pantalla.2026-06-22.a.las.15.07.53.mov

Closes #2103

@MarsKubeX MarsKubeX requested a review from a team as a code owner June 22, 2026 13:06
@MarsKubeX MarsKubeX requested review from gastoner and jeffmaury and removed request for a team June 22, 2026 13:06
@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@MarsKubeX, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 31 minutes and 23 seconds. 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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses rolling per-developer review limits. Reviews become available again as older review attempts age out of the rolling limit window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: ec32cc17-bace-4e11-ab3d-84feb3b151cd

📥 Commits

Reviewing files that changed from the base of the PR and between f4b34ce and 1a316f4.

📒 Files selected for processing (3)
  • packages/renderer/src/lib/models/SemanticRouterCreate.svelte
  • packages/renderer/src/lib/models/SemanticRouterCreateStepSignals.spec.ts
  • packages/renderer/src/lib/models/SemanticRouterCreateStepSignals.svelte
📝 Walkthrough

Walkthrough

The PR extends the Add Semantic Router UI from a single-step form into a 3-step wizard. Step 1 collects basic setup fields; step 2 is a new SemanticRouterCreateStepModels component for multi-selecting backend models; step 3 is the signals and decisions step. ModelSelectionTable gains multi-select support with checkboxes, selectedKeys, and ontoggle callbacks. LLMMetadata adds semanticRouter?: string to mark models that should be excluded from the selection list.

Changes

Semantic Router 3-Step Wizard with Model Selection

Layer / File(s) Summary
LLMMetadata API contract
packages/extension-api/src/extension-api.d.ts
Adds optional semanticRouter?: string to LLMMetadata, used downstream to filter out already-routed models from the backend model selection list.
ModelSelectionTable multi-select extension
packages/renderer/src/lib/models/ModelSelectionTable.svelte
Adds selectedKeys, multiSelect, and ontoggle props; introduces isSelected() helper and selectedCount derived state; conditionally renders checkbox vs radio inputs per mode; updates row interaction handlers and footer to support multi-select.
SemanticRouterCreateStepModels component and tests
packages/renderer/src/lib/models/SemanticRouterCreateStepModels.svelte, packages/renderer/src/lib/models/SemanticRouterCreateStepModels.spec.ts
New Svelte component that derives eligibleModels by excluding disabled and semanticRouter-flagged catalog models, maintains a SvelteSet of selected keys synced to a bound selectedModels prop, and renders ModelSelectionTable in multi-select mode. Tests cover heading, empty state, category grouping, semantic-router filtering, checkbox and row selection toggling, multi-select counting, deselection, search filtering, disabled model exclusion, catalog link presence, and hidden count indicator.
SemanticRouterCreate 3-step wizard wiring and tests
packages/renderer/src/lib/models/SemanticRouterCreate.svelte, packages/renderer/src/lib/models/SemanticRouterCreate.spec.ts
Expands WIZARD_STEPS to include "Backend models" as the second step; adds selectedModels, per-step canProceed validation flags, buildModelRefs() helper, and goBack() navigation; updates buildConfig() to construct routing.decisions with OR operator and modelRefs; conditionally renders SemanticRouterCreateStepModels and a Back button. Tests updated to cover 3-step navigation, model-step gating on the Continue button, step-counter progression to "Step 1 of 3", correct createSemanticRouter payload with modelRefs, success navigation to semantic-routers page, and the full 3-step failure path with error rendering.

Sequence Diagram

sequenceDiagram
    actor User
    participant SemanticRouterCreate
    participant SemanticRouterCreateStepModels
    participant ModelSelectionTable
    participant modelCatalog as Model Catalog Store

    User->>SemanticRouterCreate: Enter router name → click Continue
    SemanticRouterCreate->>SemanticRouterCreateStepModels: render step 2 (bind selectedModels)
    modelCatalog->>SemanticRouterCreateStepModels: catalog models
    SemanticRouterCreateStepModels->>SemanticRouterCreateStepModels: filter eligibleModels (enabled, no semanticRouter)
    SemanticRouterCreateStepModels->>ModelSelectionTable: eligible models + selectedKeys + toggleModel
    User->>ModelSelectionTable: click checkbox/row to select model
    ModelSelectionTable->>SemanticRouterCreateStepModels: ontoggle(key)
    SemanticRouterCreateStepModels->>SemanticRouterCreate: selectedModels updated
    User->>SemanticRouterCreate: click Continue to step 3
    User->>SemanticRouterCreate: click Create (step 3)
    SemanticRouterCreate->>SemanticRouterCreate: buildModelRefs(selectedModels)
    SemanticRouterCreate->>SemanticRouterCreate: window.createSemanticRouter(name, decisions[OR + modelRefs])
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • openkaiden/kaiden#1663: Also modifies ModelSelectionTable.svelte — that PR introduced/used the component for onboarding model picking, while this PR extends it with multi-select support via selectedKeys and ontoggle.
  • openkaiden/kaiden#2115: Introduced the initial SemanticRouterCreate.svelte page that this PR converts into a multi-step wizard with backend model selection.
  • openkaiden/kaiden#2191: Also modifies the semantic router creation wizard—SemanticRouterCreate.svelte and tests—to change step progression and update the createSemanticRouter payload structure with signals and decisions.

Suggested reviewers

  • bmahabirbu
  • fbricon
  • jeffmaury
  • gastoner
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main feature added: wiring model selection to the semantic router creation workflow, which directly aligns with the primary change across all modified files.
Description check ✅ Passed The description explains the core functionality added (multi-select model step), the filtering behavior for models with llmMetadata.semanticRouter, and the approach to avoid duplication by extending ModelSelectionTable.
Linked Issues check ✅ Passed The PR fully implements the requirements from issue #2103: adds model selection to the semantic router workflow, filters models without llmMetadata.semanticRouter, and creates the expected UI step shown in mockups.
Out of Scope Changes check ✅ Passed All changes are directly scoped to implementing model selection for semantic router creation: type extensions, component enhancements, and new step implementation with comprehensive tests.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 `@packages/renderer/src/lib/models/SemanticRouterCreateStepModels.svelte`:
- Line 22: The filter condition on line 22 in
SemanticRouterCreateStepModels.svelte only excludes models when semanticRouter
is truthy, but it should exclude models whenever the semanticRouter property is
defined in llmMetadata, including when it is defined as a falsy value like an
empty string. Change the condition to check whether semanticRouter is defined
(not undefined) rather than checking if it is truthy, so that models with
semanticRouter explicitly set to any value, including empty strings, are
properly excluded from selection.
- Around line 16-34: The selectedKeys variable is hardcoded to initialize as an
empty SvelteSet on line 16, which causes all previously selected models to be
lost when remounting the component after clicking Back and then Next in the
wizard. To preserve the previously selected models, initialize selectedKeys with
the keys from the current selectedModels by mapping each model through
modelSelectionKey to derive the initial keys, ensuring wizard continuity when
users navigate back and forth.
🪄 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: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: e1b3ff38-bd15-45b1-a523-ef0bab7f6ee9

📥 Commits

Reviewing files that changed from the base of the PR and between 677e04b and 7d32a9d.

📒 Files selected for processing (6)
  • packages/extension-api/src/extension-api.d.ts
  • packages/renderer/src/lib/models/ModelSelectionTable.svelte
  • packages/renderer/src/lib/models/SemanticRouterCreate.spec.ts
  • packages/renderer/src/lib/models/SemanticRouterCreate.svelte
  • packages/renderer/src/lib/models/SemanticRouterCreateStepModels.spec.ts
  • packages/renderer/src/lib/models/SemanticRouterCreateStepModels.svelte
📜 Review details
⏰ Context from checks skipped due to timeout. (10)
  • GitHub Check: typecheck
  • GitHub Check: unit tests / ubuntu-24.04
  • GitHub Check: Linux
  • GitHub Check: smoke-e2e-tests (dev) / ubuntu-24.04 (ollama)
  • GitHub Check: smoke-e2e-tests (prod) / ubuntu-24.04 (ollama)
  • GitHub Check: unit tests / macos-15
  • GitHub Check: Windows
  • GitHub Check: macOS
  • GitHub Check: unit tests / windows-2022
  • GitHub Check: linter, formatters
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use /@/ path aliases instead of relative paths for imports outside the current directory's module group; use relative imports only for sibling modules within the same directory

Files:

  • packages/extension-api/src/extension-api.d.ts
  • packages/renderer/src/lib/models/SemanticRouterCreateStepModels.spec.ts
  • packages/renderer/src/lib/models/SemanticRouterCreate.spec.ts
**/*.spec.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.spec.{ts,tsx,js,jsx}: Use test() instead of it() for test cases in Vitest unit tests
Use vi.mock(import('...')) for auto-mocking modules in unit tests; avoid manual mock factories when possible
Use vi.resetAllMocks() in beforeEach hooks instead of vi.clearAllMocks() for resetting mocks between tests
When an auto-mocked function or class method needs a real implementation, use vi.mocked(...) with the prototype pattern for class methods: vi.mocked(MyClass.prototype.myMethod).mockImplementation(...)

Files:

  • packages/renderer/src/lib/models/SemanticRouterCreateStepModels.spec.ts
  • packages/renderer/src/lib/models/SemanticRouterCreate.spec.ts
packages/{main,renderer,preload}/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Container operations must include engineId parameter to identify the container engine

Files:

  • packages/renderer/src/lib/models/SemanticRouterCreateStepModels.spec.ts
  • packages/renderer/src/lib/models/SemanticRouterCreate.spec.ts
🧠 Learnings (8)
📚 Learning: 2026-05-12T17:14:02.153Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1850
File: packages/renderer/src/lib/agent-workspaces/AgentWorkspaceList.svelte:66-70
Timestamp: 2026-05-12T17:14:02.153Z
Learning: When reviewing code that uses `AgentWorkspaceSummaryUI.runtime`, treat it as a required, non-null `string` per the `openkaiden/kdn-api` 0.12.0 schema. Therefore, code like `a.runtime.localeCompare(b.runtime)` is safe and should not trigger warnings about possible `undefined`/`null` values or suggestions to use nullish coalescing/optional chaining for `runtime` (unless the current local types still mark `runtime` as optional, indicating a schema/version mismatch).

Applied to files:

  • packages/extension-api/src/extension-api.d.ts
  • packages/renderer/src/lib/models/SemanticRouterCreateStepModels.svelte
  • packages/renderer/src/lib/models/SemanticRouterCreate.svelte
  • packages/renderer/src/lib/models/SemanticRouterCreateStepModels.spec.ts
  • packages/renderer/src/lib/models/SemanticRouterCreate.spec.ts
  • packages/renderer/src/lib/models/ModelSelectionTable.svelte
📚 Learning: 2026-04-15T08:04:32.031Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1336
File: packages/renderer/src/lib/guided-setup/GuidedSetup.svelte:9-11
Timestamp: 2026-04-15T08:04:32.031Z
Learning: For Svelte components in this repo, if a callback prop is typed as `() => void`, TypeScript idiomatically allows passing async functions (e.g., `() => Promise<void>`), because `() => void` indicates the caller ignores the return value rather than requiring `undefined`. Do not recommend changing these prop types to `() => void | Promise<void>` solely to “fix” async compatibility—unless there is an actual need for the caller to observe the returned value.

Applied to files:

  • packages/renderer/src/lib/models/SemanticRouterCreateStepModels.svelte
  • packages/renderer/src/lib/models/SemanticRouterCreate.svelte
  • packages/renderer/src/lib/models/ModelSelectionTable.svelte
📚 Learning: 2026-04-28T13:34:51.610Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1431
File: packages/renderer/src/lib/guided-setup/panels/OpenCodePanel.svelte:14-20
Timestamp: 2026-04-28T13:34:51.610Z
Learning: In this repo’s Svelte renderer (packages/renderer/src/**/*.svelte), `podman-desktop/ui-svelte`’s `Link` component does not accept an `href` prop. For opening external URLs, use the established pattern `on:click={() => window.openExternal(url)}` (optionally typed as `on:click={(): Promise<void> => window.openExternal(url)}`), consistent with existing components like `ProviderLinks.svelte`, `WelcomePage.svelte`, and `OpenCodePanel.svelte`. Do not treat `window.openExternal()` usage in renderer Svelte components as bypassing a security restriction, and do not recommend replacing it with `Link`/`href`-based navigation. (There is also no `setupSecurityRestrictionsOnLinks` utility in the renderer.)

Applied to files:

  • packages/renderer/src/lib/models/SemanticRouterCreateStepModels.svelte
  • packages/renderer/src/lib/models/SemanticRouterCreate.svelte
  • packages/renderer/src/lib/models/ModelSelectionTable.svelte
📚 Learning: 2026-04-29T11:54:22.423Z
Learnt from: vancura
Repo: openkaiden/kaiden PR: 1494
File: packages/renderer/src/Loader.svelte:13-13
Timestamp: 2026-04-29T11:54:22.423Z
Learning: In this codebase’s renderer, timer variables in Svelte files (e.g., in `packages/renderer/src/Loader.svelte`) that store `setTimeout` handles are intentionally typed as `NodeJS.Timeout` (and not `ReturnType<typeof setTimeout>`). When reviewing, do not flag or recommend changing this to `ReturnType<typeof setTimeout>` for portability—treat `NodeJS.Timeout` as the established convention for renderer timer variables.

Applied to files:

  • packages/renderer/src/lib/models/SemanticRouterCreateStepModels.svelte
  • packages/renderer/src/lib/models/SemanticRouterCreate.svelte
  • packages/renderer/src/lib/models/ModelSelectionTable.svelte
📚 Learning: 2026-06-10T15:22:39.639Z
Learnt from: bmahabirbu
Repo: openkaiden/kaiden PR: 2115
File: packages/renderer/src/lib/models/SemanticRouterCreate.svelte:134-137
Timestamp: 2026-06-10T15:22:39.639Z
Learning: In multi-step wizard UIs, it’s acceptable for “Next step” buttons to be temporarily non-interactive during incremental work delivered across multiple PRs. When reviewing Svelte files under `packages/renderer/src/lib/**`, do not flag these UX issues if the button lacks an onClick handler *and* there is an explicit TODO comment indicating deferred wiring, and the PR author confirms (in the PR description) that this is an intentional staged implementation. If no TODO/deferred-wiring marker (or no author confirmation) is present, treat missing handlers as a potential UX issue.

Applied to files:

  • packages/renderer/src/lib/models/SemanticRouterCreateStepModels.svelte
  • packages/renderer/src/lib/models/SemanticRouterCreate.svelte
  • packages/renderer/src/lib/models/ModelSelectionTable.svelte
📚 Learning: 2026-04-15T08:51:08.199Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1336
File: packages/renderer/src/lib/guided-setup/GuidedSetup.spec.ts:64-69
Timestamp: 2026-04-15T08:51:08.199Z
Learning: For Svelte component test files under `packages/renderer/src/**` with names ending in `.spec.ts` that use `render` from `testing-library/svelte`, call `vi.useFakeTimers({ shouldAdvanceTime: true })` inside a `beforeEach`. Keep it in `beforeEach` for these tests to avoid flakiness from Svelte’s internal tick scheduling; do not remove or flag it based on the presence/absence of explicit timer manipulation in individual tests.

Applied to files:

  • packages/renderer/src/lib/models/SemanticRouterCreateStepModels.spec.ts
  • packages/renderer/src/lib/models/SemanticRouterCreate.spec.ts
📚 Learning: 2026-04-22T02:58:52.726Z
Learnt from: bmahabirbu
Repo: openkaiden/kaiden PR: 1379
File: packages/renderer/src/lib/models/ModelsCatalogEmptyScreen.spec.ts:32-38
Timestamp: 2026-04-22T02:58:52.726Z
Learning: In tests under packages/renderer/src/lib/models/**/*.spec.ts, it’s an intentional Testing Library convention to assert user-facing copy using exact string matches with screen.getByText(...). Do not flag these exact-string getByText assertions as “brittle” or suggest replacing them with regex matchers or data-testid in these specific test files, because the goal is to fail when the wording changes.

Applied to files:

  • packages/renderer/src/lib/models/SemanticRouterCreateStepModels.spec.ts
  • packages/renderer/src/lib/models/SemanticRouterCreate.spec.ts
📚 Learning: 2026-06-16T06:15:26.225Z
Learnt from: gastoner
Repo: openkaiden/kaiden PR: 2145
File: packages/renderer/src/lib/mcp/MCPServerRemoteListActions.spec.ts:46-49
Timestamp: 2026-06-16T06:15:26.225Z
Learning: For renderer unit tests in this repo (files included in `packages/renderer/vite.config.js` via `setupFiles`), do not manually mock `window` API methods in `beforeEach` or within the spec. The test setup (`packages/renderer/vite.tests.setup.js`) reads `packages/preload/exposedInMainWorld.d.ts` and defines each declared `Window` method on `window` as a `vi.fn()` using `Object.defineProperty`, so `window.*` methods (e.g., `startMcpServer`, `stopMcpServer`, `showMessageBox`) are already present as mocks. Only add an explicit mock if the method is not declared in `exposedInMainWorld.d.ts` (in which case update the `.d.ts` so the shared setup can generate the mock).

Applied to files:

  • packages/renderer/src/lib/models/SemanticRouterCreateStepModels.spec.ts
  • packages/renderer/src/lib/models/SemanticRouterCreate.spec.ts
🔇 Additional comments (5)
packages/extension-api/src/extension-api.d.ts (1)

654-657: LGTM!

packages/renderer/src/lib/models/ModelSelectionTable.svelte (1)

32-47: LGTM!

Also applies to: 58-68, 153-164, 178-194, 206-210

packages/renderer/src/lib/models/SemanticRouterCreateStepModels.spec.ts (1)

31-34: LGTM!

Also applies to: 80-94, 96-224

packages/renderer/src/lib/models/SemanticRouterCreate.svelte (1)

6-16: LGTM!

Also applies to: 27-46, 57-68, 78-83, 178-179, 194-197

packages/renderer/src/lib/models/SemanticRouterCreate.spec.ts (1)

22-66: LGTM!

Also applies to: 75-188, 197-208, 223-234

Comment thread packages/renderer/src/lib/models/SemanticRouterCreateStepModels.svelte Outdated
Comment thread packages/renderer/src/lib/models/SemanticRouterCreateStepModels.svelte Outdated
@codecov

codecov Bot commented Jun 22, 2026

Copy link
Copy Markdown

@gastoner gastoner left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

MarsKubeX and others added 2 commits June 23, 2026 10:54
Add a multi-select model step to the semantic router creation wizard so
users can pick backend models from the catalog. Models with
llmMetadata.semanticRouter defined are filtered out. Extends
ModelSelectionTable with multiSelect support to avoid duplicating the
table rendering logic.

Closes openkaiden#2103

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Marcel Bertagnini <mbertagn@redhat.com>
Seed selectedKeys from the bound selectedModels prop on mount so
Back → Next no longer drops prior picks, and use strict !== undefined
check for semanticRouter filtering to exclude all defined values.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Marcel Bertagnini <mbertagn@redhat.com>
@MarsKubeX MarsKubeX force-pushed the add-model-step-semantic-router-wizard branch from 7d32a9d to 2c9d4c2 Compare June 23, 2026 09:12
Signed-off-by: Marcel Bertagnini <mbertagn@redhat.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/renderer/src/lib/models/SemanticRouterCreate.svelte (1)

27-27: 🗄️ Data Integrity & Integration | 🟠 Major

selectedModels is not persisted in the draft store while other wizard state is, creating a data consistency issue.

currentStepIndex, keywords, and decisions are stored in routerWizard.draft, which persists as module-level state. If a user selects models, navigates away (via an external link, not the Cancel button), and returns, the wizard restores the step index from the draft but selectedModels is reset to [] because it's local component-level $state([]). The Create button would then be disabled (canProceedModels would be false) without clear indication to the user why their selection was lost.

Add modelRefs (or similar) to the SemanticRouterCreateDraft interface to store selected models alongside the other persisted state.

🤖 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 `@packages/renderer/src/lib/models/SemanticRouterCreate.svelte` at line 27, The
selectedModels variable is declared as local component-level state using
$state([]), but other wizard state like currentStepIndex, keywords, and
decisions are persisted in routerWizard.draft. This causes selectedModels to be
lost when users navigate away from the wizard, even though the other state is
restored. To fix this, add a modelRefs field (or similar) to the
SemanticRouterCreateDraft interface definition to store selected models, then
update the selectedModels variable to read from and write to
routerWizard.draft.modelRefs instead of maintaining it as separate local state.
🤖 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 `@packages/renderer/src/lib/models/SemanticRouterCreate.svelte`:
- Around line 83-88: The decisions object in buildConfig() uses custom decisions
verbatim when d.decisions.length is greater than zero, but this flow ignores the
selectedModels from step 2. To fix this, ensure selectedModels are either passed
to the SemanticRouterCreateStepSignals component by adding it to the bindings
alongside keywords and decisions, and update the Props interface to include
selectedModels, then have the signals step incorporate selectedModels into each
decision's modelRefs array; alternatively, modify the buildConfig() logic to
merge the selectedModels (as modelRefs) into custom decisions when
d.decisions.length is greater than zero.

---

Outside diff comments:
In `@packages/renderer/src/lib/models/SemanticRouterCreate.svelte`:
- Line 27: The selectedModels variable is declared as local component-level
state using $state([]), but other wizard state like currentStepIndex, keywords,
and decisions are persisted in routerWizard.draft. This causes selectedModels to
be lost when users navigate away from the wizard, even though the other state is
restored. To fix this, add a modelRefs field (or similar) to the
SemanticRouterCreateDraft interface definition to store selected models, then
update the selectedModels variable to read from and write to
routerWizard.draft.modelRefs instead of maintaining it as separate local state.
🪄 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: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 37831507-41e4-4090-bd0b-863417198ed0

📥 Commits

Reviewing files that changed from the base of the PR and between 2c9d4c2 and f4b34ce.

📒 Files selected for processing (1)
  • packages/renderer/src/lib/models/SemanticRouterCreate.svelte
📜 Review details
⏰ Context from checks skipped due to timeout. (10)
  • GitHub Check: macOS
  • GitHub Check: smoke-e2e-tests (dev) / ubuntu-24.04 (ollama)
  • GitHub Check: smoke-e2e-tests (prod) / ubuntu-24.04 (ollama)
  • GitHub Check: Linux
  • GitHub Check: unit tests / macos-15
  • GitHub Check: unit tests / ubuntu-24.04
  • GitHub Check: unit tests / windows-2022
  • GitHub Check: typecheck
  • GitHub Check: linter, formatters
  • GitHub Check: Windows
🧰 Additional context used
🧠 Learnings (5)
📚 Learning: 2026-04-15T08:04:32.031Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1336
File: packages/renderer/src/lib/guided-setup/GuidedSetup.svelte:9-11
Timestamp: 2026-04-15T08:04:32.031Z
Learning: For Svelte components in this repo, if a callback prop is typed as `() => void`, TypeScript idiomatically allows passing async functions (e.g., `() => Promise<void>`), because `() => void` indicates the caller ignores the return value rather than requiring `undefined`. Do not recommend changing these prop types to `() => void | Promise<void>` solely to “fix” async compatibility—unless there is an actual need for the caller to observe the returned value.

Applied to files:

  • packages/renderer/src/lib/models/SemanticRouterCreate.svelte
📚 Learning: 2026-04-28T13:34:51.610Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1431
File: packages/renderer/src/lib/guided-setup/panels/OpenCodePanel.svelte:14-20
Timestamp: 2026-04-28T13:34:51.610Z
Learning: In this repo’s Svelte renderer (packages/renderer/src/**/*.svelte), `podman-desktop/ui-svelte`’s `Link` component does not accept an `href` prop. For opening external URLs, use the established pattern `on:click={() => window.openExternal(url)}` (optionally typed as `on:click={(): Promise<void> => window.openExternal(url)}`), consistent with existing components like `ProviderLinks.svelte`, `WelcomePage.svelte`, and `OpenCodePanel.svelte`. Do not treat `window.openExternal()` usage in renderer Svelte components as bypassing a security restriction, and do not recommend replacing it with `Link`/`href`-based navigation. (There is also no `setupSecurityRestrictionsOnLinks` utility in the renderer.)

Applied to files:

  • packages/renderer/src/lib/models/SemanticRouterCreate.svelte
📚 Learning: 2026-04-29T11:54:22.423Z
Learnt from: vancura
Repo: openkaiden/kaiden PR: 1494
File: packages/renderer/src/Loader.svelte:13-13
Timestamp: 2026-04-29T11:54:22.423Z
Learning: In this codebase’s renderer, timer variables in Svelte files (e.g., in `packages/renderer/src/Loader.svelte`) that store `setTimeout` handles are intentionally typed as `NodeJS.Timeout` (and not `ReturnType<typeof setTimeout>`). When reviewing, do not flag or recommend changing this to `ReturnType<typeof setTimeout>` for portability—treat `NodeJS.Timeout` as the established convention for renderer timer variables.

Applied to files:

  • packages/renderer/src/lib/models/SemanticRouterCreate.svelte
📚 Learning: 2026-05-12T17:14:02.153Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1850
File: packages/renderer/src/lib/agent-workspaces/AgentWorkspaceList.svelte:66-70
Timestamp: 2026-05-12T17:14:02.153Z
Learning: When reviewing code that uses `AgentWorkspaceSummaryUI.runtime`, treat it as a required, non-null `string` per the `openkaiden/kdn-api` 0.12.0 schema. Therefore, code like `a.runtime.localeCompare(b.runtime)` is safe and should not trigger warnings about possible `undefined`/`null` values or suggestions to use nullish coalescing/optional chaining for `runtime` (unless the current local types still mark `runtime` as optional, indicating a schema/version mismatch).

Applied to files:

  • packages/renderer/src/lib/models/SemanticRouterCreate.svelte
📚 Learning: 2026-06-10T15:22:39.639Z
Learnt from: bmahabirbu
Repo: openkaiden/kaiden PR: 2115
File: packages/renderer/src/lib/models/SemanticRouterCreate.svelte:134-137
Timestamp: 2026-06-10T15:22:39.639Z
Learning: In multi-step wizard UIs, it’s acceptable for “Next step” buttons to be temporarily non-interactive during incremental work delivered across multiple PRs. When reviewing Svelte files under `packages/renderer/src/lib/**`, do not flag these UX issues if the button lacks an onClick handler *and* there is an explicit TODO comment indicating deferred wiring, and the PR author confirms (in the PR description) that this is an intentional staged implementation. If no TODO/deferred-wiring marker (or no author confirmation) is present, treat missing handlers as a potential UX issue.

Applied to files:

  • packages/renderer/src/lib/models/SemanticRouterCreate.svelte
🔇 Additional comments (2)
packages/renderer/src/lib/models/SemanticRouterCreate.svelte (2)

6-21: LGTM!


51-62: LGTM!

Comment thread packages/renderer/src/lib/models/SemanticRouterCreate.svelte
The signals step was reading from the full catalog store, so decisions
could reference models the user never selected in the models step.
Replace the catalogModels store dependency with an availableModels prop
passed from the parent wizard.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Marcel Bertagnini <mbertagn@redhat.com>
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.

Wire model selection to the create semantic router workflow

2 participants