Skip to content

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

TypeScript

fix(mcp-host): keep the legacy flat Codex catalog without a connections map

Alfredo Lopeza82b6c59f8c5
diff --git a/mcp-host/package-lock.json b/mcp-host/package-lock.json
index ec66e3011..2e6a745ba 100644
--- a/mcp-host/package-lock.json
+++ b/mcp-host/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-mcp-host",
- "version": "0.1.287",
+ "version": "0.1.288",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-mcp-host",
- "version": "0.1.287",
+ "version": "0.1.288",
"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 3c82643f8..23fe2b6f4 100644
--- a/mcp-host/package.json
+++ b/mcp-host/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-mcp-host",
- "version": "0.1.287",
+ "version": "0.1.288",
"description": "MCP Host - reads Host CRD and provides LLM access via OpenAI/Claude",
"main": "dist/main.js",
"engines": {
diff --git a/mcp-host/src/config/configStore.test.ts b/mcp-host/src/config/configStore.test.ts
index 97776597d..459f3749d 100644
--- a/mcp-host/src/config/configStore.test.ts
+++ b/mcp-host/src/config/configStore.test.ts
@@ -889,4 +889,63 @@ describe('ConfigStore — allowlist tier (R3)', () => {
expect(store.codexPolicyBinding()).toBeNull()
expect(store.allowedModels().get('codex-subscription')).toEqual([])
})
+
+ it('keeps the legacy flat Codex catalog when the ConfigMap has no connections map', async () => {
+ const built = build({
+ provider: 'codex-subscription',
+ connectionRef: 'deployment-default',
+ secrets: { 'chatllm-api-keys': { 'openai-api-key': 'sk' } },
+ allowlistConfigMapName: ALLOWLIST_CM,
+ configMaps: {
+ [ALLOWLIST_CM]: {
+ 'codex-subscription': JSON.stringify([{ model: 'gpt-5.3-codex' }, { model: 'gpt-5.1' }]),
+ },
+ },
+ configMapAnnotations: {
+ [ALLOWLIST_CM]: {
+ 'clerum.io/catalog-revision': '4',
+ 'clerum.io/connection-revision': '2',
+ },
+ },
+ })
+ store = built.store
+ await store.start()
+ expect(store.codexPolicyBinding()?.connectionKey).toBe('deployment-default')
+ expect(store.codexPolicyBinding()?.models).toBeUndefined()
+ expect(store.allowedModels().get('codex-subscription')).toEqual([
+ { model: 'gpt-5.3-codex' },
+ { model: 'gpt-5.1' },
+ ])
+ })
+
+ it('does not inherit the reserved-grant union when a map entry omits models[]', async () => {
+ const built = build({
+ provider: 'codex-subscription',
+ connectionRef: 'personal-pro',
+ secrets: { 'chatllm-api-keys': { 'openai-api-key': 'sk' } },
+ allowlistConfigMapName: ALLOWLIST_CM,
+ configMaps: {
+ [ALLOWLIST_CM]: {
+ 'codex-subscription': JSON.stringify([{ model: 'gpt-5.3-codex' }, { model: 'gpt-5.1' }]),
+ },
+ },
+ configMapAnnotations: {
+ [ALLOWLIST_CM]: {
+ 'clerum.io/catalog-revision': '4',
+ 'clerum.io/connection-revision': '2',
+ 'clerum.io/codex-connections': JSON.stringify({
+ 'personal-pro': {
+ catalogRevision: 4,
+ connectionRevision: 2,
+ },
+ }),
+ },
+ },
+ })
+ store = built.store
+ await store.start()
+ expect(store.codexPolicyBinding()?.connectionKey).toBe('personal-pro')
+ expect(store.codexPolicyBinding()?.models).toEqual([])
+ expect(store.allowedModels().get('codex-subscription')).toEqual([])
+ })
})
diff --git a/mcp-host/src/config/configStore.ts b/mcp-host/src/config/configStore.ts
index 8bda36df3..3d1d3cc02 100644
--- a/mcp-host/src/config/configStore.ts
+++ b/mcp-host/src/config/configStore.ts
@@ -631,12 +631,15 @@ export class ConfigStore {
entries.push(entry)
}
if (provider === 'codex-subscription') {
- if (Array.isArray(binding?.models)) {
+ if (!binding) {
+ entries = []
+ } else if (Array.isArray(binding.models)) {
const allowed = new Set(binding.models)
entries = entries.filter(entry => allowed.has(entry.model))
- } else {
- entries = []
}
+ // Legacy ConfigMap with no connections map returns a binding without
+ // models[]. Keep the flat catalog. A map entry that omits models[]
+ // is parsed as [] and fail-closes here.
}
next.set(provider, entries)
}
@@ -961,7 +964,7 @@ function parseCodexPolicyBinding(
catalogRevision,
credentialRevision,
connectionKey,
- models: Array.isArray(assigned.models) ? assigned.models.filter(Boolean) : undefined,
+ models: Array.isArray(assigned.models) ? assigned.models.filter(Boolean) : [],
}
}
return null