fix(web): require authentication for AskGH Ask APIs

Draft
MS
2mo ago
+120-2

Require authentication for streaming and blocking Ask requests when EXPERIMENT_ASK_GH_ENABLED=true, returning HTTP 401 before entitlement checks or generation. The blocking gate lives in askCodebase, covering MCP callers too; existing anonymous access behavior is preserved when AskGH is disabled.

Verified with eight endpoint regression cases covering authenticated/anonymous requests with AskGH enabled/disabled, plus targeted ESLint.


Summary by cubic

When EXPERIMENT_ASK_GH_ENABLED is enabled, streaming and blocking Ask requests now require authentication and return HTTP 401 before entitlement checks or generation.

  • Gates the blocking path in askCodebase, which also covers the MCP ask_codebase tool and the /api/chat/blocking route.
  • Preserves anonymous access when AskGH is disabled.
  • Adds regression tests for both endpoints covering authenticated and anonymous requests with the flag on and off.