Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
docs(subscriptions): publish every code the llm proxies refuse a request with (#739)
Alfredo Lopez2604bf44697c
diff --git a/docs/architecture/codex-subscription-transport-contract.md b/docs/architecture/codex-subscription-transport-contract.mdindex b4e2c7fb5..e1747447a 100644--- a/docs/architecture/codex-subscription-transport-contract.md+++ b/docs/architecture/codex-subscription-transport-contract.md@@ -406,8 +406,34 @@ Stable codes: `insufficient_scope`, `no_grant`, `model_not_allowed`,`origin_denied`, `ticket_invalid`, `ticket_replayed`, `request_hash_mismatch`,`invalid_request`, `tool_call_limit_exceeded`, `sse_buffer_exceeded`,`stream_duration_exceeded`, `context_length_exceeded`, `invalid_tool_arguments`,-`payload_too_large`. The freeze gate checks that every code the proxy-constructs is in the fixture's `errorTaxonomy`.+`payload_too_large`, `request_timeout`, `length_required`, `ticket_expired`,+`unsupported_media_type`, `unknown_field`, `host_binding_mismatch`, `disabled`,+`Unauthorized`, `not_found`, `internal_error`. The freeze gate checks that every+code the proxy constructs, and every code it refuses a request with+(`reject(res, <status>, <code>)`), is in the fixture's `errorTaxonomy`.++- `request_timeout`: HTTP 408. A body granted admission was not read and+ parsed within the proxy's read deadline; the upstream never saw it.+- `length_required`: HTTP 411. The request carried `Transfer-Encoding` instead+ of a `Content-Length`, so its size cannot be admitted before reading.+- `unsupported_media_type`: HTTP 415. The body is not `application/json`, or it+ carries a `Content-Encoding` (the parsers never inflate).+- `length_required` and `unsupported_media_type` stay in the Host's generic+ non-retryable bucket (`LLM_API_CALL_FAILED`): the Host sends a string body,+ so its client always sets `Content-Length`, never sets `Content-Encoding` and+ always sends `application/json`. Either code means a caller other than the+ Host, or a Host defect, and retrying the same request cannot succeed.+- `ticket_expired`: HTTP 403. control-api refused the redeem because the+ execution ticket outlived `executionTicketTtlMs`; the proxy passes the code+ through.+- `unknown_field`: HTTP 400. The completion or admin body carries a top-level+ field outside the schema.+- `host_binding_mismatch`: HTTP 403. The execution ticket is bound to a Host+ the caller's platform JWT does not name.+- `disabled`: HTTP 404. The execution kill switch is off.+- `Unauthorized`: HTTP 401. The platform JWT is missing or invalid.+- `not_found`: HTTP 404. Unknown route on the runtime, admin or probe listener.+- `internal_error`: HTTP 500. An unhandled error in the request pipeline.- `context_length_exceeded`: the upstream refused the request because itexceeds the model's context window. The upstream sends an SSE `error` eventdiff --git a/docs/architecture/grok-subscription-transport-contract.md b/docs/architecture/grok-subscription-transport-contract.mdindex 959a69012..8c5c80394 100644--- a/docs/architecture/grok-subscription-transport-contract.md+++ b/docs/architecture/grok-subscription-transport-contract.md@@ -281,9 +281,35 @@ Stable codes: `insufficient_scope`, `no_grant`, `model_not_allowed`,`request_hash_mismatch`, `client_upgrade_required`, `tool_call_limit_exceeded`,`tool_call_arguments_exceeded`, `invalid_tool_arguments`, `invalid_request`,`sse_buffer_exceeded`, `stream_duration_exceeded`, `payload_too_large`,-`context_length_exceeded`, `request_limit_exceeded` (Host-side only). The-freeze gate checks that every code the proxy constructs is in the fixture's-`errorTaxonomy`.+`context_length_exceeded`, `request_limit_exceeded` (Host-side only),+`request_timeout`, `length_required`, `ticket_expired`,+`unsupported_media_type`, `unknown_field`, `host_binding_mismatch`, `disabled`,+`Unauthorized`, `not_found`, `internal_error`. The freeze gate checks that every+code the proxy constructs, and every code it refuses a request with+(`reject(res, <status>, <code>)`), is in the fixture's `errorTaxonomy`.++- `request_timeout`: HTTP 408. A body granted admission was not read and+ parsed within the proxy's read deadline; the upstream never saw it.+- `length_required`: HTTP 411. The request carried `Transfer-Encoding` instead+ of a `Content-Length`, so its size cannot be admitted before reading.+- `unsupported_media_type`: HTTP 415. The body is not `application/json`, or it+ carries a `Content-Encoding` (the parsers never inflate).+- `length_required` and `unsupported_media_type` stay in the Host's generic+ non-retryable bucket (`LLM_API_CALL_FAILED`): the Host sends a string body,+ so its client always sets `Content-Length`, never sets `Content-Encoding` and+ always sends `application/json`. Either code means a caller other than the+ Host, or a Host defect, and retrying the same request cannot succeed.+- `ticket_expired`: HTTP 403. control-api refused the redeem because the+ execution ticket outlived `executionTicketTtlMs`; the proxy passes the code+ through.+- `unknown_field`: HTTP 400. The completion or admin body carries a top-level+ field outside the schema.+- `host_binding_mismatch`: HTTP 403. The execution ticket is bound to a Host+ the caller's platform JWT does not name.+- `disabled`: HTTP 404. The execution kill switch is off.+- `Unauthorized`: HTTP 401. The platform JWT is missing or invalid.+- `not_found`: HTTP 404. Unknown route on the runtime, admin or probe listener.+- `internal_error`: HTTP 500. An unhandled error in the request pipeline.- `invalid_request`: the request body failed the transport schema (HTTP 400before redeem), or the upstream answered the completion with HTTP 400.diff --git a/tests/e2e/fixtures/codex-subscription/sanitized-upstream-contract.json b/tests/e2e/fixtures/codex-subscription/sanitized-upstream-contract.jsonindex ef3088dd3..982e7b030 100644--- a/tests/e2e/fixtures/codex-subscription/sanitized-upstream-contract.json+++ b/tests/e2e/fixtures/codex-subscription/sanitized-upstream-contract.json@@ -72,7 +72,17 @@"context_length_exceeded","invalid_tool_arguments","sse_buffer_exceeded",- "stream_duration_exceeded"+ "stream_duration_exceeded",+ "request_timeout",+ "length_required",+ "ticket_expired",+ "unsupported_media_type",+ "unknown_field",+ "host_binding_mismatch",+ "disabled",+ "Unauthorized",+ "not_found",+ "internal_error"],"termsAndTestAccount": {"automationAuthorized": true,diff --git a/tests/e2e/fixtures/grok-subscription/sanitized-upstream-contract.json b/tests/e2e/fixtures/grok-subscription/sanitized-upstream-contract.jsonindex 45f9d6f94..66141be98 100644--- a/tests/e2e/fixtures/grok-subscription/sanitized-upstream-contract.json+++ b/tests/e2e/fixtures/grok-subscription/sanitized-upstream-contract.json@@ -89,7 +89,17 @@"tool_call_limit_exceeded","tool_call_arguments_exceeded","sse_buffer_exceeded",- "stream_duration_exceeded"+ "stream_duration_exceeded",+ "payload_too_large",+ "request_timeout",+ "length_required",+ "ticket_expired",+ "unsupported_media_type",+ "unknown_field",+ "host_binding_mismatch",+ "Unauthorized",+ "not_found",+ "internal_error"],"termsAndTestAccount": {"automationAuthorized": false,diff --git a/tests/e2e/fixtures/package-lock.json b/tests/e2e/fixtures/package-lock.jsonindex 2143af683..3f447f36c 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.96",+ "version": "1.0.97","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "@clerum/e2e-test-fixtures",- "version": "1.0.96",+ "version": "1.0.97","dependencies": {"@kubernetes/client-node": "^1.0.0"},diff --git a/tests/e2e/fixtures/package.json b/tests/e2e/fixtures/package.jsonindex ccda2cdaa..8c211caa3 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.96",+ "version": "1.0.97","description": "E2E test fixtures and utilities for Clerum testing","type": "module","main": "index.ts",