Skip to content

[P1] Analyze → Approve → Format (Hybrid Issue Optimization) - LangChain Issue Intake #518

Description

@stranske

Summary

Two-phase issue optimization: LLM analyzes and suggests improvements, human approves via label, system applies suggestions using the Formatter (#1).

Reference

📋 Proposal Document: langchain-issue-intake-proposal.md - See Enhancement #4

Design Philosophy

Eliminates complex stateful conversation in favor of a simple two-phase flow that reuses the Formatter (#478).

Flow

Phase 1: Human labels issue with `agents:optimize`
         → LLM analyzes, posts comment with suggestions + embedded JSON
         → Human reviews suggestions

Phase 2: Human adds `agents:apply-suggestions` label
         → System extracts JSON from comment
         → Routes to Formatter (#1) with suggestions
         → Updates issue body
         → Removes labels, adds `agents:formatted`

Why Hybrid Over Multi-Turn Conversation

Aspect Original Hybrid
State management LangGraph state machine Stateless - JSON in comment
Human approval Implicit conversation Explicit label signal
Implementation Custom handler Reuses Formatter (#1)
Complexity 5-7 days 2-3 days

Tasks

  • Create scripts/langchain/issue_optimizer.py with analyzer chain
  • Create ANALYZE_ISSUE_PROMPT with agent limitations context
  • Create suggestion comment formatter with embedded JSON
  • Add workflow trigger for agents:optimize label (Phase 1)
  • Add workflow trigger for agents:apply-suggestions label (Phase 2)
  • Extract suggestions JSON and route to Formatter ([P1] Human → AGENT_ISSUE_TEMPLATE Formatter - LangChain Issue Intake #478)
  • Add label management (remove optimize/apply, add formatted)
  • Add tests for analyze and apply phases

Acceptance Criteria

  • agents:optimize triggers analysis comment with structured suggestions
  • Suggestions include task splitting, blocked task identification, objective criteria
  • Comment contains <- Updated WORKFLOW_OUTPUTS.md suggestions-json: {...} --> marker
  • agents:apply-suggestions extracts JSON and calls Formatter
  • Issue body updated with applied improvements
  • Labels cleaned up appropriately

Implementation Notes

Priority: P1 | Effort: 2-3 days

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions