mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-02-04 03:45:12 -05:00
## Summary This PR refactors the Human-In-The-Loop (HITL) review system backend to improve data handling and API consistency. ## Changes ### Backend Refactoring #### 1. **Block Output Schema Update** (`human_in_the_loop.py`) - Replaced single `reviewed_data` and `status` fields with separate `approved_data` and `rejected_data` outputs - This allows downstream blocks to handle approved vs rejected data differently without checking status - Simplified test outputs to match new schema #### 2. **Review Data Handling** (`human_review.py`) - Modified `get_or_create_human_review` to always return `review.payload` regardless of approval status - Previously returned `None` for rejected reviews, which could cause data loss - Now preserves reviewer-modified data for both approved and rejected cases #### 3. **API Route Simplification** (`review/routes.py`) - Streamlined review decision processing logic using ternary operator - Unified data handling for both approved and rejected reviews - Maintains backward compatibility while improving code clarity ## Why These Changes? - **Better Data Flow**: Separate output pins for approved/rejected data make workflow design more intuitive - **Data Preservation**: Rejected reviews can still pass modified data downstream for logging or alternative processing - **Cleaner API**: Simplified decision processing reduces code complexity and potential bugs ## Testing - All existing tests pass with updated schema - Backward compatibility maintained for existing workflows - Human review functionality verified in both approved and rejected scenarios ## Related This is the backend portion of changes from #11529, applied separately to the `feat/hitl` branch.