Skip to content

Issue discussion agent fails to handoff to issue management agent for description updates

Problem

The issue discussion agent incorrectly claims it cannot update issue descriptions instead of handing off to the issue management agent who has this capability.

Current Behavior

When a user requests "update the description", the issue discussion agent:

  1. Posts a comment saying it cannot modify issue descriptions
  2. Tells the user to manually update via GitLab's web interface
  3. Never attempts to transfer to the issue management agent

Expected Behavior

The agent should recognize this is an issue management task and transfer to the appropriate agent:

User: "update the description"
→ issue_discussion_agent recognizes this is an issue management task
→ transfer_to_issue_management_agent
→ issue_management_agent updates the description

Root Cause

The issue discussion agent fails to recognize that issue metadata updates (description, title, labels, etc.) should be delegated to the issue management agent, even though it has the handoff capability available.

Implementation Task List

Phase 1: Analysis and Documentation

  • Document all issue-related actions that should trigger handoff to issue management agent
    • Description updates
    • Title changes
    • Label modifications
    • Assignee changes
    • Milestone updates
    • State changes (close/reopen)
  • Review existing handoff patterns between discussion and management agents
  • Identify similar problems in MR discussion agent

Phase 2: Update Agent Prompts/Instructions

  • Update issue_discussion_agent prompt to include explicit handoff rules
    • Add section: "When to Transfer to Issue Management Agent"
    • List specific keywords/phrases that should trigger handoff
    • Emphasize: attempt handoff before claiming inability
  • Update merge_request_discussion_agent with similar rules
  • Add examples of proper handoff scenarios in prompts

Phase 2.5: Standardize Agent Prompts (Additional Work)

  • Enhance issue_management_agent with detailed execution framework
  • Enhance merge_request_management_agent with detailed execution framework
  • Ensure consistent structure across all agent types
  • Add explicit tool documentation to management agents
  • Include error handling and example formats

Phase 3: Implement Handoff Logic

  • Add explicit routing logic in issue_discussion_agent
    • Pattern matching for issue management requests (via prompts)
    • Check for keywords: "update description", "change title", "add label", etc.
    • Implement decision tree: can I do this? → if no, who can? → handoff
  • Ensure handoff includes context about what needs to be updated
  • Add similar logic to merge_request_discussion_agent

Phase 4: Testing ⚠️ (Requires LLM API - Tracked Separately)

  • Test description update requests
    • "update the description"
    • "change the issue description to..."
    • "modify the description"
  • Test other metadata update requests
    • Title changes
    • Label additions/removals
    • Assignee changes
  • Verify handoff messages include sufficient context
  • Test edge cases where handoff might not be appropriate

Phase 5: Validation and Monitoring ⚠️ (Requires LLM API - Tracked Separately)

  • Review logs to ensure handoffs are occurring correctly
  • Monitor for cases where agents still claim inability incorrectly
  • Gather metrics on handoff success rates
  • Document any remaining limitations

Implementation Status

Completed

  • Core Fix Implemented: Discussion agents now have explicit handoff rules
  • Agent Prompts Enhanced: All agents follow consistent, detailed structures
  • Handoff Logic Added: Through comprehensive prompt instructions
  • Pattern Matching: Implemented via keyword lists in prompts

⚠️ Testing Required

  • Testing phases require LLM API infrastructure
  • Should be tracked in a separate issue for API-dependent testing

Success Criteria

  • Handoff rules implemented in discussion agents
  • Clear instructions to prevent "I cannot do this" responses
  • Handoff patterns documented with examples
  • Testing and validation (requires separate issue)

Related Issues

  • #103 (closed) - The issue management agent is missing the update_issue_content tool (blocked by this)
  • #104 (closed) - Improve agent handoff messages and descriptions (complementary improvement)
  • TODO: Create issue for LLM API testing infrastructure

Notes

The core bug fix is complete. The agents now have proper instructions to handoff management tasks instead of claiming inability. Testing will need to be done once LLM API testing infrastructure is available.

Edited by Jean-Marc Le Roux