diff --git a/src/init.mjs b/src/init.mjs index 32defc8..b0d8a79 100644 --- a/src/init.mjs +++ b/src/init.mjs @@ -1417,9 +1417,10 @@ export function deriveUserConfig( enabledRuntimes: additive ? [...new Set([...(derived.init?.enabledRuntimes ?? []), ...runtimeIds])] : runtimeIds, keepWarmRuntime: additive ? null : keepWarm, additive, - ...(recipesRoot ? { recipesRoot } : {}), - ...(benchmarksRoot ? { benchmarksRoot } : {}), - ...(backendCatalogPath ? { backendCatalogPath } : {}) + // This run's sources replace the previous init's: recipeId is only valid in its own root. + recipesRoot: recipesRoot || undefined, + benchmarksRoot: benchmarksRoot || undefined, + backendCatalogPath: backendCatalogPath || undefined }; return preserveEnvBackedSecrets(derived, sourceTemplate); } diff --git a/test/hear-recipe.test.mjs b/test/hear-recipe.test.mjs index 7eedc47..cefa6c7 100644 --- a/test/hear-recipe.test.mjs +++ b/test/hear-recipe.test.mjs @@ -59,4 +59,18 @@ assert.match(next.backends.hear.baseUrl, /^http:\/\/127\.0\.0\.1:\d+\/v1$/); assert.deepEqual(next.aliases.hear.members, ['hear']); assert.deepEqual(next.aliases.listen.members, ['hear']); +// An additive init from the default recipes must not inherit an earlier init's +// sources, or `lloom status` resolves the new recipeId in the old recipes root. +const staleSources = { + recipesRoot: '/stale/recipes', + benchmarksRoot: '/stale/benchmarks', + backendCatalogPath: '/stale/backends.json' +}; +const restacked = await createInitPlan( + { ...config, init: { recipeId: 'spark03-cuda-media', ...staleSources } }, + { recipeId: 'lloom-hear', additive: true, modelRoot: '/tmp/lloom-models' } +); +assert.equal(restacked.config.init.recipeId, 'lloom-hear'); +for (const key of Object.keys(staleSources)) assert.equal(restacked.config.init[key], undefined, key); + console.log('hear-recipe tests passed');