Repository navigation
feat(llc): agent-to-human handoff — KB brief generation, reviewer notification (#8231) - #8511
Conversation
✅ SSOT Configuration Compliance: Passing🎉 No hardcoded values detected that have SSOT config equivalents! |
…8231) - Add reviewer_user_id, reviewer_agent_id, review_brief fields to LLCWorkItem - Add WORK_ITEM_HANDOFF/REVIEW_APPROVED/REVIEW_CHANGES_REQUESTED ActivityEventType values - Implement HandoffService with agent_to_human(), approve(), request_changes(), get_brief() - Phase 4 brief stub: structured summary from work item fields + comments - Notify llc:notifications:{company_id} on handoff with reviewer targeting - Add 4 API routes: POST handoff/to-human, POST review/approve, POST review/request-changes, GET handoff-brief - 22 unit tests — all passing Co-Authored-By: Paperclip <noreply@paperclip.ing>
Code Review — PR #8511: Agent→Human HandoffVerdict: Changes Requested — 2 blocking issues must be fixed before merge; 4 high-severity findings should also be addressed. BLOCKING: Critical Issues1. Alembic migration branch conflict — new columns never created in production
The migration never runs, so Fix: Rebase migration onto the correct down_revision (current chain tail after merging adjacent PRs). 2. Migration only adds
|
| # | Severity | Issue |
|---|---|---|
| 1 | BLOCKING | Alembic branch conflict — migration never runs |
| 2 | BLOCKING | Migration missing reviewer_user_id / reviewer_agent_id columns |
| 3 | HIGH | lazy_singleton no activity_log — all audit events dead in production |
| 4 | HIGH | approve() doesn't clear reviewer_user_id |
| 5 | HIGH | agent_to_human() no status guard — DONE items can be re-handed-off |
| 6 | HIGH | Activity log on shared session silently corrupts transaction |
| 7 | MEDIUM | redis.delete unguarded after flush |
| 8 | MEDIUM | _publish_a2h_notification swallows at debug level |
| 9 | MEDIUM | GET /handoff-brief no auth (IDOR) |
| 10 | LOW | reviewer_agent_id declared but never written |
Core logic and 22-test coverage are solid. Fix #1 and #2 before merge; track #3–#6 with issues.
Summary
LLCWorkItemwithreviewer_user_id,reviewer_agent_id,review_brief(JSONB)HandoffServicewith full agent→human handoff lifecycle (checkout validation, brief stub, lock release, Redis notification, activity log)POST /handoff/to-human,POST /review/approve,POST /review/request-changes,GET /handoff-briefTest plan
python -m pytest autobot-backend/llc/ -k handoff_to_human→ 22 passedHandoffNotAllowedraised when agent does not hold checkoutstatus=IN_REVIEW,reviewer_user_idset after successful handoffllc:notifications:{company_id}status=DONE; request-changes reverts toIN_PROGRESSwith commentCloses #8231
🤖 Generated with Claude Code