Skip to content

[P1] Implement LeadAgent.assign_task() logic #100

Description

@frankbria

Overview

The Lead Agent's task assignment method is stubbed, preventing dynamic task allocation to worker agents.

Current State

File: codeframe/agents/lead_agent.py lines 590-591

def assign_task(self, task_id: int, agent_id: str) -> None:
    """Assign task to worker agent."""
    # TODO: Implement task assignment logic
    pass

Expected Behavior

  • Validate that task exists and is not already assigned
  • Validate that agent exists and is available
  • Update task assignment in database
  • Notify agent via WebSocket or internal message queue
  • Track assignment timestamp for bottleneck detection
  • Log assignment for audit trail

Implementation Requirements

  1. Query database to validate task and agent
  2. Update tasks table with assigned_to field
  3. Broadcast assignment event via WebSocket
  4. Handle errors (task not found, agent unavailable)
  5. Support reassignment (when agent fails)

Acceptance Criteria

  • Tasks successfully assigned to specific agents
  • Database updated with assignment information
  • WebSocket event broadcast to notify agents
  • Error handling for invalid task/agent IDs
  • Unit tests verify assignment logic
  • Integration tests verify end-to-end assignment flow

Priority

P1 - Critical: Required for multi-agent coordination.

References

  • User Documentation: CODEFRAME_USER_DOCUMENTATION.md lines 81-82
  • Issues Analysis: CODEFRAME_ISSUES_ANALYSIS.md lines 22-29

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions