Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
test(control-api): require Codex redeem to keep provider_unavailable on a refresh outage
Alfredo Lopeze992757e20b7
diff --git a/control-api/package-lock.json b/control-api/package-lock.jsonindex 9e40436bd..a54372c2a 100644--- a/control-api/package-lock.json+++ b/control-api/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-api",- "version": "0.1.631",+ "version": "0.1.632","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-api",- "version": "0.1.631",+ "version": "0.1.632","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.jsonindex eb4f1205f..e0676d782 100644--- a/control-api/package.json+++ b/control-api/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-api",- "version": "0.1.631",+ "version": "0.1.632","description": "Internal Clerum control plane REST API + UI for managing CRDs and secrets","main": "dist/main.js","engines": {diff --git a/control-api/test/services.llmProviderAttemptRedemption.test.ts b/control-api/test/services.llmProviderAttemptRedemption.test.tsindex 3b988ad9a..3e2d4b8df 100644--- a/control-api/test/services.llmProviderAttemptRedemption.test.ts+++ b/control-api/test/services.llmProviderAttemptRedemption.test.ts@@ -426,7 +426,13 @@ describe('redeemLlmProviderAttempt', () => {expect(deps.publishAllowlist).not.toHaveBeenCalled()})- it('R21-2 keeps a transient refresh failure as connection_unavailable', async () => {+ /**+ * R24: an upstream refresh failure keeps its own code, as the Grok redeem+ * path does. Both codes answer 503 and reach the Host as a retryable+ * ModelOverloaded, so the wire behaviour is unchanged; the code tells an+ * operator the vendor was down rather than the connection being unusable.+ */+ it('R24 keeps a transient upstream refresh failure as provider_unavailable', async () => {const deps = refreshingDeps(async () => {throw new CodexSubscriptionOAuthError(@@ -437,6 +443,23 @@ describe('redeemLlmProviderAttempt', () => {async () => {})+ await expect(+ redeemLlmProviderAttempt({ executionTicket: 'ticket', requestHash: CLAIMS.requestHash }, deps)+ ).rejects.toMatchObject({+ name: 'LlmProviderAttemptRedeemError',+ code: 'provider_unavailable',+ })+ expect(deps.ensureFreshAccessToken).toHaveBeenCalledTimes(1)+ })++ it('R24 maps any other refresh failure to connection_unavailable', async () => {+ const deps = refreshingDeps(+ async () => {+ throw new CodexSubscriptionOAuthError('refresh_in_flight', 'another refresh holds the lock')+ },+ async () => {}+ )+await expect(redeemLlmProviderAttempt({ executionTicket: 'ticket', requestHash: CLAIMS.requestHash }, deps)).rejects.toMatchObject({