Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
test(mcp-host): require live shell approval while the store is unavailable
Alfredo Lopez91a587bbeff8
diff --git a/mcp-host/package-lock.json b/mcp-host/package-lock.jsonindex ef2576e2b..99097ec6f 100644--- a/mcp-host/package-lock.json+++ b/mcp-host/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-mcp-host",- "version": "0.1.520",+ "version": "0.1.521","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-mcp-host",- "version": "0.1.520",+ "version": "0.1.521","license": "SEE LICENSE IN LICENSE","dependencies": {"@anthropic-ai/sdk": "^0.32.0",diff --git a/mcp-host/package.json b/mcp-host/package.jsonindex 1e2e352b5..bccf32be4 100644--- a/mcp-host/package.json+++ b/mcp-host/package.json@@ -1,6 +1,6 @@{"name": "clerum-mcp-host",- "version": "0.1.520",+ "version": "0.1.521","description": "MCP Host - reads Host CRD and provides LLM access via OpenAI/Claude","main": "dist/main.js","engines": {diff --git a/mcp-host/src/agent/__tests__/taskExecutor.gfsLiveApproval.integration.test.ts b/mcp-host/src/agent/__tests__/taskExecutor.gfsLiveApproval.integration.test.tsindex 6e8e97ced..7f0e2d399 100644--- a/mcp-host/src/agent/__tests__/taskExecutor.gfsLiveApproval.integration.test.ts+++ b/mcp-host/src/agent/__tests__/taskExecutor.gfsLiveApproval.integration.test.ts@@ -73,16 +73,20 @@ function riskyFollowUp(name: 'http_request' | 'cron_manage'): ToolCall {return { id: `${name}-follow-up`, name, arguments: { action: 'list' } }}+type StoreState = 'available' | 'closed' | 'uninitialized'+async function scenario(calls: ToolCall[],guardrailAsk = false,- conversationManager = new ConversationManager()+ conversationManager = new ConversationManager(),+ storeState: StoreState = 'available') {const root = await mkdtemp(join(tmpdir(), 'gfs-live-approval-'))roots.push(root)const store = new GfsDownloadStore(root)stores.push(store)- await store.initialize()+ if (storeState !== 'uninitialized') await store.initialize()+ if (storeState === 'closed') await store.close()const task: Task = {id: randomUUID(),source: 'channel',@@ -186,6 +190,7 @@ async function scenario(return {task,deps,+ store,sessionKey,conversation,executor: new TaskExecutor(task, deps),@@ -215,6 +220,38 @@ it('requires live shell approval despite persistent shell auto-approval', asyncexpect(spawn).not.toHaveBeenCalled()})+// X6 covers an unavailable store with source 'cron', where the forced live+// approval set never applies. These cases pin the channel path: delivery is+// withdrawn, yet persistent shell auto-approval still does not run a command.+it.each([+ ['store closed', 'closed'] as const,+ ['store never initialized', 'uninitialized'] as const,+])(+ 'requires live shell approval while the GFS download store is unavailable: %s',+ async (_label, storeState) => {+ const call = shellCall('unavailable-store-shell-call', firstCommand)+ const s = await scenario([call], false, new ConversationManager(), storeState)+ // Witness: the store wired into the executor reports itself unavailable.+ expect(s.store.isAvailable()).toBe(false)+ const isAvailable = vi.spyOn(s.store, 'isAvailable')++ await s.executor.run()++ // Witness: the executor consulted the unavailable store for this task.+ expect(isAvailable.mock.calls.length).toBeGreaterThan(0)+ expect(s.onFail).not.toHaveBeenCalled()+ expect(s.executor.executorState).toBe('waiting_approval')+ expect(s.executor.pendingApproval).toMatchObject({+ tool_name: 'shell_exec',+ tool_call_id: call.id,+ parameters: call.arguments,+ })+ expect(s.onApprovalNeeded).toHaveBeenCalledTimes(1)+ expect(s.providerCalls).toHaveLength(1)+ expect(spawn).not.toHaveBeenCalled()+ }+)+it.each(['http_request', 'cron_manage'] as const)('does not turn an exact GFS shell approval into turn-wide consent for %s',async toolName => {diff --git a/scripts/ci/pinned-vitest-cases/mcp-host.json b/scripts/ci/pinned-vitest-cases/mcp-host.jsonindex 63d40104c..396236224 100644--- a/scripts/ci/pinned-vitest-cases/mcp-host.json+++ b/scripts/ci/pinned-vitest-cases/mcp-host.json@@ -206,5 +206,13 @@{"suite": "gfsStoreWriterFence.test.ts","fullName": "GFS writer fence across a persistent-disk reattach (#1028) T9: assertInitialized and assertWriterOwnership propagate ownership_lost"+ },+ {+ "suite": "taskExecutor.gfsLiveApproval.integration.test.ts",+ "fullName": "requires live shell approval while the GFS download store is unavailable: store closed"+ },+ {+ "suite": "taskExecutor.gfsLiveApproval.integration.test.ts",+ "fullName": "requires live shell approval while the GFS download store is unavailable: store never initialized"}]