Skip to content

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

TypeScript

fix(mcp-host): accept trailing comma, semicolon and colon on direct recipe triggers

Alfredo Lopez07c16b0fb39c
diff --git a/mcp-host/package-lock.json b/mcp-host/package-lock.json
index c2fb5f9b4..7cacf157e 100644
--- a/mcp-host/package-lock.json
+++ b/mcp-host/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-mcp-host",
- "version": "0.1.474",
+ "version": "0.1.475",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-mcp-host",
- "version": "0.1.474",
+ "version": "0.1.475",
"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 46645f24d..7265be5e5 100644
--- a/mcp-host/package.json
+++ b/mcp-host/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-mcp-host",
- "version": "0.1.474",
+ "version": "0.1.475",
"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
index e5c9e162c..d3fab8ce9 100644
--- a/mcp-host/src/core/orchestration/toolUseLoopIntentRecovery.test.ts
+++ b/mcp-host/src/core/orchestration/toolUseLoopIntentRecovery.test.ts
@@ -54,6 +54,11 @@ describe('shouldRecoverWorkflowTriggerTextResponse', () => {
'trigger daily-report with region=eu',
'Run "daily-report" now.',
'execute daily-report using region=eu and dry-run=true',
+ 'run daily-report, please',
+ 'run daily-report,',
+ 'please run daily-report, now',
+ 'run daily-report;',
+ 'run daily-report: now',
])('recovers a direct named recipe request with a natural tail: %s', userText => {
expect(shouldRecoverWorkflowTriggerTextResponse(userText, 'I can help with that.')).toBe(true)
})
@@ -62,6 +67,9 @@ describe('shouldRecoverWorkflowTriggerTextResponse', () => {
'Run a shell command',
'run daily-report with',
'run daily-report and delete it',
+ // Paired control for the trailing-comma positives: a comma followed by a
+ // non-filler tail is still not a trigger.
+ 'run daily-report, and delete it',
'run daily-report now and then rm -rf /',
'Run quarterly-report and delete it',
`Run ${'a'.repeat(129)}-report`,
@@ -85,6 +93,10 @@ describe('shouldRecoverWorkflowTriggerTextResponse', () => {
const elapsedMs = performance.now() - started
// Liveness witness: a boolean means the classifier ran to completion.
expect(typeof result).toBe('boolean')
- expect(elapsedMs).toBeLessThan(100)
+ // The bound guards against pathological (super-linear) backtracking, not
+ // latency: linear classification of 200k characters takes a few ms, while
+ // quadratic backtracking takes seconds. 1000 ms leaves headroom for shared
+ // CI runners without hiding a regression.
+ expect(elapsedMs).toBeLessThan(1000)
})
})
diff --git a/mcp-host/src/core/orchestration/toolUseLoopIntentRecovery.ts b/mcp-host/src/core/orchestration/toolUseLoopIntentRecovery.ts
index deaa1dedc..128822290 100644
--- a/mcp-host/src/core/orchestration/toolUseLoopIntentRecovery.ts
+++ b/mcp-host/src/core/orchestration/toolUseLoopIntentRecovery.ts
@@ -83,7 +83,8 @@ export function shouldRecoverWorkflowArtifactTextResponse(userText: string): boo
}
// A direct trigger is `[can you] [please] <verb> [the] <one token>` followed only
-// by filler (`now`, `please`, `again`), sentence punctuation, or `with|using`
+// by filler (`now`, `please`, `again`, `immediately`), trailing punctuation
+// (`.`, `!`, `?`, `,`, `;`, `:`), or `with|using`
// arguments. The head regex is anchored and every quantifier is bounded or
// separated from its neighbours by a literal, so it stays linear on adversarial
// input; the tail is checked with string operations instead of a second regex.
@@ -94,7 +95,7 @@ const RECIPE_NAME = /^[a-z0-9]+(?:-[a-z0-9]+)+$/i
function stripTrailingSentencePunctuation(value: string): string {
let end = value.length
- while (end > 0 && '.!?'.includes(value[end - 1])) end--
+ while (end > 0 && '.!?,;:'.includes(value[end - 1])) end--
return value.slice(0, end)
}