Add dap_schema_auto_tool_choice flag for DAP schema agents

What does this MR do and why?

Adds the dap_schema_auto_tool_choice feature flag and pushes it to the AI Gateway on the Duo Agent Platform request path. It gates ai-assist!6734, which binds an AgentComponent's response schema with tool_choice="auto" instead of "any".

"any" forces a tool call every turn, and Anthropic models disable extended thinking under a forced tool choice, so a schema agent never consolidates. One real code review ran 195 cycles and 146 repeated file reads and returned nothing. Under "auto" the model can deliberate in text, and the final answer stays schema-enforced because only the schema tool call ends the loop.

No behaviour change on its own. The flag defaults to off, and while it is off the gateway keeps binding "any" exactly as today. It is actor-scoped on current_user, so the rollout can start with individual users.

Screenshots or screen recordings

N/A — backend-only change.

How to set up and validate locally

  1. Check out feat/21524-agent-response-schema-tool-choice in the AI Gateway, then run gdk restart duo-workflow-service gitlab-ai-gateway.
  2. In rails console: Feature.enable(:dap_schema_auto_tool_choice, User.find_by_username('root'))
  3. Start a flow that uses a response schema, for example a Duo Code Review from a merge request page.
  4. Confirm the flag appears in the x-gitlab-enabled-feature-flags header and under feature_flags in the Duo Workflow Service logs.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist.

References

Edited by Kinshuk Singh

Merge request reports

Loading
Loading