Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: isolate incompatible recipe metadata (#7196)

[._.]/ Adam Eivy1e98061dcc3f
diff --git a/server/services/mindToolRecipeRuntime.js b/server/services/mindToolRecipeRuntime.js
index ab0aa4a8e7..8bdbd46955 100644
--- a/server/services/mindToolRecipeRuntime.js
+++ b/server/services/mindToolRecipeRuntime.js
@@ -38,13 +38,16 @@ export const recipeManagementTools = Object.entries(managementSchemas).map(([ope
));
const recipeAccessCapability = (scope) => scope === 'agent' ? 'callToolRecipes' : 'manageToolRecipes';
+const underlyingRecipeTools = (definition) => Array.isArray(definition?.steps)
+ ? [...new Set(definition.steps.flatMap((step) => typeof step?.tool === 'string' ? [step.tool] : []))]
+ : [];
const recipeMetadata = (recipe, definition, { scope, available = true, disabledReason } = {}) => ({
id: recipe.id,
source: 'persistent-mind-library',
revision: recipe.activeRevision,
scope,
available,
- underlyingTools: [...new Set((definition?.steps || []).map((step) => step.tool))],
+ underlyingTools: underlyingRecipeTools(definition),
...(disabledReason ? { disabledReason: String(disabledReason).slice(0, 500) } : {}),
});
@@ -73,9 +76,11 @@ export async function readRecipeToolsForScope(scope, primitives) {
if (!['agent', 'mind'].includes(scope)) return [];
const { listRecipes } = await import('./mindToolRecipes.js');
const { recipes } = await listRecipes({ limit: 20 });
- const checked = await Promise.all(recipes.map((recipe) => resolveRecipeInvocation(recipe, primitives, { scope })));
+ const checked = await Promise.allSettled(recipes.map((recipe) => resolveRecipeInvocation(recipe, primitives, { scope })));
let chars = 0;
- return checked.flatMap((tool) => {
+ return checked.flatMap((entry) => {
+ if (entry.status !== 'fulfilled') return [];
+ const tool = entry.value;
const size = JSON.stringify(tool.input_schema).length + tool.description.length;
if (chars + size > 24000) return [];
chars += size;
diff --git a/server/services/mindToolRecipeRuntime.test.js b/server/services/mindToolRecipeRuntime.test.js
index a5255834d1..8c68cfbe9a 100644
--- a/server/services/mindToolRecipeRuntime.test.js
+++ b/server/services/mindToolRecipeRuntime.test.js
@@ -131,6 +131,20 @@ it('marks a recipe using a Mind-only primitive unavailable to agents', async ()
recipe: { available: false, disabledReason: expect.stringMatching(/agent scope/) },
});
});
+it('keeps valid recipes discoverable beside an unsupported definition shape', async () => {
+ mock.recipes.push(
+ { id: 'future', name: 'recipe.future', activeRevision: 9, archived: false, definition: { schemaVersion: 99, steps: {} } },
+ { id: 'valid', name: 'recipe.project-check', activeRevision: 1, archived: false, definition: definition(1) },
+ );
+ const recipes = await readCosToolRecipeCatalog({ scope: 'agent' });
+ expect(recipes.map((tool) => tool.name)).toEqual(['recipe.future', 'recipe.project-check']);
+ expect(recipes[0]).toMatchObject({
+ recipe: { available: false, revision: 9, underlyingTools: [] },
+ });
+ expect(recipes[1]).toMatchObject({
+ recipe: { available: true, revision: 1, underlyingTools: ['brain.search'] },
+ });
+});
it('re-reads agent authority before every child and stops a recipe after revocation', async () => {
await save();
mock.dispatch.mockImplementationOnce(async () => {