Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(mcp-host): avoid shell workflow recovery drift

Alfredo Lopez5a7185fc2007
diff --git a/desktop-app/test/e2e-playwright/pr849-controlled-parity.spec.ts b/desktop-app/test/e2e-playwright/pr849-controlled-parity.spec.ts
index 8ba1c720e..f8927887b 100644
--- a/desktop-app/test/e2e-playwright/pr849-controlled-parity.spec.ts
+++ b/desktop-app/test/e2e-playwright/pr849-controlled-parity.spec.ts
@@ -388,9 +388,9 @@ async function openSession(page: Page, title: string, hostName: string): Promise
await expect(page.getByRole('textbox', { name: 'Agent message composer' })).toBeVisible({
timeout: 30_000,
})
- await expect(page.getByRole('button', { name: /^Switch chat agent$/ })).toContainText(hostName, {
- timeout: 30_000,
- })
+ await expect(
+ page.getByRole('navigation', { name: 'Chat breadcrumb' }).getByText(hostName, { exact: true })
+ ).toBeVisible({ timeout: 30_000 })
}
async function assertEffectiveStatelessModel(page: Page): Promise<void> {
diff --git a/mcp-host/package-lock.json b/mcp-host/package-lock.json
index 5223dec4b..dc5c90bb7 100644
--- a/mcp-host/package-lock.json
+++ b/mcp-host/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-mcp-host",
- "version": "0.1.465",
+ "version": "0.1.466",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-mcp-host",
- "version": "0.1.465",
+ "version": "0.1.466",
"license": "SEE LICENSE IN LICENSE",
"dependencies": {
"@anthropic-ai/sdk": "^0.32.0",
diff --git a/mcp-host/package.json b/mcp-host/package.json
index 3ba364fb1..120460319 100644
--- a/mcp-host/package.json
+++ b/mcp-host/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-mcp-host",
- "version": "0.1.465",
+ "version": "0.1.466",
"description": "MCP Host - reads Host CRD and provides LLM access via OpenAI/Claude",
"main": "dist/main.js",
"engines": {
diff --git a/mcp-host/src/core/orchestration/toolUseLoopIntentRecovery.test.ts b/mcp-host/src/core/orchestration/toolUseLoopIntentRecovery.test.ts
new file mode 100644
index 000000000..47b7b6c2e
--- /dev/null
+++ b/mcp-host/src/core/orchestration/toolUseLoopIntentRecovery.test.ts
@@ -0,0 +1,31 @@
+import { describe, expect, it } from 'vitest'
+import { shouldRecoverWorkflowTriggerTextResponse } from './toolUseLoopIntentRecovery'
+
+describe('shouldRecoverWorkflowTriggerTextResponse', () => {
+ it('does not classify a native shell command marker as a workflow recipe', () => {
+ expect(
+ shouldRecoverWorkflowTriggerTextResponse(
+ "Run exactly this command: printf 'PR849-SHELL-20260926'",
+ 'The command completed.'
+ )
+ ).toBe(false)
+ })
+
+ it('recovers when a named workflow recipe request receives a text-only answer', () => {
+ expect(
+ shouldRecoverWorkflowTriggerTextResponse(
+ 'Run the quarterly-report workflow recipe',
+ 'I cannot find that report.'
+ )
+ ).toBe(true)
+ })
+
+ it('recovers an explicit workflow recipe request without a hyphenated name', () => {
+ expect(
+ shouldRecoverWorkflowTriggerTextResponse(
+ 'Run the workflow recipe onboarding',
+ 'I cannot complete that request.'
+ )
+ ).toBe(true)
+ })
+})
diff --git a/mcp-host/src/core/orchestration/toolUseLoopIntentRecovery.ts b/mcp-host/src/core/orchestration/toolUseLoopIntentRecovery.ts
index 8260ef273..00bca5031 100644
--- a/mcp-host/src/core/orchestration/toolUseLoopIntentRecovery.ts
+++ b/mcp-host/src/core/orchestration/toolUseLoopIntentRecovery.ts
@@ -91,7 +91,9 @@ export function shouldRecoverWorkflowTriggerTextResponse(
const normalizedUser = userText.toLowerCase()
const asksToTrigger = /\b(run|start|trigger|execute|launch)\b/.test(normalizedUser)
const includesRecipeLikeName = /\b[a-z0-9]+(?:-[a-z0-9]+)+\b/.test(normalizedUser)
- const namesWorkflow = /\bworkflow\s+recipe\b/.test(normalizedUser) || includesRecipeLikeName
+ const namesWorkflow =
+ /\bworkflow\s+recipe\b/.test(normalizedUser) ||
+ (includesRecipeLikeName && /\b(?:workflow|recipe)\b/.test(normalizedUser))
if (!asksToTrigger || !namesWorkflow) return false
const normalizedResponse = responseText.toLowerCase()