Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
chore(plugin-sdk): lower platform per-minute defaults to 150/120 (#348)
Alfredo Lopezad991b957b31
diff --git a/control-api/package-lock.json b/control-api/package-lock.jsonindex e874f5db2..dc1df7cd9 100644--- a/control-api/package-lock.json+++ b/control-api/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-api",- "version": "0.1.442",+ "version": "0.1.443","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-api",- "version": "0.1.442",+ "version": "0.1.443","dependencies": {"@clerum/image-policy": "file:../packages/image-policy","@clerum/llm-providers": "file:../packages/llm-providers",diff --git a/control-api/package.json b/control-api/package.jsonindex 6492eff89..df2fba24e 100644--- a/control-api/package.json+++ b/control-api/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-api",- "version": "0.1.442",+ "version": "0.1.443","description": "Internal Clerum control plane REST API + UI for managing CRDs and secrets","main": "dist/main.js","engines": {diff --git a/control-api/src/config.ts b/control-api/src/config.tsindex 5e6e7aeac..a4dc68db2 100644--- a/control-api/src/config.ts+++ b/control-api/src/config.ts@@ -729,11 +729,11 @@ export const config: Config = {// would effectively fail open.pluginSdkNotificationsRlPerMin: positiveIntegerFromEnv('CONTROL_API_PLUGIN_SDK_NOTIFICATIONS_PER_MIN',- 200+ 150),pluginSdkPromptBridgeRlPerMin: positiveIntegerFromEnv('CONTROL_API_PLUGIN_SDK_PROMPTBRIDGE_PER_MIN',- 180+ 120),pluginSdkRequestBucketRlPerMin: positiveIntegerFromEnv('CONTROL_API_PLUGIN_SDK_REQUEST_BUCKET_PER_MIN',diff --git a/control-api/test/config.pluginSdkRateLimits.test.ts b/control-api/test/config.pluginSdkRateLimits.test.tsindex 87257e0c4..87d86074b 100644--- a/control-api/test/config.pluginSdkRateLimits.test.ts+++ b/control-api/test/config.pluginSdkRateLimits.test.ts@@ -11,9 +11,9 @@ import { readFileSync } from 'node:fs'* not weaken these assertions to pass early.** Covered:- * 1. Code defaults 200/180/600/600 (decision Q3: recalibrated upward from- * the old hardcoded 120/60; request-bucket and pre-auth unchanged at 600- * but moved to ENV).+ * 1. Code defaults 150/120/600/600 (decision Q3: recalibrated from the old+ * hardcoded 120/60; request-bucket and pre-auth unchanged at 600 but+ * moved to ENV).* 2. Each ENV override honored.* 3. Invalid values fail loudly at import (positiveIntegerFromEnv).* 4. Empty string falls back to the code default.@@ -37,12 +37,12 @@ const EXPECTED: Array<{ env: RateLimitKey; field: string; defaultValue: number }{env: 'CONTROL_API_PLUGIN_SDK_NOTIFICATIONS_PER_MIN',field: 'pluginSdkNotificationsRlPerMin',- defaultValue: 200,+ defaultValue: 150,},{env: 'CONTROL_API_PLUGIN_SDK_PROMPTBRIDGE_PER_MIN',field: 'pluginSdkPromptBridgeRlPerMin',- defaultValue: 180,+ defaultValue: 120,},{env: 'CONTROL_API_PLUGIN_SDK_REQUEST_BUCKET_PER_MIN',@@ -97,11 +97,11 @@ describe('plugin SDK platform rate-limit config (issue #348)', () => {vi.resetModules()})- it('defaults the four platform rate limits to 200/180/600/600', async () => {+ it('defaults the four platform rate limits to 150/120/600/600', async () => {const config = await loadConfigWith({})- expect(config.pluginSdkNotificationsRlPerMin).toBe(200)- expect(config.pluginSdkPromptBridgeRlPerMin).toBe(180)+ expect(config.pluginSdkNotificationsRlPerMin).toBe(150)+ expect(config.pluginSdkPromptBridgeRlPerMin).toBe(120)expect(config.pluginSdkRequestBucketRlPerMin).toBe(600)expect(config.pluginSdkPreauthRlPerMin).toBe(600)})@@ -126,8 +126,8 @@ describe('plugin SDK platform rate-limit config (issue #348)', () => {CONTROL_API_PLUGIN_SDK_PREAUTH_PER_MIN: '',})- expect(config.pluginSdkNotificationsRlPerMin).toBe(200)- expect(config.pluginSdkPromptBridgeRlPerMin).toBe(180)+ expect(config.pluginSdkNotificationsRlPerMin).toBe(150)+ expect(config.pluginSdkPromptBridgeRlPerMin).toBe(120)expect(config.pluginSdkRequestBucketRlPerMin).toBe(600)expect(config.pluginSdkPreauthRlPerMin).toBe(600)})diff --git a/control-api/test/pluginWorkloadSdkSteplessQuota.realPostgres.integration.test.ts b/control-api/test/pluginWorkloadSdkSteplessQuota.realPostgres.integration.test.tsindex 077b5a58f..3d09998e5 100644--- a/control-api/test/pluginWorkloadSdkSteplessQuota.realPostgres.integration.test.ts+++ b/control-api/test/pluginWorkloadSdkSteplessQuota.realPostgres.integration.test.ts@@ -330,7 +330,7 @@ describeRealPostgres(})it('enforces the per-minute window from the audit trail and frees after 61 seconds (backdated)', async () => {- // promptBridge at the 180/min platform default: 181 in-window rows deny.+ // promptBridge at the 120/min platform default: 121 in-window rows deny.const bridgeRecipe = `stepless-window-bridge-${randomBytes(4).toString('hex')}`await assertStepless(bridgeRecipe)await seedPromptBridgeGrant(bridgeRecipe, {})@@ -340,7 +340,7 @@ describeRealPostgres(if (!grant) throw new Error(`seeded promptBridge grant not found for ${bridgeRecipe}`)return grant})()- await seedInvocationWindowRows(bridgeRecipe, 'promptBridge', 'window-probe', 181)+ await seedInvocationWindowRows(bridgeRecipe, 'promptBridge', 'window-probe', 121)await expect(quotaTracker.checkRateLimit(NS, bridgeRecipe, 'promptBridge', bridgeGrant)@@ -348,7 +348,7 @@ describeRealPostgres(ok: false,error: 'quota_exceeded',retryable: false,- message: expect.stringContaining('180/minute'),+ message: expect.stringContaining('120/minute'),})// Backdate the whole burst out of the trailing minute (the window clock is@@ -363,7 +363,7 @@ describeRealPostgres(quotaTracker.checkRateLimit(NS, bridgeRecipe, 'promptBridge', bridgeGrant)).resolves.toEqual({ ok: true })- // clientNotifications mirror at the 200/min platform default, narrowed to+ // clientNotifications mirror at the 150/min platform default, narrowed to// the eventType (detail column).const notifRecipe = `stepless-window-notif-${randomBytes(4).toString('hex')}`await assertStepless(notifRecipe)@@ -374,7 +374,7 @@ describeRealPostgres(if (!grant) throw new Error(`seeded clientNotifications grant not found for ${notifRecipe}`)return grant})()- await seedInvocationWindowRows(notifRecipe, 'clientNotifications', 'lead.followup.due', 201)+ await seedInvocationWindowRows(notifRecipe, 'clientNotifications', 'lead.followup.due', 151)await expect(quotaTracker.checkRateLimit(NS, notifRecipe, 'clientNotifications', notifGrant, {@@ -384,7 +384,7 @@ describeRealPostgres(ok: false,error: 'quota_exceeded',retryable: false,- message: expect.stringContaining('200/minute'),+ message: expect.stringContaining('150/minute'),})await db.pool.query(diff --git a/control-api/test/services.pluginWorkloadSdkQuotaTracker.test.ts b/control-api/test/services.pluginWorkloadSdkQuotaTracker.test.tsindex 41c7551d6..f10ac6885 100644--- a/control-api/test/services.pluginWorkloadSdkQuotaTracker.test.ts+++ b/control-api/test/services.pluginWorkloadSdkQuotaTracker.test.ts@@ -52,10 +52,11 @@ const grant = (// ─── Issue #348 (plan D3) — platform per-minute defaults ─────────────────//// RED-FIRST (plan §6.6): these tests assert the POST-change ceilings-// (promptBridge 180/min, clientNotifications 200/min, sourced from+// (promptBridge 120/min, clientNotifications 150/min, sourced from// config.pluginSdkPromptBridgeRlPerMin / config.pluginSdkNotificationsRlPerMin).-// Against pre-change code the hardcoded defaults are 60/120, so the-// exactly-at-the-ceiling cases FAIL until Phase 1 step 1.4 lands. Do not+// Each case is POSITIVE (at the ceiling → allowed) AND NEGATIVE (one over → denied+// with quota_exceeded). Against pre-change code the hardcoded defaults are 60/120,+// so the exactly-at-the-ceiling cases FAIL until Phase 1 step 1.4 lands. Do not// weaken them to pass early.//// Plan D3.3 (per-run leg inert): after Phase 1, `consumeQuota` is DELETED@@ -70,29 +71,32 @@ describe('checkRateLimit — platform per-minute rate limits (issue #348)', () =vi.mocked(sdkDb.countRecentInvocations).mockReset()})- it('allows promptBridge at exactly 180/minute and denies at 181 (platform default)', async () => {+ it('allows promptBridge at exactly 120/minute (positive) and denies at 121 (negative, platform default)', async () => {const noOverrides = grant({ quotaLimits: {} })- vi.mocked(sdkDb.countRecentInvocations).mockResolvedValue(180)+ // POSITIVE: at the ceiling → allowed.+ vi.mocked(sdkDb.countRecentInvocations).mockResolvedValue(120)await expect(checkRateLimit('sandbox-recipes', 'sdk-recipe', 'promptBridge', noOverrides)).resolves.toEqual({ ok: true })- vi.mocked(sdkDb.countRecentInvocations).mockResolvedValue(181)+ // NEGATIVE: one over the ceiling → denied.+ vi.mocked(sdkDb.countRecentInvocations).mockResolvedValue(121)await expect(checkRateLimit('sandbox-recipes', 'sdk-recipe', 'promptBridge', noOverrides)).resolves.toMatchObject({ok: false,error: 'quota_exceeded',retryable: false,- message: expect.stringContaining('180/minute'),+ message: expect.stringContaining('120/minute'),})})- it('allows clientNotifications at exactly 200/minute and denies at 201, narrowed to the eventType', async () => {+ it('allows clientNotifications at exactly 150/minute (positive) and denies at 151 (negative), narrowed to the eventType', async () => {const noOverrides = grant({ capabilityFamily: 'clientNotifications', quotaLimits: {} })- vi.mocked(sdkDb.countRecentInvocations).mockResolvedValue(200)+ // POSITIVE: at the ceiling → allowed.+ vi.mocked(sdkDb.countRecentInvocations).mockResolvedValue(150)await expect(checkRateLimit('sandbox-recipes', 'sdk-recipe', 'clientNotifications', noOverrides, {eventType: 'lead.followup.due',@@ -105,7 +109,8 @@ describe('checkRateLimit — platform per-minute rate limits (issue #348)', () ={ detail: 'lead.followup.due' })- vi.mocked(sdkDb.countRecentInvocations).mockResolvedValue(201)+ // NEGATIVE: one over the ceiling → denied.+ vi.mocked(sdkDb.countRecentInvocations).mockResolvedValue(151)await expect(checkRateLimit('sandbox-recipes', 'sdk-recipe', 'clientNotifications', noOverrides, {eventType: 'lead.followup.due',@@ -114,14 +119,14 @@ describe('checkRateLimit — platform per-minute rate limits (issue #348)', () =ok: false,error: 'quota_exceeded',retryable: false,- message: expect.stringContaining('200/minute'),+ message: expect.stringContaining('150/minute'),})})- it('frees the recipe once the trailing window drains (deny at 181, allow at 0)', async () => {+ it('frees the recipe once the trailing window drains (deny at 121, allow at 0)', async () => {const noOverrides = grant({ quotaLimits: {} })- vi.mocked(sdkDb.countRecentInvocations).mockResolvedValue(181)+ vi.mocked(sdkDb.countRecentInvocations).mockResolvedValue(121)await expect(checkRateLimit('sandbox-recipes', 'sdk-recipe', 'promptBridge', noOverrides)).resolves.toMatchObject({ ok: false, error: 'quota_exceeded' })diff --git a/deploy/base/control-plane/configmaps.yaml b/deploy/base/control-plane/configmaps.yamlindex ba66e12ca..d229ac617 100644--- a/deploy/base/control-plane/configmaps.yaml+++ b/deploy/base/control-plane/configmaps.yaml@@ -60,10 +60,10 @@ data:# (maxRequestsPerRun / maxNotificationsPerRun) are deprecated and ignored;# these per-minute windows reset every 60s, so stepless recipes are never# permanently trapped. Values MUST equal the code defaults in- # control-api/src/config.ts (200/180/600/600) — the config deploy-mirror+ # control-api/src/config.ts (150/120/600/600) — the config deploy-mirror# test fails on drift.- CONTROL_API_PLUGIN_SDK_NOTIFICATIONS_PER_MIN: "200"- CONTROL_API_PLUGIN_SDK_PROMPTBRIDGE_PER_MIN: "180"+ CONTROL_API_PLUGIN_SDK_NOTIFICATIONS_PER_MIN: "150"+ CONTROL_API_PLUGIN_SDK_PROMPTBRIDGE_PER_MIN: "120"CONTROL_API_PLUGIN_SDK_REQUEST_BUCKET_PER_MIN: "600"CONTROL_API_PLUGIN_SDK_PREAUTH_PER_MIN: "600"# Hard ceiling for caller-provided ttlSeconds. Defaults to 48h so a clientdiff --git a/deploy/overlays/minikube/configmaps/control-api-config.yaml b/deploy/overlays/minikube/configmaps/control-api-config.yamlindex 54a4da804..e08f8f168 100644--- a/deploy/overlays/minikube/configmaps/control-api-config.yaml+++ b/deploy/overlays/minikube/configmaps/control-api-config.yaml@@ -56,10 +56,10 @@ data:# Plugin Workload SDK platform rate limits (issue #348). This overlay is a# FULL-COPY of the base ConfigMap — omitting a key here silently falls back# to code defaults, so all four keys are registered at the code defaults- # (200/180/600/600). Per-run SDK quotas are deprecated and ignored; the+ # (150/120/600/600). Per-run SDK quotas are deprecated and ignored; the# per-minute windows reset every 60s.- CONTROL_API_PLUGIN_SDK_NOTIFICATIONS_PER_MIN: "200"- CONTROL_API_PLUGIN_SDK_PROMPTBRIDGE_PER_MIN: "180"+ CONTROL_API_PLUGIN_SDK_NOTIFICATIONS_PER_MIN: "150"+ CONTROL_API_PLUGIN_SDK_PROMPTBRIDGE_PER_MIN: "120"CONTROL_API_PLUGIN_SDK_REQUEST_BUCKET_PER_MIN: "600"CONTROL_API_PLUGIN_SDK_PREAUTH_PER_MIN: "600"# OSS default: point at the shared registry so a self-hoster browses thediff --git a/docs/crds/workflowrecipe.md b/docs/crds/workflowrecipe.mdindex cd6f82397..9d97945ad 100644--- a/docs/crds/workflowrecipe.md+++ b/docs/crds/workflowrecipe.md@@ -1377,7 +1377,7 @@ Declaring this block forces an always-on `mcp-host`. Runtime enforcement is addi| `promptBridge.maxOutputTokens` | integer | No | Min 1. || `promptBridge.maxRequestsPerRun` | integer | No | Min 1. **Deprecated:** accepted but ignored; platform per-minute rate limits apply. Removal planned. || `promptBridge.maxConcurrentInvocations` | integer | No | Min 1. Runtime default 5. |-| `promptBridge.maxInvocationsPerMinute` | integer | No | Min 1. Platform default 180 when unset (ENV `CONTROL_API_PLUGIN_SDK_PROMPTBRIDGE_PER_MIN`, issue #348). |+| `promptBridge.maxInvocationsPerMinute` | integer | No | Min 1. Platform default 120 when unset (ENV `CONTROL_API_PLUGIN_SDK_PROMPTBRIDGE_PER_MIN`, issue #348). || `clientNotifications.allowedEventTypes` | string[] | **Yes**\† | 1–64 entries. || `clientNotifications.allowedTargetRefs` | string[] | No | Max 64. || `clientNotifications.allowedUserRefs` | boolean | No | Whether `userRef` targets are permitted. |diff --git a/docs/deploy/plugin-workload-sdk-upgrade.md b/docs/deploy/plugin-workload-sdk-upgrade.mdindex 54988ad76..81cd14eac 100644--- a/docs/deploy/plugin-workload-sdk-upgrade.md+++ b/docs/deploy/plugin-workload-sdk-upgrade.md@@ -59,8 +59,8 @@ a window is throttled for at most one minute and is never permanently trapped| ENV variable | Default | Limits ||---|---|---|-| `CONTROL_API_PLUGIN_SDK_NOTIFICATIONS_PER_MIN` | `200` | clientNotifications invocations per minute |-| `CONTROL_API_PLUGIN_SDK_PROMPTBRIDGE_PER_MIN` | `180` | promptBridge invocations per minute |+| `CONTROL_API_PLUGIN_SDK_NOTIFICATIONS_PER_MIN` | `150` | clientNotifications invocations per minute |+| `CONTROL_API_PLUGIN_SDK_PROMPTBRIDGE_PER_MIN` | `120` | promptBridge invocations per minute || `CONTROL_API_PLUGIN_SDK_REQUEST_BUCKET_PER_MIN` | `600` | shared SDK request bucket per minute || `CONTROL_API_PLUGIN_SDK_PREAUTH_PER_MIN` | `600` | pre-authorization checks per minute |diff --git a/workflow-recipes/package-lock.json b/workflow-recipes/package-lock.jsonindex 5afad9914..0516c688b 100644--- a/workflow-recipes/package-lock.json+++ b/workflow-recipes/package-lock.json@@ -1,12 +1,12 @@{"name": "workload-recipes-controller",- "version": "0.1.287",+ "version": "0.1.288","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "workload-recipes-controller",- "version": "0.1.287",+ "version": "0.1.288","license": "SEE LICENSE IN LICENSE","dependencies": {"@aws-sdk/client-s3": "^3.1009.0",diff --git a/workflow-recipes/package.json b/workflow-recipes/package.jsonindex f715aad51..1057fcbed 100644--- a/workflow-recipes/package.json+++ b/workflow-recipes/package.json@@ -1,6 +1,6 @@{"name": "workload-recipes-controller",- "version": "0.1.287",+ "version": "0.1.288","description": "Workload Recipes Controller (WRC) - WorkloadRecipe lifecycle management and MCP server interface","main": "dist/main.js","engines": {diff --git a/workflow-recipes/src/types.ts b/workflow-recipes/src/types.tsindex 4dee7b33c..a690ba7ee 100644--- a/workflow-recipes/src/types.ts+++ b/workflow-recipes/src/types.ts@@ -489,7 +489,7 @@ export interface PluginWorkloadSdkSpec {maxRequestContentBytes?: number/** Max parallel promptBridge calls per workload; default 5. */maxConcurrentInvocations?: number- /** Rate limit per workload; platform default 180 when unset (ENV CONTROL_API_PLUGIN_SDK_PROMPTBRIDGE_PER_MIN, issue #348). */+ /** Rate limit per workload; platform default 120 when unset (ENV CONTROL_API_PLUGIN_SDK_PROMPTBRIDGE_PER_MIN, issue #348). */maxInvocationsPerMinute?: number/** How long invocation results are queryable; default 24. */resultRetentionHours?: number@@ -504,7 +504,7 @@ export interface PluginWorkloadSdkSpec {allowedUserRefs?: boolean/** @deprecated Accepted for compatibility; no longer enforced (issue #348). Platform per-minute rate limits apply. */maxNotificationsPerRun?: number- /** Rate limit per workload; platform default 200 when unset (ENV CONTROL_API_PLUGIN_SDK_NOTIFICATIONS_PER_MIN, issue #348). */+ /** Rate limit per workload; platform default 150 when unset (ENV CONTROL_API_PLUGIN_SDK_NOTIFICATIONS_PER_MIN, issue #348). */maxNotificationsPerMinute?: number/** Default 256. */maxTitleBytes?: number