@@ -44,6 +44,7 @@ setProvider(
4444type WebhookEnv = PipelineEnv & {
4545 GITHUB_WEBHOOK_SECRET ?: string ;
4646 DOCS_FLUE_INTERNAL_TOKEN ?: string ;
47+ DOCS_FLUE_ENABLE_EVAL_ROUTES ?: string ;
4748} ;
4849
4950const app = new Hono ( ) ;
@@ -142,10 +143,11 @@ app.post("/webhooks/github", async (c) => {
142143
143144// ── Eval routes ─────────────────────────────────────────────────────────────
144145// Mount each reviewable agent behind a shared internal-token gate so
145- // vitest-evals can drive them over HTTP during CI. The token reuses
146- // DOCS_FLUE_INTERNAL_TOKEN (same gate as /dev/review/:number). Routes return
147- // 404 when the token is unset so they are invisible in production deploys
148- // that have not opted in.
146+ // vitest-evals can drive them over HTTP during CI. Requires both
147+ // DOCS_FLUE_ENABLE_EVAL_ROUTES=1 and DOCS_FLUE_INTERNAL_TOKEN to be set in
148+ // the Worker env. The Vite config only injects these during eval runs
149+ // (DOCS_FLUE_AGENT_EVALS=1), so eval routes are never live in production or
150+ // normal dev.
149151const EVAL_AGENTS = [
150152 CodeReviewFile ,
151153 StyleGuideFile ,
@@ -156,6 +158,7 @@ const EVAL_AGENTS = [
156158
157159app . use ( "/eval/agents/*" , async ( c , next ) => {
158160 const env = c . env as unknown as WebhookEnv ;
161+ if ( env . DOCS_FLUE_ENABLE_EVAL_ROUTES !== "1" ) return c . text ( "Not Found" , 404 ) ;
159162 const secret = env . DOCS_FLUE_INTERNAL_TOKEN ;
160163 if ( ! secret ) return c . text ( "Not Found" , 404 ) ;
161164 const provided = c . req . header ( "x-dev-secret" ) ;
0 commit comments