Skip to content

feat(workspaces): add Project step to workspace creation wizard#2146

Open
gastoner wants to merge 1 commit into
openkaiden:mainfrom
gastoner:workspace_creation_form_project
Open

feat(workspaces): add Project step to workspace creation wizard#2146
gastoner wants to merge 1 commit into
openkaiden:mainfrom
gastoner:workspace_creation_form_project

Conversation

@gastoner

Copy link
Copy Markdown
Contributor

Introduces a project selection step that pre-fills workspace settings (source path, name, skills, MCP servers, secrets, filesystem, network) from a project definition, or allows starting from scratch.

image

Closes #2111

@gastoner gastoner requested a review from a team as a code owner June 12, 2026 07:47
@gastoner gastoner requested review from bmahabirbu and fbricon and removed request for a team June 12, 2026 07:47
@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR adds optional saved-project selection to the agent workspace creation wizard. A new selectedProjectId field is added to the draft store. AgentWorkspaceCreateStepWorkspace gains a collapsible project-picker panel. AgentWorkspaceCreate adds helpers to apply or clear a project's configuration into the draft, and forwards the selected project ID in both createAgentWorkspace call paths.

Changes

Project Selection Wizard Integration

Layer / File(s) Summary
Draft store: add selectedProjectId field
packages/renderer/src/stores/agent-workspace-create-draft.svelte.ts
Adds selectedProjectId: string | undefined to WorkspaceCreateDraft interface and initializes it to undefined in createInitialDraft().
Saved project panel in AgentWorkspaceCreateStepWorkspace
packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreateStepWorkspace.svelte, AgentWorkspaceCreateStepWorkspace.spec.ts
Extends component props with projectOpen, projects, selectedProjectId, and onProjectSelect; adds toggleProject(); renders a conditional collapsible listbox with a "None" option and per-project entries (name, path, resource counts) when projects.length > 0.
Wizard orchestration: apply/clear helpers and payload wiring
packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreate.svelte
Adds applyProject and clearProject helpers that translate a project's session metadata, skills, MCP servers, secrets, knowledge, filesystem mounts/access, and network mode into draft store fields; wires handleProjectSelect into the workspace step; passes project: draftSnapshot.selectedProjectId in both API call paths.
Integration tests for project selection and draft mapping
packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreate.spec.ts
Mocks the workspace-projects store and adds tests covering accordion visibility, project-selection draft pre-fill, "None" clearing to all-selected defaults, and network/filesystem field mapping (host-mode translations, mount normalization, empty-mount behavior).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • openkaiden/kaiden#2000: Introduced the WorkspaceProjectInfo type and workspace-project IPC APIs that the main PR's workspaceProjectInfos store consumption and project selection UI directly depend on.
  • openkaiden/kaiden#2048: Both PRs modify AgentWorkspaceCreate.svelte's window.createAgentWorkspace payload at the same call sites — the retrieved PR adds selectedAgent handling while the main PR adds project: draftSnapshot.selectedProjectId.
  • openkaiden/kaiden#1231: Added AgentWorkspaceCreateOptions.project plumbing through preload/IPC for kdn init, which is the backend path the main PR's newly forwarded project field reaches.

Suggested reviewers

  • fbricon
  • bmahabirbu
  • jeffmaury
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.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
Title check ✅ Passed The title clearly and concisely describes the main change: adding a Project step to the workspace creation wizard.
Description check ✅ Passed The description is directly related to the changeset, explaining the new project selection step and how it pre-fills workspace settings.
Linked Issues check ✅ Passed The PR implementation fully addresses issue #2111 by enabling project selection during workspace creation and pre-filling settings from selected projects.
Out of Scope Changes check ✅ Passed All changes are directly related to the project selection feature: test enhancements, draft store updates, component modifications, and UI additions for project selection.

✏️ 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 and usage tips.

@codecov

codecov Bot commented Jun 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@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/agent-workspaces/AgentWorkspaceCreate.svelte`:
- Around line 87-99: The applyNetworkFromProject function incorrectly maps
deny-mode projects with custom hosts to the 'registries' UI path; update the
logic in applyNetworkFromProject so that when net.mode === 'deny' and hosts is
non-empty it sets wizard.draft.selectedNetwork = 'blocked' and places the hosts
into wizard.draft.hostsByMode.blocked (instead of setting selectedNetwork to
'registries' and writing to registries), preserving the existing behavior where
empty deny hosts fall back to a single empty blocked entry; keep references to
wizard.draft.selectedNetwork and wizard.draft.hostsByMode (registries vs
blocked) when making the change.

In
`@packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreateStepProject.spec.ts`:
- Around line 53-55: The test setup only calls vi.resetAllMocks() in the
beforeEach; add vi.useFakeTimers({ shouldAdvanceTime: true }) inside the same
beforeEach so Svelte's scheduling behaves like other renderer workspace
specs—update the beforeEach block (where vi.resetAllMocks() is called) to call
vi.useFakeTimers({ shouldAdvanceTime: true }) as well (and optionally mirror
with vi.useRealTimers() in an afterEach if tests restore timers elsewhere).
🪄 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: 26208a7c-f8c1-4412-9e31-72ae2121a329

📥 Commits

Reviewing files that changed from the base of the PR and between 6532f2e and 08c32b8.

📒 Files selected for processing (5)
  • packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreate.spec.ts
  • packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreate.svelte
  • packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreateStepProject.spec.ts
  • packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreateStepProject.svelte
  • packages/renderer/src/stores/agent-workspace-create-draft.svelte.ts
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: smoke-e2e-tests (prod) / ubuntu-24.04 (ollama)
  • GitHub Check: unit tests / windows-2022
  • GitHub Check: Linux
  • GitHub Check: unit tests / ubuntu-24.04
  • GitHub Check: unit tests / macos-15
  • GitHub Check: macOS
  • GitHub Check: Windows
🧰 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/renderer/src/stores/agent-workspace-create-draft.svelte.ts
  • packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreate.spec.ts
  • packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreateStepProject.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/stores/agent-workspace-create-draft.svelte.ts
  • packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreate.spec.ts
  • packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreateStepProject.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/agent-workspaces/AgentWorkspaceCreate.spec.ts
  • packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreateStepProject.spec.ts
🧠 Learnings (8)
📚 Learning: 2026-04-17T20:27:03.231Z
Learnt from: bmahabirbu
Repo: openkaiden/kaiden PR: 1379
File: packages/renderer/src/stores/model-catalog.ts:5-21
Timestamp: 2026-04-17T20:27:03.231Z
Learning: In openkaiden/kaiden’s Electron renderer (single window, no shared localStorage origin across tabs/windows), do not suggest using `window.addEventListener('storage', ...)` for localStorage cross-tab synchronization. For store code like `packages/renderer/src/stores/model-catalog.ts`, treat `storage` events as not applicable for syncing state; use other intra-window state/update mechanisms instead.

Applied to files:

  • packages/renderer/src/stores/agent-workspace-create-draft.svelte.ts
📚 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/stores/agent-workspace-create-draft.svelte.ts
  • packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreateStepProject.svelte
  • packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreate.spec.ts
  • packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreate.svelte
  • packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreateStepProject.spec.ts
📚 Learning: 2026-03-17T11:49:39.964Z
Learnt from: MarsKubeX
Repo: kortex-hub/kortex PR: 1111
File: packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCard.svelte:46-52
Timestamp: 2026-03-17T11:49:39.964Z
Learning: In Svelte components like AgentWorkspaceCard.svelte and CustomPick.svelte, using a div with role="button" and tabindex="0" as the clickable card container with an inner native <button> (e.g., for a remove action) is acceptable because nested <button> elements are invalid per HTML spec. Ensure the inner button's events do not bubble by calling stopPropagation on both click and keydown handlers. Do not flag this pattern as an accessibility issue when implemented this way, but verify that keyboard activation (Enter/Space) and ARIA semantics are preserved and that focus management remains clear.

Applied to files:

  • packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreateStepProject.svelte
  • packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreate.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/agent-workspaces/AgentWorkspaceCreateStepProject.svelte
  • packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreate.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/agent-workspaces/AgentWorkspaceCreateStepProject.svelte
  • packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreate.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/agent-workspaces/AgentWorkspaceCreateStepProject.svelte
  • packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreate.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/agent-workspaces/AgentWorkspaceCreateStepProject.svelte
  • packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreate.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/agent-workspaces/AgentWorkspaceCreate.spec.ts
  • packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreateStepProject.spec.ts

Comment thread packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreate.svelte Outdated
Comment on lines +53 to +55
beforeEach(() => {
vi.resetAllMocks();
});

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.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

FILE="packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreateStepProject.spec.ts"

echo "=== File: $FILE ==="
if [ -f "$FILE" ]; then
  wc -l "$FILE"
  sed -n '1,140p' "$FILE"
else
  echo "MISSING: $FILE"
  exit 1
fi

echo
echo "=== Search for fake timers usage in renderer specs ==="
rg -n "vi\.useFakeTimers" packages/renderer/src -S --glob "**/*.spec.ts" --glob "**/*.spec.tsx" || true

echo
echo "=== Search for the specific spec's beforeEach pattern ==="
rg -n "beforeEach\(\(\)\s*=>\s*\{\s*vi\.resetAllMocks\(\);" "$FILE" -S || true

echo
echo "=== Find other renderer specs using testing-library/svelte render ==="
rg -n "from ['\"]`@testing-library/svelte`['\"]|from ['\"]testing-library/svelte['\"]|testing-library/svelte" packages/renderer/src --glob "**/*.spec.ts" --glob "**/*.spec.tsx" || true

echo
echo "=== Example: check a couple nearby specs for fake timers convention ==="
# Limit to keep output small
for f in $(fd --type f --extension ts packages/renderer/src/lib/agent-workspaces -x printf "%p\n" | head -n 20); do
  if [[ "$f" == *.spec.ts || "$f" == *.spec.tsx ]]; then
    echo "--- $f ---"
    rg -n "beforeEach\\(" "$f" -n -S || true
    rg -n "vi\\.useFakeTimers" "$f" -S || true
  fi
done

Repository: openkaiden/kaiden

Length of output: 50865


🏁 Script executed:

#!/bin/bash
set -euo pipefail

files=(
  "packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreateStepWorkspace.spec.ts"
  "packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreateStepAgentModel.spec.ts"
  "packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreate.spec.ts"
  "packages/renderer/src/lib/agent-workspaces/AgentWorkspaceDetails.spec.ts"
  "packages/renderer/src/lib/agent-workspaces/AgentWorkspaceDetailsOverview.spec.ts"
  "packages/renderer/src/lib/agent-workspaces/AgentWorkspaceDetailsSettings.spec.ts"
)

for f in "${files[@]}"; do
  echo "=== $f ==="
  if [ ! -f "$f" ]; then
    echo "MISSING"
    continue
  fi
  # show imports + beforeEach area (small file sections)
  rg -n "beforeEach\\(" "$f" -S || true
  rg -n "vi\\.useFakeTimers" "$f" -S || true
  echo "--- snippet around beforeEach (if present) ---"
  # print a small window around first beforeEach
  line=$(rg -n "beforeEach\\(" "$f" -S --max-count 1 | cut -d: -f1 || true)
  if [ -n "${line:-}" ]; then
    start=$((line-5))
    end=$((line+10))
    sed -n "${start},${end}p" "$f" | nl -ba -w2 -s':'
  else
    echo "No beforeEach() found."
  fi
  echo
done

Repository: openkaiden/kaiden

Length of output: 285


🏁 Script executed:

#!/bin/bash
set -euo pipefail

files=(
  "packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreateStepWorkspace.spec.ts"
  "packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreateStepAgentModel.spec.ts"
  "packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreate.spec.ts"
  "packages/renderer/src/lib/agent-workspaces/AgentWorkspaceDetails.spec.ts"
  "packages/renderer/src/lib/agent-workspaces/AgentWorkspaceDetailsOverview.spec.ts"
  "packages/renderer/src/lib/agent-workspaces/AgentWorkspaceDetailsSettings.spec.ts"
)

for f in "${files[@]}"; do
  echo "=== $f ==="
  if [ ! -f "$f" ]; then
    echo "MISSING"
    continue
  fi

  echo "--- vi.useFakeTimers usage ---"
  rg -n "vi\.useFakeTimers" "$f" -S || true

  echo "--- beforeEach blocks (small snippets) ---"
  rg -n "beforeEach\\(\\(\\)\\s*=>\\s*\\{" "$f" -S --max-count 20 || true

  line=$(rg -n "beforeEach\\(\\(\\)\\s*=>\\s*\\{" "$f" -S --max-count 1 | cut -d: -f1 || true)
  if [ -n "${line:-}" ]; then
    start=$((line-8))
    end=$((line+12))
    if [ "$start" -lt 1 ]; then start=1; fi
    sed -n "${start},${end}p" "$f" | cat -n -w2 -s':'
  else
    # fallback: just show any beforeEach occurrences
    rg -n "beforeEach\\(" "$f" -S --max-count 10 || true
  fi

  echo
done

Repository: openkaiden/kaiden

Length of output: 334


🏁 Script executed:

#!/bin/bash
set -euo pipefail

files=(
  "packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreateStepWorkspace.spec.ts"
  "packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreateStepAgentModel.spec.ts"
  "packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreate.spec.ts"
  "packages/renderer/src/lib/agent-workspaces/AgentWorkspaceDetails.spec.ts"
  "packages/renderer/src/lib/agent-workspaces/AgentWorkspaceDetailsOverview.spec.ts"
  "packages/renderer/src/lib/agent-workspaces/AgentWorkspaceDetailsSettings.spec.ts"
)

for f in "${files[@]}"; do
  echo "=== $f ==="
  if [ ! -f "$f" ]; then
    echo "MISSING"
    continue
  fi

  echo "--- vi.useFakeTimers ---"
  rg -n "vi\.useFakeTimers" "$f" -S || true

  echo "--- beforeEach blocks (showing first match) ---"
  line=$(rg -n "beforeEach\\(\\(\\)\\s*=>\\s*\\{" "$f" -S --max-count 1 | cut -d: -f1 || true)
  if [ -n "${line:-}" ]; then
    start=$((line-3))
    end=$((line+10))
    if [ "$start" -lt 1 ]; then start=1; fi
    sed -n "${start},${end}p" "$f"
  else
    echo "No matching beforeEach(() => { ... } ) found"
    # fallback: show any beforeEach(
    rg -n "beforeEach\\(" "$f" -S --max-count 5 || true
  fi
  echo
done

Repository: openkaiden/kaiden

Length of output: 4531


Add vi.useFakeTimers({ shouldAdvanceTime: true }) to beforeEach in this renderer spec.

This spec uses render from @testing-library/svelte but only calls vi.resetAllMocks() in beforeEach, while nearby renderer workspace specs enable fake timers for Svelte scheduling.

Suggested change
 beforeEach(() => {
   vi.resetAllMocks();
+  vi.useFakeTimers({ shouldAdvanceTime: true });
 });
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
beforeEach(() => {
vi.resetAllMocks();
});
beforeEach(() => {
vi.resetAllMocks();
vi.useFakeTimers({ shouldAdvanceTime: true });
});
🤖 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/agent-workspaces/AgentWorkspaceCreateStepProject.spec.ts`
around lines 53 - 55, The test setup only calls vi.resetAllMocks() in the
beforeEach; add vi.useFakeTimers({ shouldAdvanceTime: true }) inside the same
beforeEach so Svelte's scheduling behaves like other renderer workspace
specs—update the beforeEach block (where vi.resetAllMocks() is called) to call
vi.useFakeTimers({ shouldAdvanceTime: true }) as well (and optionally mirror
with vi.useRealTimers() in an afterEach if tests restore timers elsewhere).

Source: Learnings

@jeffmaury jeffmaury self-requested a review June 17, 2026 16:06

@jeffmaury jeffmaury 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.

This is not aligned with mockups where the choice of project is integrated into the workspace step and not an separate step

@gastoner gastoner force-pushed the workspace_creation_form_project branch from 08c32b8 to 42ce3a8 Compare June 22, 2026 06:52
@gastoner gastoner requested a review from jeffmaury June 22, 2026 06:54
Introduces a project selection step that pre-fills workspace settings
(source path, name, skills, MCP servers, secrets, filesystem, network)
from a project definition, or allows starting from scratch.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Evzen Gasta <evzen.ml@seznam.cz>
@gastoner gastoner force-pushed the workspace_creation_form_project branch from 42ce3a8 to 090f351 Compare June 22, 2026 10:34

@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/agent-workspaces/AgentWorkspaceCreate.svelte`:
- Line 81: The REGISTRY_PRESET constant defines registry hosts at the top level,
but the same list appears to be duplicated inside the clearProject() function
around line 131. To avoid drift between these two definitions, replace the
hardcoded registry hosts list in the clearProject() function with a reference to
the REGISTRY_PRESET constant instead. This ensures a single source of truth for
the registry hosts that both the initialization and reset logic use.

In
`@packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreateStepWorkspace.svelte`:
- Line 199: The label text "None — keep what I entered above" on line 199 in
AgentWorkspaceCreateStepWorkspace.svelte is misleading because selecting this
option actually triggers a full draft reset in the parent handler rather than
preserving the entered values. Update the span element's text content to
accurately reflect reset or start-from-scratch semantics to match the actual
behavior when this option is selected.
🪄 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: 1d8cbb9f-2448-4a71-b864-4b2e6711f141

📥 Commits

Reviewing files that changed from the base of the PR and between 08c32b8 and 090f351.

📒 Files selected for processing (5)
  • packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreate.spec.ts
  • packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreate.svelte
  • packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreateStepWorkspace.spec.ts
  • packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreateStepWorkspace.svelte
  • packages/renderer/src/stores/agent-workspace-create-draft.svelte.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (10)
  • GitHub Check: smoke-e2e-tests (dev) / ubuntu-24.04 (ollama)
  • GitHub Check: linter, formatters
  • GitHub Check: smoke-e2e-tests (prod) / ubuntu-24.04 (ollama)
  • GitHub Check: unit tests / windows-2022
  • GitHub Check: typecheck
  • GitHub Check: unit tests / macos-15
  • GitHub Check: unit tests / ubuntu-24.04
  • GitHub Check: Windows
  • GitHub Check: Linux
  • GitHub Check: macOS
🧰 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/renderer/src/lib/agent-workspaces/AgentWorkspaceCreateStepWorkspace.spec.ts
  • packages/renderer/src/stores/agent-workspace-create-draft.svelte.ts
  • packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreate.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/agent-workspaces/AgentWorkspaceCreateStepWorkspace.spec.ts
  • packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreate.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/agent-workspaces/AgentWorkspaceCreateStepWorkspace.spec.ts
  • packages/renderer/src/stores/agent-workspace-create-draft.svelte.ts
  • packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreate.spec.ts
🧠 Learnings (9)
📚 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/agent-workspaces/AgentWorkspaceCreateStepWorkspace.spec.ts
  • packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreate.spec.ts
📚 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/agent-workspaces/AgentWorkspaceCreateStepWorkspace.spec.ts
  • packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreateStepWorkspace.svelte
  • packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreate.svelte
  • packages/renderer/src/stores/agent-workspace-create-draft.svelte.ts
  • packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreate.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/agent-workspaces/AgentWorkspaceCreateStepWorkspace.spec.ts
  • packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreate.spec.ts
📚 Learning: 2026-03-17T11:49:39.964Z
Learnt from: MarsKubeX
Repo: kortex-hub/kortex PR: 1111
File: packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCard.svelte:46-52
Timestamp: 2026-03-17T11:49:39.964Z
Learning: In Svelte components like AgentWorkspaceCard.svelte and CustomPick.svelte, using a div with role="button" and tabindex="0" as the clickable card container with an inner native <button> (e.g., for a remove action) is acceptable because nested <button> elements are invalid per HTML spec. Ensure the inner button's events do not bubble by calling stopPropagation on both click and keydown handlers. Do not flag this pattern as an accessibility issue when implemented this way, but verify that keyboard activation (Enter/Space) and ARIA semantics are preserved and that focus management remains clear.

Applied to files:

  • packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreateStepWorkspace.svelte
  • packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreate.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/agent-workspaces/AgentWorkspaceCreateStepWorkspace.svelte
  • packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreate.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/agent-workspaces/AgentWorkspaceCreateStepWorkspace.svelte
  • packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreate.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/agent-workspaces/AgentWorkspaceCreateStepWorkspace.svelte
  • packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreate.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/agent-workspaces/AgentWorkspaceCreateStepWorkspace.svelte
  • packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreate.svelte
📚 Learning: 2026-04-17T20:27:03.231Z
Learnt from: bmahabirbu
Repo: openkaiden/kaiden PR: 1379
File: packages/renderer/src/stores/model-catalog.ts:5-21
Timestamp: 2026-04-17T20:27:03.231Z
Learning: In openkaiden/kaiden’s Electron renderer (single window, no shared localStorage origin across tabs/windows), do not suggest using `window.addEventListener('storage', ...)` for localStorage cross-tab synchronization. For store code like `packages/renderer/src/stores/model-catalog.ts`, treat `storage` events as not applicable for syncing state; use other intra-window state/update mechanisms instead.

Applied to files:

  • packages/renderer/src/stores/agent-workspace-create-draft.svelte.ts
🔇 Additional comments (5)
packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreate.spec.ts (1)

24-24: LGTM!

Also applies to: 36-44, 58-58, 137-140, 883-883, 1184-1184, 1235-1235, 1678-2030

packages/renderer/src/stores/agent-workspace-create-draft.svelte.ts (1)

32-32: LGTM!

Also applies to: 46-46, 57-57, 74-74

packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreateStepWorkspace.svelte (1)

2-51: LGTM!

Also applies to: 163-198, 200-237

packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreateStepWorkspace.spec.ts (1)

32-32: LGTM!

packages/renderer/src/lib/agent-workspaces/AgentWorkspaceCreate.svelte (1)

22-32: LGTM!

Also applies to: 62-130, 132-141, 405-405, 470-470, 518-525

}
}

const REGISTRY_PRESET = ['registry.npmjs.org', 'pypi.python.org'];

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.

🧹 Nitpick | 🔵 Trivial | ⚡ Quick win

Use REGISTRY_PRESET inside clearProject() to avoid drift.

The registry hosts are defined twice. If one list changes, project mapping and reset defaults can diverge.

Suggested refactor
-  wizard.draft.hostsByMode = { registries: ['registry.npmjs.org', 'pypi.python.org'], blocked: [''] };
+  wizard.draft.hostsByMode = { registries: [...REGISTRY_PRESET], blocked: [''] };

Also applies to: 131-131

🤖 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/agent-workspaces/AgentWorkspaceCreate.svelte` at
line 81, The REGISTRY_PRESET constant defines registry hosts at the top level,
but the same list appears to be duplicated inside the clearProject() function
around line 131. To avoid drift between these two definitions, replace the
hardcoded registry hosts list in the clearProject() function with a reference to
the REGISTRY_PRESET constant instead. This ensures a single source of truth for
the registry hosts that both the initialization and reset logic use.

<span class="w-2 h-2 rounded-full bg-[var(--pd-link)]"></span>
{/if}
</span>
<span>None — keep what I entered above</span>

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.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Align “None” label with actual reset behavior.

Line 199 says “keep what I entered above”, but selecting this option triggers a full draft reset in the parent handler. Please update the copy to reflect reset/start-from-scratch semantics.

Suggested copy fix
-              <span>None — keep what I entered above</span>
+              <span>None — reset to defaults (start from scratch)</span>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<span>None — keep what I entered above</span>
<span>None — reset to defaults (start from scratch)</span>
🤖 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/agent-workspaces/AgentWorkspaceCreateStepWorkspace.svelte`
at line 199, The label text "None — keep what I entered above" on line 199 in
AgentWorkspaceCreateStepWorkspace.svelte is misleading because selecting this
option actually triggers a full draft reset in the parent handler rather than
preserving the entered values. Update the span element's text content to
accurately reflect reset or start-from-scratch semantics to match the actual
behavior when this option is selected.

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.

Integrate project in the create workspace wizard

2 participants