Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix: keep sdk-only CI hermetic for Codex prune and bootstrap types
Alfredo Lopezdd4e634eb7a5
diff --git a/control-api/package-lock.json b/control-api/package-lock.jsonindex a197eb1e2..aaedd9871 100644--- a/control-api/package-lock.json+++ b/control-api/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-api",- "version": "0.1.529",+ "version": "0.1.530","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-api",- "version": "0.1.529",+ "version": "0.1.530","dependencies": {"@clerum/display-field": "file:../packages/display-field","@clerum/image-policy": "file:../packages/image-policy",diff --git a/control-api/package.json b/control-api/package.jsonindex 95a230a9f..bddadf99e 100644--- a/control-api/package.json+++ b/control-api/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-api",- "version": "0.1.529",+ "version": "0.1.530","description": "Internal Clerum control plane REST API + UI for managing CRDs and secrets","main": "dist/main.js","engines": {diff --git a/control-api/src/services/pluginWorkloadSdkDb.ts b/control-api/src/services/pluginWorkloadSdkDb.tsindex 738e78bf0..be4f43d7b 100644--- a/control-api/src/services/pluginWorkloadSdkDb.ts+++ b/control-api/src/services/pluginWorkloadSdkDb.ts@@ -2234,32 +2234,33 @@ export async function listInvocations(* rows are pruned — an in_progress row past TTL is first failed by* failStaleInvocations.*/-export async function prunePluginWorkloadSdkExpiredIdempotency(): Promise<number> {- return withTransaction(async db => {- // Child receipts and one-shot JTIs have no useful life once the parent- // idempotency reservation expires. Delete them in one transaction so- // usage and ticket lookups cannot observe orphaned authority.- await db.query(- `DELETE FROM plugin_workload_sdk_credential_ticket_jtis jt+export async function prunePluginWorkloadSdkExpiredIdempotencyInTransaction(+ db: DbClient+): Promise<number> {+ // Child receipts and one-shot JTIs have no useful life once the parent+ // idempotency reservation expires. Delete them in one transaction so+ // usage and ticket lookups cannot observe orphaned authority.+ await db.query(+ `DELETE FROM plugin_workload_sdk_credential_ticket_jtis jtUSING plugin_workload_sdk_invocations invWHERE jt.invocation_id = inv.idAND inv.created_at < now() - interval '1 hour' * $1AND inv.status <> 'in_progress'`,- [IDEMPOTENCY_TTL_HOURS]- )- await db.query(- `DELETE FROM plugin_workload_sdk_invocation_attempts attempts+ [IDEMPOTENCY_TTL_HOURS]+ )+ await db.query(+ `DELETE FROM plugin_workload_sdk_invocation_attempts attemptsUSING plugin_workload_sdk_invocations invWHERE attempts.invocation_id = inv.idAND inv.created_at < now() - interval '1 hour' * $1AND inv.status <> 'in_progress'`,- [IDEMPOTENCY_TTL_HOURS]- )- // Unlink the durable Codex ledger before deleting SDK attempt rows.- // 0108 also SET NULLs the FK on delete; this UPDATE keeps prune from- // depending on that constraint name and never CASCADE-deletes spend.- await db.query(- `UPDATE llm_provider_attempts a+ [IDEMPOTENCY_TTL_HOURS]+ )+ // Unlink the durable Codex ledger before deleting SDK attempt rows.+ // 0108 also SET NULLs the FK on delete; this UPDATE keeps prune from+ // depending on that constraint name and never CASCADE-deletes spend.+ await db.query(+ `UPDATE llm_provider_attempts aSET plugin_workload_sdk_provider_attempt_id = NULLFROM plugin_workload_sdk_provider_attempts attemptsJOIN plugin_workload_sdk_invocations inv@@ -2267,24 +2268,27 @@ export async function prunePluginWorkloadSdkExpiredIdempotency(): Promise<numberWHERE a.plugin_workload_sdk_provider_attempt_id = attempts.idAND inv.created_at < now() - interval '1 hour' * $1AND inv.status <> 'in_progress'`,- [IDEMPOTENCY_TTL_HOURS]- )- await db.query(- `DELETE FROM plugin_workload_sdk_provider_attempts attempts+ [IDEMPOTENCY_TTL_HOURS]+ )+ await db.query(+ `DELETE FROM plugin_workload_sdk_provider_attempts attemptsUSING plugin_workload_sdk_invocations invWHERE attempts.invocation_id = inv.idAND inv.created_at < now() - interval '1 hour' * $1AND inv.status <> 'in_progress'`,- [IDEMPOTENCY_TTL_HOURS]- )- const result = await db.query(- `DELETE FROM plugin_workload_sdk_invocations+ [IDEMPOTENCY_TTL_HOURS]+ )+ const result = await db.query(+ `DELETE FROM plugin_workload_sdk_invocationsWHERE created_at < now() - interval '1 hour' * $1AND status <> 'in_progress'`,- [IDEMPOTENCY_TTL_HOURS]- )- return result.rowCount ?? 0- })+ [IDEMPOTENCY_TTL_HOURS]+ )+ return result.rowCount ?? 0+}++export async function prunePluginWorkloadSdkExpiredIdempotency(): Promise<number> {+ return withTransaction(prunePluginWorkloadSdkExpiredIdempotencyInTransaction)}// ─── Quota counters (historical-only, issue #348) ────────────────────────diff --git a/control-api/test/pluginWorkloadSdkCodexDualLedger.realPostgres.integration.test.ts b/control-api/test/pluginWorkloadSdkCodexDualLedger.realPostgres.integration.test.tsindex b3233c4b8..ba52bdb1c 100644--- a/control-api/test/pluginWorkloadSdkCodexDualLedger.realPostgres.integration.test.ts+++ b/control-api/test/pluginWorkloadSdkCodexDualLedger.realPostgres.integration.test.ts@@ -24,7 +24,7 @@ import {loadLlmProviderAttemptBySdkAttemptId,} from '../src/services/llmProviderAttemptStore.js'import { issueRegisteredCodexExecutionTicket } from '../src/services/llmProviderAttemptTicket.js'-import { prunePluginWorkloadSdkExpiredIdempotency } from '../src/services/pluginWorkloadSdkDb.js'+import { prunePluginWorkloadSdkExpiredIdempotencyInTransaction } from '../src/services/pluginWorkloadSdkDb.js'import { finalizePromptBridgeInTransaction } from '../src/services/pluginWorkloadSdkFinalization.js'import type { McpHostAccessClaims } from '../src/utils/auth/mcpHostJwtToken.js'import './realPostgres.requirement.ts'@@ -770,7 +770,7 @@ describeRealPostgres('Plugin Workload SDK Codex dual ledger on real PostgreSQL',AND kcu.column_name = 'plugin_workload_sdk_provider_attempt_id'`)expect(deleteRule.rows[0]?.delete_rule).toBe('SET NULL')- const pruned = await prunePluginWorkloadSdkExpiredIdempotency()+ const pruned = await prunePluginWorkloadSdkExpiredIdempotencyInTransaction(pool)expect(pruned).toBeGreaterThan(0)const leftoverSdk = await pool.query(`SELECT id FROM plugin_workload_sdk_provider_attempts WHERE id = $1`,diff --git a/mcp-host/package-lock.json b/mcp-host/package-lock.jsonindex 7a7fa2602..388765e66 100644--- a/mcp-host/package-lock.json+++ b/mcp-host/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-mcp-host",- "version": "0.1.307",+ "version": "0.1.308","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-mcp-host",- "version": "0.1.307",+ "version": "0.1.308","license": "SEE LICENSE IN LICENSE","dependencies": {"@anthropic-ai/sdk": "^0.32.0",diff --git a/mcp-host/package.json b/mcp-host/package.jsonindex ca5ac84c6..b2399685e 100644--- a/mcp-host/package.json+++ b/mcp-host/package.json@@ -1,6 +1,6 @@{"name": "clerum-mcp-host",- "version": "0.1.307",+ "version": "0.1.308","description": "MCP Host - reads Host CRD and provides LLM access via OpenAI/Claude","main": "dist/main.js","engines": {diff --git a/mcp-host/src/pluginWorkloadSdk/bootstrapIdentity.test.ts b/mcp-host/src/pluginWorkloadSdk/bootstrapIdentity.test.tsindex c0c451004..abce781b4 100644--- a/mcp-host/src/pluginWorkloadSdk/bootstrapIdentity.test.ts+++ b/mcp-host/src/pluginWorkloadSdk/bootstrapIdentity.test.ts@@ -338,7 +338,7 @@ describe('Plugin Workload SDK bootstrap identity', () => {provider: 'codex-subscription',model: 'gpt-5.6-luna',contractVersion: 3,- codexBinding: { ...binding, leaked: 'drop-me' },+ codexBinding: { ...binding, leaked: 'drop-me' } as typeof binding,},{ capabilityFamily: 'promptBridge', verify })