Skip to content

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

TypeScript

fix(control-api): log context_id_mismatch at debug (BR-10)

Diego Zacarias747eb12f7286
diff --git a/control-api/package-lock.json b/control-api/package-lock.json
index 626cecc58..23e5fb7dd 100644
--- a/control-api/package-lock.json
+++ b/control-api/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-api",
- "version": "0.1.820",
+ "version": "0.1.821",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-api",
- "version": "0.1.820",
+ "version": "0.1.821",
"dependencies": {
"@clerum/display-field": "file:../packages/display-field",
"@clerum/grok-provider-attempt-contract": "file:../packages/grok-provider-attempt-contract",
diff --git a/control-api/package.json b/control-api/package.json
index 3e2fe36e4..b94de8ff3 100644
--- a/control-api/package.json
+++ b/control-api/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-api",
- "version": "0.1.820",
+ "version": "0.1.821",
"description": "Internal Clerum control plane REST API + UI for managing CRDs and secrets",
"main": "dist/main.js",
"engines": {
diff --git a/control-api/src/routes/mcpOauth.ts b/control-api/src/routes/mcpOauth.ts
index b34e7d517..504141484 100644
--- a/control-api/src/routes/mcpOauth.ts
+++ b/control-api/src/routes/mcpOauth.ts
@@ -618,8 +618,10 @@ export function createMcpOauthRouter(gateway: K8sGateway): Router {
err: binding.cause,
})
}
+ // Debug, not warn: the broker never keys on spec.contextId, and this
+ // fires on every mint for every Host of the Context.
if (hasContextIdMismatch(binding.ctx)) {
- log.warn(
+ log.debug(
{ event: 'context_id_mismatch', host: hostName, context: binding.ctx.metadata?.name },
'context spec.contextId differs from its name'
)
diff --git a/control-api/test/routes.mcpOauth.test.ts b/control-api/test/routes.mcpOauth.test.ts
index 2b8c9e177..6eaade78e 100644
--- a/control-api/test/routes.mcpOauth.test.ts
+++ b/control-api/test/routes.mcpOauth.test.ts
@@ -432,7 +432,7 @@ describe('routes/mcp-oauth — POST /mcp-oauth/user-token (U1)', () => {
expect(res.text).toBe('{"error":"host_state_unavailable"}')
})
- it('R3b: spec.contextId differing from the Context name is served and only logged', async () => {
+ it('R3b: spec.contextId differing from the Context name is served and only logged at debug', async () => {
seedOauthServer(gateway, { name: 'gdrive', grantScope: 'user' })
grantRows = [nonExpiredUserGrantRow(USER_1, new Date(Date.now() + 3600_000))]
await seedAgentHost(gateway, 'renamed-host', 'ctx-renamed')
@@ -459,10 +459,14 @@ describe('routes/mcp-oauth — POST /mcp-oauth/user-token (U1)', () => {
try {
const res = await post({ mcpServerName: 'gdrive', userId: USER_1 }, renamed)
expect(res.status).toBe(200)
- expect(logs.warn).toHaveBeenCalledWith(
+ expect(logs.debug).toHaveBeenCalledWith(
expect.objectContaining({ event: 'context_id_mismatch', host: 'renamed-host' }),
expect.any(String)
)
+ expect(logs.warn).not.toHaveBeenCalledWith(
+ expect.objectContaining({ event: 'context_id_mismatch' }),
+ expect.anything()
+ )
} finally {
logs.restore()
}