From 69754b851e05095abfb48bf10940ccc007a214b7 Mon Sep 17 00:00:00 2001 From: Mark IJbema Date: Wed, 8 Apr 2026 13:29:53 +0200 Subject: [PATCH] fix(vscode): add allAgents to story mocks to fix storybook render errors The AgentBehaviourTab now uses session.allAgents() but the story mocks only provided agents(), causing 'Cannot read properties of undefined (reading length)' errors in storybook. --- .../kilo-vscode/webview-ui/src/stories/StoryProviders.tsx | 1 + .../kilo-vscode/webview-ui/src/stories/settings.stories.tsx | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/packages/kilo-vscode/webview-ui/src/stories/StoryProviders.tsx b/packages/kilo-vscode/webview-ui/src/stories/StoryProviders.tsx index 0df3bf82cdd..43eed3f123a 100644 --- a/packages/kilo-vscode/webview-ui/src/stories/StoryProviders.tsx +++ b/packages/kilo-vscode/webview-ui/src/stories/StoryProviders.tsx @@ -163,6 +163,7 @@ export function mockSessionValue(overrides?: { costBreakdown: () => [], contextUsage: () => undefined, agents: () => [{ name: "code", description: "Code mode", mode: "primary" as const }], + allAgents: () => [{ name: "code", description: "Code mode", mode: "primary" as const }], skills: () => [], refreshSkills: noop, removeSkill: noop, diff --git a/packages/kilo-vscode/webview-ui/src/stories/settings.stories.tsx b/packages/kilo-vscode/webview-ui/src/stories/settings.stories.tsx index 5563a5dfed4..77db67c4e78 100644 --- a/packages/kilo-vscode/webview-ui/src/stories/settings.stories.tsx +++ b/packages/kilo-vscode/webview-ui/src/stories/settings.stories.tsx @@ -63,6 +63,7 @@ export const AgentBehaviourAgents: Story = { const session = { ...mockSessionValue({ id: "agents-story", status: "idle" }), agents: () => MOCK_AGENTS, + allAgents: () => MOCK_AGENTS, removeMode: noop, removeMcp: noop, skills: () => [], @@ -87,6 +88,7 @@ export const AgentBehaviourEditCustomMode: Story = { const session = { ...mockSessionValue({ id: "edit-mode-story", status: "idle" }), agents: () => MOCK_AGENTS, + allAgents: () => MOCK_AGENTS, removeMode: noop, removeMcp: noop, skills: () => [], @@ -179,6 +181,7 @@ export const AgentBehaviourWorkflows: Story = { const session = { ...mockSessionValue({ id: "workflows-story", status: "idle" }), agents: () => MOCK_AGENTS, + allAgents: () => MOCK_AGENTS, removeMode: noop, removeMcp: noop, skills: () => [], @@ -201,6 +204,7 @@ export const AgentBehaviourWorkflowsEmpty: Story = { const session = { ...mockSessionValue({ id: "workflows-empty-story", status: "idle" }), agents: () => MOCK_AGENTS, + allAgents: () => MOCK_AGENTS, removeMode: noop, removeMcp: noop, skills: () => [], @@ -298,6 +302,7 @@ export const ModeEditExport: Story = { const session = { ...mockSessionValue({ id: "export-story", status: "idle" }), agents: () => MOCK_AGENTS, + allAgents: () => MOCK_AGENTS, removeMode: noop, removeMcp: noop, skills: () => [],