Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
test(mcp-host): an upstream rejection gets its own code and label (#720)
Alfredo Lopez7eca23f336a7
diff --git a/desktop-app/ui/src/components/agents/__tests__/ChatThread.renderSemantics.test.tsx b/desktop-app/ui/src/components/agents/__tests__/ChatThread.renderSemantics.test.tsxindex 2c2a2ad37..838dd7971 100644--- a/desktop-app/ui/src/components/agents/__tests__/ChatThread.renderSemantics.test.tsx+++ b/desktop-app/ui/src/components/agents/__tests__/ChatThread.renderSemantics.test.tsx@@ -163,6 +163,14 @@ describe('ChatThread error code labels', () => {expect(text).not.toContain('Connection Error')})+ // Review round 2 L12 (#720): an upstream 4xx is a refusal, not a network+ // failure, so it no longer shares "Connection Error" with LLM_API_CALL_FAILED.+ it('labels an upstream rejection as "Provider Rejected Request"', () => {+ const { label, text } = renderErrorLabel('LLM_UPSTREAM_REJECTED', 'grok-subscription')+ expect(label).toBe('Provider Rejected Request · GROK-SUBSCRIPTION')+ expect(text).not.toContain('Connection Error')+ })+it('keeps the generic "Error" label for an unknown code', () => {expect(renderErrorLabel('LLM_SOMETHING_UNMAPPED').label).toBe('Error')})diff --git a/mcp-host/package-lock.json b/mcp-host/package-lock.jsonindex 11242bec3..bb1332278 100644--- a/mcp-host/package-lock.json+++ b/mcp-host/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-mcp-host",- "version": "0.1.459",+ "version": "0.1.460","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-mcp-host",- "version": "0.1.459",+ "version": "0.1.460","license": "SEE LICENSE IN LICENSE","dependencies": {"@anthropic-ai/sdk": "^0.32.0",diff --git a/mcp-host/package.json b/mcp-host/package.jsonindex 87d359b16..76f91a4e6 100644--- a/mcp-host/package.json+++ b/mcp-host/package.json@@ -1,6 +1,6 @@{"name": "clerum-mcp-host",- "version": "0.1.459",+ "version": "0.1.460","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/__tests__/errors.test.ts b/mcp-host/src/core/__tests__/errors.test.tsindex 0de192326..0e7ef94e8 100644--- a/mcp-host/src/core/__tests__/errors.test.ts+++ b/mcp-host/src/core/__tests__/errors.test.ts@@ -60,6 +60,8 @@ describe('LlmError', () => {expect(LlmErrorCode.ModelOverloaded).toBe('LLM_MODEL_OVERLOADED')// The Desktop label map keys on this literal (#720).expect(LlmErrorCode.ControlPlaneUnavailable).toBe('LLM_CONTROL_PLANE_UNAVAILABLE')+ // And on this one (#720 review round 2, L12).+ expect(LlmErrorCode.UpstreamRejected).toBe('LLM_UPSTREAM_REJECTED')})})diff --git a/mcp-host/src/llm/__tests__/codexLlmProxyClient.test.ts b/mcp-host/src/llm/__tests__/codexLlmProxyClient.test.tsindex 80c3e2b76..63f098767 100644--- a/mcp-host/src/llm/__tests__/codexLlmProxyClient.test.ts+++ b/mcp-host/src/llm/__tests__/codexLlmProxyClient.test.ts@@ -846,7 +846,9 @@ describe('CodexSubscriptionProvider G1 classification', () => {)const classified = provider.classifyError(err)expect(classified).toMatchObject({- code: LlmErrorCode.ApiCallFailed,+ // Review round 2 L12: its own code, not the "Connection Error" of+ // LLM_API_CALL_FAILED. The literal pins the value the Desktop keys on.+ code: 'LLM_UPSTREAM_REJECTED',retryable: false,providerCode: 'upstream_rejected',providerDispatched: true,diff --git a/mcp-host/src/llm/__tests__/grokLlmProxyClient.test.ts b/mcp-host/src/llm/__tests__/grokLlmProxyClient.test.tsindex 0b45ced14..366be8ff7 100644--- a/mcp-host/src/llm/__tests__/grokLlmProxyClient.test.ts+++ b/mcp-host/src/llm/__tests__/grokLlmProxyClient.test.ts@@ -746,7 +746,9 @@ describe('GrokSubscriptionProvider G1 classification', () => {)const classified = provider.classifyError(err)expect(classified).toMatchObject({- code: LlmErrorCode.ApiCallFailed,+ // Review round 2 L12: its own code, not the "Connection Error" of+ // LLM_API_CALL_FAILED. The literal pins the value the Desktop keys on.+ code: 'LLM_UPSTREAM_REJECTED',retryable: false,providerCode: 'upstream_rejected',providerDispatched: true,diff --git a/mcp-host/src/llm/failover/__tests__/classify.test.ts b/mcp-host/src/llm/failover/__tests__/classify.test.tsindex 52f248793..584661466 100644--- a/mcp-host/src/llm/failover/__tests__/classify.test.ts+++ b/mcp-host/src/llm/failover/__tests__/classify.test.ts@@ -20,6 +20,15 @@ describe('classifyFailoverClass', () => {expect(classifyFailoverClass(LlmErrorCode.ModelOverloaded, true)).toBe('provider_unavailable')})+ // Review round 2 L12 (#720): an upstream 4xx never fails over; the same+ // request would get the same answer from the fallback's upstream.+ it('G1-8f never fails over an upstream rejection, whatever its retryable flag', () => {+ expect(classifyFailoverClass(LlmErrorCode.UpstreamRejected, false)).toBeNull()+ expect(classifyFailoverClass(LlmErrorCode.UpstreamRejected, true)).toBeNull()+ // Witness: the same classifier still switches on an outage.+ expect(classifyFailoverClass(LlmErrorCode.ModelOverloaded, true)).toBe('provider_unavailable')+ })+it('ApiCallFailed is provider_unavailable ONLY when retryable', () => {expect(classifyFailoverClass(LlmErrorCode.ApiCallFailed, true)).toBe('provider_unavailable')// 400 / validation / content-policy — never eligible (would mask bugs).