Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion containers/api-proxy/model-recovery.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ const { getRuntimeModels } = require('./runtime-model-catalog');
const { normalizeModel } = require('./routing-catalogue');
const { getRetiredModelBlockState } = require('./guards/retired-model-guard');
const { getCurrentGuardChecks } = require('./proxy-guards');
const { isModelPriceable } = require('./guards/ai-credits-guard');
const { parsePositiveNumber } = require('./guards/guard-utils');
const { resolveModelIdentity } = require('./model-identity');
const { compareByVersion } = require('./model-utils');
const { sanitizeForLog } = require('./logging');
const { MODEL_FALLBACK } = require('./model-config');
const { isModelPriceable } = require('./guards/ai-credits-guard');

const MAX_AUTOMATIC_RECOVERIES = 3;

Expand Down
8 changes: 8 additions & 0 deletions containers/api-proxy/server.model-recovery.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,14 @@ test('does not bypass missing credit pricing', async () => {
expect(JSON.parse(res.end.mock.calls[0][0]).error.code).toBe('model_recovery_exhausted');
});

test('allows recovery to a priceable model with a credit budget', async () => {
load({ AWF_MAX_AI_CREDITS: '1' });
catalog.replaceRuntimeModels('copilot', [record('gpt-5.3-codex')]);
await start();
expect(requests).toHaveLength(1);
expect(JSON.parse(sent()).model).toBe('gpt-5.3-codex');
});

test.each([
{ AWF_MODEL_FALLBACK: '{"enabled":false}' },
{ AWF_MODEL_FALLBACK: '{"excludeEngines":["copilot"]}' },
Expand Down
6 changes: 5 additions & 1 deletion docs/auth-matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,11 @@ The request layer signs the HTTP method, canonical path and sorted query, final
| WIF Provider | `AWF_AUTH_GCP_WORKLOAD_IDENTITY_PROVIDER` | ✅ |
| Service Account | `AWF_AUTH_GCP_SERVICE_ACCOUNT` | ❌ (direct federation if omitted) |
| Scope | `AWF_AUTH_GCP_SCOPE` | ❌ (default: `https://www.googleapis.com/auth/cloud-platform`; used in step 2 only) |
| Audience | `AWF_AUTH_OIDC_AUDIENCE` | ❌ (default: derived from WIF provider) |
| Audience | `AWF_AUTH_OIDC_AUDIENCE` | ❌ (default: `https://iam.googleapis.com/` + WIF provider) |
| Project | `AWF_AUTH_GCP_PROJECT` | ❌ (needed with location for native Vertex path scoping) |
| Location | `AWF_AUTH_GCP_LOCATION` | ❌ (needed with project for native Vertex path scoping) |

When both project and location are set, native `v1`/`v1beta1` Vertex model paths are rewritten to project-scoped paths; if either is absent, paths are left unchanged. See [api-proxy-sidecar.md](api-proxy-sidecar.md).

**Token exchange (2-step):**
1. `POST https://sts.googleapis.com/v1/token` — exchange GitHub JWT for federated token
Expand Down
Loading