Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(control-ui): resolve step agent from spec.steps, not non-existent spec.workflow.steps
Andy Paviaea8a3dfd9785
diff --git a/control-ui/app/registry/install/page.tsx b/control-ui/app/registry/install/page.tsxindex 958c70cc4..f2122d463 100644--- a/control-ui/app/registry/install/page.tsx+++ b/control-ui/app/registry/install/page.tsx@@ -153,7 +153,8 @@ function providerForModel(model: string): string {// A recipe whose plugin SDK enables promptBridge must resolve an agent// (spec.agent or a step agent with provider + model) or it fails after install.-function recipeAgentRequirement(parsed: Record<string, unknown> | null): {+// Exported for direct unit coverage of the agent-resolution rule.+export function recipeAgentRequirement(parsed: Record<string, unknown> | null): {needsAgent: booleanallowedModels: string[]} {@@ -167,8 +168,11 @@ function recipeAgentRequirement(parsed: Record<string, unknown> | null): {const agent = isPlainObject(spec.agent) ? spec.agent : nullconst hasSpecAgent =!!agent && typeof agent.provider === 'string' && typeof agent.model === 'string'- const steps =- isPlainObject(spec.workflow) && Array.isArray(spec.workflow.steps) ? spec.workflow.steps : []+ // Steps live at spec.steps in the CRD (charts/clerum-crds/crds/workflowrecipe.yaml),+ // NOT spec.workflow.steps (no such property). Mirror the canonical resolver in+ // workflow-recipes/src/workflow/agentResolution.ts (resolveMcpHostAgent) so this+ // wizard check can't drift from the reconciler and silently override a step agent.+ const steps = Array.isArray(spec.steps) ? spec.steps : []const hasStepAgent = steps.some(s =>isPlainObject(s) &&diff --git a/control-ui/components/__tests__/RegistryInstallPage.test.tsx b/control-ui/components/__tests__/RegistryInstallPage.test.tsxindex 2a26d792e..57a251294 100644--- a/control-ui/components/__tests__/RegistryInstallPage.test.tsx+++ b/control-ui/components/__tests__/RegistryInstallPage.test.tsx@@ -2,7 +2,7 @@ import React from 'react'import type { ReactNode } from 'react'import { afterEach, describe, expect, it, vi } from 'vitest'import { cleanup, fireEvent, render as rtlRender, screen, waitFor } from '@testing-library/react'-import RegistryInstallPage from '../../app/registry/install/page'+import RegistryInstallPage, { recipeAgentRequirement } from '../../app/registry/install/page'import { getRegistryEntryVersion, installRecipeFromRegistry } from '../../lib/api'import type { RegistryEntry } from '../../lib/api'import { ToastProvider } from '../Toast'@@ -223,3 +223,52 @@ describe('RegistryInstallPage — WorkflowRecipe preview egress editor', () => {expect(installRecipeFromRegistry).not.toHaveBeenCalled()})})++describe('recipeAgentRequirement — step agent resolution reads spec.steps', () => {+ const promptBridgeSpec = (extra: Record<string, unknown>) => ({+ spec: {+ pluginWorkloadSdk: {+ promptBridge: { allowedModels: ['gpt-4o-mini'], maxOutputTokens: 4096 },+ },+ ...extra,+ },+ })++ it('does not need an agent when a step agent is declared at spec.steps', () => {+ // Regression guard: the wizard previously read spec.workflow.steps (no such+ // CRD property), so a declared step agent was never seen — the wizard would+ // inject spec.agent and override the author's step agent.+ const parsed = promptBridgeSpec({+ steps: [{ id: 'research', agent: { provider: 'claude', model: 'claude-sonnet-4-6' } }],+ })+ expect(recipeAgentRequirement(parsed).needsAgent).toBe(false)+ })++ it('needs an agent when promptBridge is set but neither spec.agent nor a step agent exists', () => {+ const parsed = promptBridgeSpec({ steps: [{ id: 'research', run: { type: 'snippet' } }] })+ const result = recipeAgentRequirement(parsed)+ expect(result.needsAgent).toBe(true)+ expect(result.allowedModels).toEqual(['gpt-4o-mini'])+ })++ it('does not need an agent when spec.agent is present', () => {+ const parsed = promptBridgeSpec({ agent: { provider: 'openai', model: 'gpt-4o-mini' } })+ expect(recipeAgentRequirement(parsed).needsAgent).toBe(false)+ })++ it('ignores a step agent at the non-CRD spec.workflow.steps path', () => {+ // Guards against reverting to the wrong path: the reconciler resolves agents+ // from spec.steps, so an agent under spec.workflow.steps must NOT satisfy it.+ const parsed = promptBridgeSpec({+ workflow: {+ steps: [{ id: 'x', agent: { provider: 'claude', model: 'claude-sonnet-4-6' } }],+ },+ steps: [{ id: 'x', run: { type: 'snippet' } }],+ })+ expect(recipeAgentRequirement(parsed).needsAgent).toBe(true)+ })++ it('does not require an agent without promptBridge', () => {+ expect(recipeAgentRequirement({ spec: { steps: [] } }).needsAgent).toBe(false)+ })+})diff --git a/control-ui/package-lock.json b/control-ui/package-lock.jsonindex 0833bc7f7..548d3078d 100644--- a/control-ui/package-lock.json+++ b/control-ui/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-ui",- "version": "0.1.369",+ "version": "0.1.370","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-ui",- "version": "0.1.369",+ "version": "0.1.370","dependencies": {"@clerum/llm-providers": "file:../packages/llm-providers","@clerum/workflow-recipe-capability-policy": "file:../packages/workflow-recipe-capability-policy",diff --git a/control-ui/package.json b/control-ui/package.jsonindex 17f42bbd4..cf08c12b6 100644--- a/control-ui/package.json+++ b/control-ui/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-ui",- "version": "0.1.369",+ "version": "0.1.370","private": true,"scripts": {"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",