Skip to content

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

TypeScript

fix(mcp-host): map Codex proxy client refusals through the canonical code (R4-L6)

Alfredo Lopez43609f6d6647
diff --git a/mcp-host/package-lock.json b/mcp-host/package-lock.json
index 05c8310a0..61b455759 100644
--- a/mcp-host/package-lock.json
+++ b/mcp-host/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-mcp-host",
- "version": "0.1.484",
+ "version": "0.1.485",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-mcp-host",
- "version": "0.1.484",
+ "version": "0.1.485",
"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 ea930d873..b8971bd14 100644
--- a/mcp-host/package.json
+++ b/mcp-host/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-mcp-host",
- "version": "0.1.484",
+ "version": "0.1.485",
"description": "MCP Host - reads Host CRD and provides LLM access via OpenAI/Claude",
"main": "dist/main.js",
"engines": {
diff --git a/mcp-host/src/llm/codexLlmProxyClient.ts b/mcp-host/src/llm/codexLlmProxyClient.ts
index 94660686d..a4b34519d 100644
--- a/mcp-host/src/llm/codexLlmProxyClient.ts
+++ b/mcp-host/src/llm/codexLlmProxyClient.ts
@@ -3,6 +3,7 @@ import {
parseCodexCompletionRequest,
} from '@clerum/llm-provider-attempt-contract'
import { fetchCauseCode, isConnectPhaseFailure } from './controlPlaneReachability'
+import { canonicalRefusalCode } from './imageSource'
import { rateLimitedCode, retryAfterMs } from './retryAfter'
import { upstreamRejectedStatus } from './upstreamRejected'
@@ -107,7 +108,9 @@ export class CodexLlmProxyClient {
) {
const parsed = parseCodexCompletionRequest(input.request)
if (!parsed.ok) {
- throw new CodexProxyError('invalid_request', parsed.message, { dispatched: false })
+ throw new CodexProxyError(canonicalRefusalCode(parsed), parsed.message, {
+ dispatched: false,
+ })
}
if (input.deadlineMs !== undefined && input.deadlineMs !== parsed.value.deadlineMs) {
throw new CodexProxyError(
@@ -122,12 +125,12 @@ export class CodexLlmProxyClient {
request: parsed.value,
})
if (!envelope.ok) {
+ // The providers' canonical mapping (review R4-L6), so the client and
+ // the pre-dispatch checks agree; only the hash mismatch is its own code.
const code =
- envelope.code === 'limit'
- ? 'payload_too_large'
- : envelope.code === 'request_hash_mismatch'
- ? 'request_hash_mismatch'
- : 'invalid_request'
+ envelope.code === 'request_hash_mismatch'
+ ? 'request_hash_mismatch'
+ : canonicalRefusalCode(envelope)
throw new CodexProxyError(code, envelope.message, { dispatched: false })
}
body = envelope.value