Skip to content

CEO should reuse existing GitHub issues instead of creating duplicates #372

@lukeinglis

Description

@lukeinglis

Problem

When the CEO pipeline executes step 2c (Create GitHub Issue), it always creates a new issue, even when the hypothesis explicitly references an existing one (e.g., "issue #352"). This produces duplicate issues with near-identical content.

Example: Issue #352 already had a full spec for factory handoff. The CEO created #369 with the same content during the experiment pipeline, then #369 had to be closed as a duplicate.

Expected Behavior

Before creating a new issue, the CEO should:

  1. Check if the hypothesis text or backlog item references an existing issue number (e.g., #352, issue #352, Addresses: #352)
  2. If an existing issue is found, verify it's open: gh issue view <number> --json state
  3. If open, use that issue number as $ISSUE_NUM and skip creation
  4. Only create a new issue if no existing reference is found

Where to Fix

This is a prompt change in factory/agents/prompts/ceo.md, step 2c (Create GitHub Issue). Add a pre-check before the gh issue create block.

Acceptance Criteria

  • CEO checks for existing issue references before creating new issues
  • Existing open issues are reused, not duplicated
  • New issues are still created when no reference exists

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions