Skip to content

PDD agentic bug workflow creates duplicate prompt files in wrong directory structure #667

@Serhan-Asad

Description

@Serhan-Asad

Problem

The PDD agentic bug workflow incorrectly creates duplicate prompt files in the wrong directory structure when analyzing existing codebases.

Evidence from PR #645 in pdd_cloud

When running pdd bug https://github.com/promptdriven/pdd_cloud/issues/643, the workflow created:

✅ Correct (modified existing): prompts/frontend/app/settings/billing/page_TypescriptReact.prompt
❌ Duplicate (wrong location): frontend/prompts/frontend/app/settings/billing/page_TypescriptReact.prompt

Root Cause Analysis

The prompt file discovery logic in the agentic bug workflow appears to incorrectly assume prompt files should be in the same directory tree as the source code being analyzed.

Source file analyzed: frontend/src/app/settings/billing/page.tsx
Incorrectly created prompt at: frontend/prompts/frontend/app/settings/billing/page_TypescriptReact.prompt
Should have found existing: prompts/frontend/app/settings/billing/page_TypescriptReact.prompt

Impact

This creates:

  • Duplicate prompt files with identical content
  • Confusion about which is the "canonical" prompt
  • Repository pollution with incorrect file structures
  • Potential sync conflicts when different tools reference different copies
  • Breaks the established PDD project structure conventions

Expected Behavior

The agentic bug workflow should:

  1. Discover existing prompt files using the project's .pddrc configuration
  2. Respect the established directory structure (prompts/ not frontend/prompts/)
  3. Modify existing prompts rather than creating duplicates
  4. Use the same path resolution logic as pdd sync and other commands

Suspected Location

This bug is likely in one of these files:

  • pdd/agentic_bug_orchestrator.py - Step that creates/modifies prompt files
  • pdd/construct_paths.py - Path resolution and discovery logic
  • pdd/prompts/agentic_bug_step*.prompt - The LLM prompt that handles prompt file creation

Reproduction Steps

  1. Run pdd bug <issue-url> on any issue that requires modifying existing frontend modules
  2. Check if duplicate prompt files are created in frontend/prompts/ vs prompts/frontend/
  3. Observe incorrect directory structure in the generated PR

Project Context

This was discovered while fixing CORS issues in pdd_cloud settings billing page:

Fix Requirements

The agentic bug workflow must use the same prompt discovery logic as other PDD commands to:

  • Find existing prompt files correctly via .pddrc configuration
  • Respect established directory conventions
  • Never create duplicate prompt files in alternative locations

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions