Skip to content

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

TypeScript

feat(contracts): publish executionTicketTtlMs; control-api derives the ticket TTL (#739)

Alfredo Lopez061cb998867e
diff --git a/control-api/package-lock.json b/control-api/package-lock.json
index 72acf9df8..fc80e5487 100644
--- a/control-api/package-lock.json
+++ b/control-api/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-api",
- "version": "0.1.627",
+ "version": "0.1.628",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-api",
- "version": "0.1.627",
+ "version": "0.1.628",
"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 a570f1957..cd8fd91b9 100644
--- a/control-api/package.json
+++ b/control-api/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-api",
- "version": "0.1.627",
+ "version": "0.1.628",
"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/llmProviderAttemptEnvelope.ts b/control-api/src/services/llmProviderAttemptEnvelope.ts
index 25b86bb33..2d5b7443c 100644
--- a/control-api/src/services/llmProviderAttemptEnvelope.ts
+++ b/control-api/src/services/llmProviderAttemptEnvelope.ts
@@ -15,10 +15,17 @@
* imports this one, so defining them there would make this module read them
* before they are initialized whenever the ticket module loads first.
*/
+import { LIMITS as GROK_CONTRACT_LIMITS } from '@clerum/grok-provider-attempt-contract'
+import { LIMITS as CODEX_CONTRACT_LIMITS } from '@clerum/llm-provider-attempt-contract'
import { config } from '../config.js'
-export const CODEX_EXECUTION_TICKET_TTL_SECONDS = 60
-export const GROK_EXECUTION_TICKET_TTL_SECONDS = 60
+/**
+ * The ticket TTL is a published contract limit: the proxies bound their
+ * admission waits against it and the fixtures freeze it, so control-api signs
+ * tickets with the contract value rather than a copy of it (#739).
+ */
+export const CODEX_EXECUTION_TICKET_TTL_SECONDS = CODEX_CONTRACT_LIMITS.executionTicketTtlMs / 1000
+export const GROK_EXECUTION_TICKET_TTL_SECONDS = GROK_CONTRACT_LIMITS.executionTicketTtlMs / 1000
/** Per-attempt stream cap control-api returns on redeem (30 min). */
export const CODEX_MAX_STREAM_DURATION_MS = 1_800_000
diff --git a/docs/architecture/codex-subscription-transport-contract.md b/docs/architecture/codex-subscription-transport-contract.md
index 6a73ca554..b4e2c7fb5 100644
--- a/docs/architecture/codex-subscription-transport-contract.md
+++ b/docs/architecture/codex-subscription-transport-contract.md
@@ -181,6 +181,7 @@ must still be `authorized`, and the consuming `UPDATE` matches only
| maxQueueWaitMs | 60000 |
| upstreamIdleTimeoutMs | 300000 |
| maxRetriesPerAttempt | 1 |
+| executionTicketTtlMs | 60000 |
Tool definitions have no independent count ceiling in the Evenfire request
contract. The entire serialized request, including all definitions, remains
diff --git a/docs/architecture/grok-subscription-transport-contract.md b/docs/architecture/grok-subscription-transport-contract.md
index 66b44df60..959a69012 100644
--- a/docs/architecture/grok-subscription-transport-contract.md
+++ b/docs/architecture/grok-subscription-transport-contract.md
@@ -145,6 +145,7 @@ them.
| maxQueueWaitMs | 60000 |
| upstreamIdleTimeoutMs | 600000 |
| maxRetriesPerAttempt | 1 |
+| executionTicketTtlMs | 60000 |
The limit values live only in the table above, which
`grok-llm-proxy/test/contractFreeze.test.ts` checks against the fixture; the
diff --git a/packages/grok-provider-attempt-contract/index.cjs b/packages/grok-provider-attempt-contract/index.cjs
index c33654f71..4e28175d6 100644
--- a/packages/grok-provider-attempt-contract/index.cjs
+++ b/packages/grok-provider-attempt-contract/index.cjs
@@ -44,6 +44,10 @@ const LIMITS = Object.freeze({
// Free-form JSON trees (tool parameters, assistant tool-call arguments) may
// nest at most this many containers. Bounds recursion before hashing.
maxNestingDepth: 64,
+ // How long an execution ticket stays redeemable after authorize. control-api
+ // signs Grok tickets with this TTL, and the proxy bounds its admission waits
+ // against the remaining ticket life, so both read it from here (#739).
+ executionTicketTtlMs: 60000,
})
// Room for the runtime envelope around a request held to
diff --git a/packages/grok-provider-attempt-contract/index.d.ts b/packages/grok-provider-attempt-contract/index.d.ts
index e715a3105..5a2ffa50c 100644
--- a/packages/grok-provider-attempt-contract/index.d.ts
+++ b/packages/grok-provider-attempt-contract/index.d.ts
@@ -22,6 +22,8 @@ export declare const LIMITS: {
readonly maxDeadlineMs: 1800000
readonly maxIdLength: 128
readonly maxNestingDepth: 64
+ /** Execution ticket TTL; control-api signs Grok tickets with it. */
+ readonly executionTicketTtlMs: 60000
}
/**
diff --git a/packages/llm-provider-attempt-contract/index.cjs b/packages/llm-provider-attempt-contract/index.cjs
index 316f08cbf..b90f9b7ac 100644
--- a/packages/llm-provider-attempt-contract/index.cjs
+++ b/packages/llm-provider-attempt-contract/index.cjs
@@ -47,6 +47,10 @@ const LIMITS = Object.freeze({
// Free-form JSON trees (tool parameters, assistant tool-call arguments) may
// nest at most this many containers. Bounds recursion before hashing.
maxNestingDepth: 64,
+ // How long an execution ticket stays redeemable after authorize. control-api
+ // signs tickets with this TTL, and the proxy bounds its admission waits
+ // against the remaining ticket life, so both read it from here (#739).
+ executionTicketTtlMs: 60000,
})
// Room for the runtime envelope around a request held to
diff --git a/packages/llm-provider-attempt-contract/index.d.ts b/packages/llm-provider-attempt-contract/index.d.ts
index 4368c671a..5e11f09d7 100644
--- a/packages/llm-provider-attempt-contract/index.d.ts
+++ b/packages/llm-provider-attempt-contract/index.d.ts
@@ -38,6 +38,8 @@ export declare const LIMITS: {
readonly maxDeadlineMs: 1800000
readonly maxIdLength: 128
readonly maxNestingDepth: 64
+ /** Execution ticket TTL; control-api signs tickets with it. */
+ readonly executionTicketTtlMs: 60000
}
/**
diff --git a/tests/e2e/fixtures/codex-subscription/sanitized-upstream-contract.json b/tests/e2e/fixtures/codex-subscription/sanitized-upstream-contract.json
index 1e77a5798..ef3088dd3 100644
--- a/tests/e2e/fixtures/codex-subscription/sanitized-upstream-contract.json
+++ b/tests/e2e/fixtures/codex-subscription/sanitized-upstream-contract.json
@@ -51,7 +51,8 @@
"maxQueuedRequests": 16,
"maxQueueWaitMs": 60000,
"upstreamIdleTimeoutMs": 300000,
- "maxRetriesPerAttempt": 1
+ "maxRetriesPerAttempt": 1,
+ "executionTicketTtlMs": 60000
},
"errorTaxonomy": [
"insufficient_scope",
diff --git a/tests/e2e/fixtures/grok-subscription/sanitized-upstream-contract.json b/tests/e2e/fixtures/grok-subscription/sanitized-upstream-contract.json
index 17b3f0547..45f9d6f94 100644
--- a/tests/e2e/fixtures/grok-subscription/sanitized-upstream-contract.json
+++ b/tests/e2e/fixtures/grok-subscription/sanitized-upstream-contract.json
@@ -64,7 +64,8 @@
"maxQueuedRequests": 16,
"maxQueueWaitMs": 60000,
"upstreamIdleTimeoutMs": 600000,
- "maxRetriesPerAttempt": 1
+ "maxRetriesPerAttempt": 1,
+ "executionTicketTtlMs": 60000
},
"errorTaxonomy": [
"insufficient_scope",
diff --git a/tests/e2e/fixtures/package-lock.json b/tests/e2e/fixtures/package-lock.json
index d5ec11397..2143af683 100644
--- a/tests/e2e/fixtures/package-lock.json
+++ b/tests/e2e/fixtures/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@clerum/e2e-test-fixtures",
- "version": "1.0.95",
+ "version": "1.0.96",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@clerum/e2e-test-fixtures",
- "version": "1.0.95",
+ "version": "1.0.96",
"dependencies": {
"@kubernetes/client-node": "^1.0.0"
},
diff --git a/tests/e2e/fixtures/package.json b/tests/e2e/fixtures/package.json
index 69c8d4a54..ccda2cdaa 100644
--- a/tests/e2e/fixtures/package.json
+++ b/tests/e2e/fixtures/package.json
@@ -1,6 +1,6 @@
{
"name": "@clerum/e2e-test-fixtures",
- "version": "1.0.95",
+ "version": "1.0.96",
"description": "E2E test fixtures and utilities for Clerum testing",
"type": "module",
"main": "index.ts",