Conversation
…creation - Added model eligibility checks to ensure automations can only use billable models (premium or BYOK). - Introduced new API endpoint to report model eligibility status for search spaces. - Updated frontend components to display eligibility alerts and disable creation options when models are not billable. - Enhanced automation creation forms to reflect model eligibility, preventing users from submitting invalid configurations. - Implemented server-side logic to capture and preserve model preferences across automation edits, ensuring consistent behavior during execution.
- Added useEffect to sync local assignments state with preferences when they change, ensuring the UI reflects the latest data. - Updated state initialization to use null instead of empty strings for clarity in role assignments. - Adjusted role assignment handling to correctly manage "unassigned" values and preserve Auto mode configuration during updates.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ 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 |
Description
Motivation and Context
FIX #
Screenshots
API Changes
Change Type
Testing Performed
Checklist
High-level PR Summary
This PR implements resource gates for automations to ensure they only run on billable models (premium global configurations or user-provided BYOK models). It introduces a model policy enforcement system that blocks automations from using free models or Auto mode, captures model configurations at creation time to insulate runs from later changes, and adds both backend validation and frontend UI gating. The implementation includes a new
/automations/model-eligibilityendpoint, model snapshot preservation in automation definitions, runtime enforcement in agent task dependencies, and comprehensive frontend alerts/disabled states when model requirements aren't met.⏱️ Estimated Review Time: 1-3 hours
💡 Review Order Suggestion
surfsense_backend/app/automations/services/model_policy.pysurfsense_backend/app/automations/schemas/definition/envelope.pysurfsense_backend/app/automations/schemas/definition/__init__.pysurfsense_backend/app/automations/actions/types.pysurfsense_backend/app/automations/api/automation.pysurfsense_backend/app/automations/services/automation.pysurfsense_backend/app/automations/services/__init__.pysurfsense_backend/app/automations/runtime/executor.pysurfsense_backend/app/automations/actions/agent_task/dependencies.pysurfsense_backend/app/automations/actions/agent_task/invoke.pysurfsense_backend/app/agents/multi_agent_chat/main_agent/tools/automation/create.pysurfsense_backend/app/agents/multi_agent_chat/subagents/builtins/deliverables/tools/generate_image.pysurfsense_backend/app/agents/multi_agent_chat/subagents/builtins/deliverables/tools/index.pysurfsense_backend/app/agents/multi_agent_chat/main_agent/runtime/factory.pysurfsense_backend/app/agents/multi_agent_chat/main_agent/runtime/agent_cache.pysurfsense_backend/tests/unit/automations/services/test_model_policy.pysurfsense_backend/tests/unit/automations/services/test_automation_service_policy.pysurfsense_backend/tests/unit/automations/actions/agent_task/test_dependencies.pysurfsense_backend/tests/unit/automations/runtime/test_executor_action_ctx.pysurfsense_backend/tests/unit/automations/schemas/definition/test_envelope.pysurfsense_backend/tests/unit/automations/services/__init__.pysurfsense_web/contracts/types/automation.types.tssurfsense_web/hooks/use-automation-model-eligibility.tssurfsense_web/lib/apis/automations-api.service.tssurfsense_web/lib/query-client/cache-keys.tssurfsense_web/app/dashboard/[search_space_id]/automations/components/automation-model-gate-alert.tsxsurfsense_web/app/dashboard/[search_space_id]/automations/components/automations-empty-state.tsxsurfsense_web/app/dashboard/[search_space_id]/automations/components/automations-header.tsxsurfsense_web/app/dashboard/[search_space_id]/automations/components/builder/automation-builder-form.tsxsurfsense_web/app/dashboard/[search_space_id]/automations/new/automation-new-content.tsxsurfsense_web/app/dashboard/[search_space_id]/automations/automations-content.tsxsurfsense_web/components/settings/llm-role-manager.tsxsurfsense_web/atoms/new-llm-config/new-llm-config-mutation.atoms.ts