fix: honor responses API toggle for native tools - #822
Conversation
📝 WalkthroughWalkthroughThis PR adds unified gating logic across backend and frontend to ensure native tools cannot be automatically enabled for OpenAI-compatible and Azure services unless the Responses API is explicitly configured. The changes enforce this constraint at the service configuration, bot method, and UI levels, with supporting tests. ChangesNative tools gating on Responses API
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested labels
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
webapp/src/components/system_console/bot.tsx (1)
151-162: ⚡ Quick winExtract duplicated
serviceSupportsNativeToolshelper to shared module.This helper is duplicated between
config_tab.tsx(lines 44-55) andbot.tsx(lines 151-162) with identical logic. Extracting it to a shared utility (e.g.,webapp/src/utils/service_helpers.ts) would eliminate duplication and ensure the native tools support rules remain consistent across both components.♻️ Suggested refactor
Create
webapp/src/utils/service_helpers.ts:export function serviceSupportsNativeTools(service?: { type: string; useResponsesAPI: boolean }): boolean { if (!service) { return false; } if (service.type === 'openai' || service.type === 'anthropic' || service.type === 'gemini' || service.type === 'vertex') { return true; } if (service.type === 'openaicompatible' || service.type === 'azure') { return service.useResponsesAPI; } return false; }Then import in both files:
+import {serviceSupportsNativeTools} from '`@/utils/service_helpers`'; - -function serviceSupportsNativeTools(service?: LLMService): boolean { - if (!service) { - return false; - } - if (service.type === 'openai' || service.type === 'anthropic' || service.type === 'gemini' || service.type === 'vertex') { - return true; - } - if (service.type === 'openaicompatible' || service.type === 'azure') { - return service.useResponsesAPI; - } - return false; -}🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@webapp/src/components/system_console/bot.tsx` around lines 151 - 162, The function serviceSupportsNativeTools is duplicated in the config_tab.tsx and bot.tsx components; extract it into a single shared utility (e.g., a new module) and have both components import and call that single exported function. Move the existing implementation (including the checks for types 'openai','anthropic','gemini','vertex' and the conditional return for 'openaicompatible'/'azure' based on useResponsesAPI) into the new exported serviceSupportsNativeTools helper, remove the duplicate definitions from both components, and update their imports to reference the new helper.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@webapp/src/components/system_console/bot.tsx`:
- Around line 151-162: The function serviceSupportsNativeTools is duplicated in
the config_tab.tsx and bot.tsx components; extract it into a single shared
utility (e.g., a new module) and have both components import and call that
single exported function. Move the existing implementation (including the checks
for types 'openai','anthropic','gemini','vertex' and the conditional return for
'openaicompatible'/'azure' based on useResponsesAPI) into the new exported
serviceSupportsNativeTools helper, remove the duplicate definitions from both
components, and update their imports to reference the new helper.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro
Run ID: 8ea23f89-f00a-4481-a635-82b8f95e51ca
📒 Files selected for processing (8)
bifrost/bifrost.gobifrost/bifrost_test.gobifrost/config.gobifrost/config_test.gobots/bot.gobots/bots_test.gowebapp/src/components/agents/tabs/config_tab.tsxwebapp/src/components/system_console/bot.tsx
|
This PR has been automatically labelled "stale" because it hasn't had recent activity. |
Summary
Fixes OpenAI Compatible and Azure services with Use Responses API disabled still routing through
/v1/responseswhen an agent had stale native tool configuration.Use Responses API=falseas a hard limit for native-tool-triggered Responses API routing.Validation:
go test ./bifrost -run 'Test(NativeToolsForService|NewFromServiceConfig(OpenAIForcesResponsesAPI|FiltersNativeTools|FiltersNativeToolsWhenResponsesAPIDisabled)|ShouldUseResponsesAPI)'go test ./bots -run 'TestHasNativeWebSearchEnabled'npm --prefix webapp run check-typesnpm --prefix webapp run lint -- --no-cacheNote: full
go test ./bifrost ./botsleaves existingTestEnvProxyRoutingfailing in this environment because the request is not tunneled through the configured proxy;./botspasses.Ticket Link
NONE
Screenshots
NONE
Release Note
Summary by CodeRabbit
Release Notes
Bug Fixes