diff --git a/frontend/src/app/api/consult/route.ts b/frontend/src/app/api/consult/route.ts index b5c1519c..d39fa8b0 100644 --- a/frontend/src/app/api/consult/route.ts +++ b/frontend/src/app/api/consult/route.ts @@ -135,9 +135,10 @@ function mergeUsage(usages: Promise[]): Promise { } function shouldUseAgenticRuntime(user: { id: string; app_metadata?: Record }) { - const mode = process.env.CONSULTATION_AGENTIC_RUNTIME?.trim().toLowerCase() ?? "legacy"; + const mode = process.env.CONSULTATION_AGENTIC_RUNTIME?.trim().toLowerCase() ?? "enabled"; + if (mode === "legacy") return false; if (mode === "enabled") return true; - if (mode !== "canary") return false; + if (mode !== "canary") return true; const ids = new Set((process.env.CONSULTATION_AGENTIC_CANARY_USER_IDS ?? "") .split(",").map((value) => value.trim()).filter(Boolean)); const roles = Array.isArray(user.app_metadata?.roles) ? user.app_metadata.roles : []; diff --git a/frontend/tests/consultation-workflow-contract.test.ts b/frontend/tests/consultation-workflow-contract.test.ts index bafa6f90..f97b3267 100644 --- a/frontend/tests/consultation-workflow-contract.test.ts +++ b/frontend/tests/consultation-workflow-contract.test.ts @@ -65,9 +65,9 @@ test("projects consultation themes through explicit strict workflow taxonomy", ( }); -test("staging enables the agentic consultation runtime without changing production compose", () => { +test("agentic consultation is the safe default and legacy is explicit rollback", () => { assert.match(stagingCompose, /CONSULTATION_AGENTIC_RUNTIME: enabled/); - assert.match(route, /CONSULTATION_AGENTIC_RUNTIME/); - assert.match(route, /legacy/); - assert.match(route, /canary/); + assert.match(route, /CONSULTATION_AGENTIC_RUNTIME\?\.trim\(\)\.toLowerCase\(\) \?\? "enabled"/); + assert.match(route, /mode === "legacy"/); + assert.match(route, /mode !== "canary"/); });