You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(platform): implement graph-level Safe Mode toggle for HITL blocks
## Summary
- Add graph-level `safe_mode` metadata field with auto-detection of HITL blocks
- Create floating Safe Mode toggle component with dual variants (builder/library)
- Update backend to accept `safe_mode` parameter in execution calls
- Fix hardcoded safe mode values throughout frontend codebase
- Enhance FloatingReviewsPanel with proper execution status detection
## Backend Changes
- **Database**: Add `metadata` JSON column to `AgentGraph` table
- **API**: Update `execute_graph` endpoint to accept `safe_mode` parameter
- **Execution**: Use graph metadata `safe_mode` as default, with API override capability
- **Auto-detection**: Populate `has_human_in_the_loop` for graphs containing HITL blocks
- **Utils**: Enhance execution context to prioritize API `safe_mode` over graph metadata
## Frontend Changes
- **Component**: New `FloatingSafeModeToggle` with white (library) and black (builder) variants
- **Integration**: Added toggles to new/old builders and library pages
- **API Integration**: Direct graph metadata updates via `usePutV1UpdateGraphVersion`
- **Query Management**: Optimistic updates with React Query cache invalidation
- **Styling**: Proper positioning and z-index handling for floating elements
## Technical Details
- Safe Mode ON (default): HITL blocks require manual review before proceeding
- Safe Mode OFF: HITL blocks execute automatically without intervention
- Toggle only appears when graph contains HITL blocks (`has_human_in_the_loop: true`)
- Backend API takes precedence over graph metadata for execution-time behavior
- React Query cache management ensures UI consistency across components
## Known Issues (WIP)
- Tooltip z-index still covered by some UI elements
- Toggle state not persisting correctly (always shows ON)
- Error when removing HITL blocks from graph
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
0 commit comments