Repository navigation
Conversation
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
The |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Add the user-scoped experiment ai-gateway-responses-websocket and deliver its per-user decision to the AI Gateway, which cannot evaluate experiment rules itself. - codersdk: new ExperimentAIGatewayResponsesWebSocket, listed in ExperimentsKnown and ExperimentsUserScoped; the ruleguard rule in scripts/rules.go now covers it. - aibridged proto: IsAuthorizedResponse gains responses_websocket_enabled; API version bumped to 1.4. Older 1.x gateways ignore the field. - aibridgedserver: IsAuthorized evaluates the experiment for the API key owner through experiments.Evaluator (fails closed). The evaluator is a required server option, wired from coderd and the enterprise serve endpoint. - aibridged: ServeHTTP stores the decision in the request context via coderd/aibridge WithResponsesWebSocketEnabled; ResponsesWebSocketEnabled reads it. The helper lives in coderd/aibridge so the aibridge library can consume it without an import cycle. Request handling is unchanged and WebSocket upgrades still return 501.
Cover the fail-closed default of aibridge.ResponsesWebSocketEnabled: a context that never passed through the gateway reports the experiment off. The gateway tests only exercise contexts where the flag was set.
8d9f974 to
e6bb4fd
Compare
Adds the user-scoped experiment
ai-gateway-responses-websocketand delivers its per-user decision to the AI Gateway, so the upcoming OpenAI Responses WebSocket support can be rolled out per user. This PR changes no request handling: nothing reads the flag yet, and WebSocket upgrades on/openai/v1/responsesstill return501.The gateway (including standalone
coder ai-gateway start) has no database access and cannot evaluate experiment rules itself. coderd's DRPCIsAuthorizedtherefore evaluates the experiment for the API key owner throughexperiments.Evaluator, which fails closed on errors. It returns the result in the newIsAuthorizedResponse.responses_websocket_enabledfield. The aibridged protocol moves to 1.4; 1.x gateways keep working and ignore the field. The gateway stores the value in the request context withaibridge.WithResponsesWebSocketEnabled, and later PRs read it withaibridge.ResponsesWebSocketEnabled(ctx). The helper lives incoderd/aibridgerather thancoderd/aibridgedso the aibridge library can import it without an import cycle.ExperimentEvaluatoris now a requiredaibridgedserver.Optionsfield. The ruleguard inscripts/rules.goforbids static checks of the new experiment in coderd, like the other user-scoped experiments.Note: every AI Gateway request now reads the experiment rules once more in
IsAuthorized; aconditionrule also loads the user's organizations and groups.Dogfood UAT via Coder Agents passed: per-user rule scoping in
/api/v2/experiments, unchanged gateway HTTP for matched and unmatched users, and501for WebSocket upgrades.Stack: bottom layer, base
main. Follow-ups build the Responses WebSocket session core and endpoint on top.Note
This PR was written by an AI coding agent (xum).
Generated with
xum• Model:anthropic:claude-opus-5-5• Thinking:high