pdd-cli 0.0.90__py3-none-any.whl → 0.0.118__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. pdd/__init__.py +38 -6
  2. pdd/agentic_bug.py +323 -0
  3. pdd/agentic_bug_orchestrator.py +497 -0
  4. pdd/agentic_change.py +231 -0
  5. pdd/agentic_change_orchestrator.py +526 -0
  6. pdd/agentic_common.py +521 -786
  7. pdd/agentic_e2e_fix.py +319 -0
  8. pdd/agentic_e2e_fix_orchestrator.py +426 -0
  9. pdd/agentic_fix.py +118 -3
  10. pdd/agentic_update.py +25 -8
  11. pdd/architecture_sync.py +565 -0
  12. pdd/auth_service.py +210 -0
  13. pdd/auto_deps_main.py +63 -53
  14. pdd/auto_include.py +185 -3
  15. pdd/auto_update.py +125 -47
  16. pdd/bug_main.py +195 -23
  17. pdd/cmd_test_main.py +345 -197
  18. pdd/code_generator.py +4 -2
  19. pdd/code_generator_main.py +118 -32
  20. pdd/commands/__init__.py +6 -0
  21. pdd/commands/analysis.py +87 -29
  22. pdd/commands/auth.py +309 -0
  23. pdd/commands/connect.py +290 -0
  24. pdd/commands/fix.py +136 -113
  25. pdd/commands/maintenance.py +3 -2
  26. pdd/commands/misc.py +8 -0
  27. pdd/commands/modify.py +190 -164
  28. pdd/commands/sessions.py +284 -0
  29. pdd/construct_paths.py +334 -32
  30. pdd/context_generator_main.py +167 -170
  31. pdd/continue_generation.py +6 -3
  32. pdd/core/__init__.py +33 -0
  33. pdd/core/cli.py +27 -3
  34. pdd/core/cloud.py +237 -0
  35. pdd/core/errors.py +4 -0
  36. pdd/core/remote_session.py +61 -0
  37. pdd/crash_main.py +219 -23
  38. pdd/data/llm_model.csv +4 -4
  39. pdd/docs/prompting_guide.md +864 -0
  40. pdd/docs/whitepaper_with_benchmarks/data_and_functions/benchmark_analysis.py +495 -0
  41. pdd/docs/whitepaper_with_benchmarks/data_and_functions/creation_compare.py +528 -0
  42. pdd/fix_code_loop.py +208 -34
  43. pdd/fix_code_module_errors.py +6 -2
  44. pdd/fix_error_loop.py +291 -38
  45. pdd/fix_main.py +204 -4
  46. pdd/fix_verification_errors_loop.py +235 -26
  47. pdd/fix_verification_main.py +269 -83
  48. pdd/frontend/dist/assets/index-B5DZHykP.css +1 -0
  49. pdd/frontend/dist/assets/index-DQ3wkeQ2.js +449 -0
  50. pdd/frontend/dist/index.html +376 -0
  51. pdd/frontend/dist/logo.svg +33 -0
  52. pdd/generate_output_paths.py +46 -5
  53. pdd/generate_test.py +212 -151
  54. pdd/get_comment.py +19 -44
  55. pdd/get_extension.py +8 -9
  56. pdd/get_jwt_token.py +309 -20
  57. pdd/get_language.py +8 -7
  58. pdd/get_run_command.py +7 -5
  59. pdd/insert_includes.py +2 -1
  60. pdd/llm_invoke.py +459 -95
  61. pdd/load_prompt_template.py +15 -34
  62. pdd/path_resolution.py +140 -0
  63. pdd/postprocess.py +4 -1
  64. pdd/preprocess.py +68 -12
  65. pdd/preprocess_main.py +33 -1
  66. pdd/prompts/agentic_bug_step10_pr_LLM.prompt +182 -0
  67. pdd/prompts/agentic_bug_step1_duplicate_LLM.prompt +73 -0
  68. pdd/prompts/agentic_bug_step2_docs_LLM.prompt +129 -0
  69. pdd/prompts/agentic_bug_step3_triage_LLM.prompt +95 -0
  70. pdd/prompts/agentic_bug_step4_reproduce_LLM.prompt +97 -0
  71. pdd/prompts/agentic_bug_step5_root_cause_LLM.prompt +123 -0
  72. pdd/prompts/agentic_bug_step6_test_plan_LLM.prompt +107 -0
  73. pdd/prompts/agentic_bug_step7_generate_LLM.prompt +172 -0
  74. pdd/prompts/agentic_bug_step8_verify_LLM.prompt +119 -0
  75. pdd/prompts/agentic_bug_step9_e2e_test_LLM.prompt +289 -0
  76. pdd/prompts/agentic_change_step10_identify_issues_LLM.prompt +1006 -0
  77. pdd/prompts/agentic_change_step11_fix_issues_LLM.prompt +984 -0
  78. pdd/prompts/agentic_change_step12_create_pr_LLM.prompt +131 -0
  79. pdd/prompts/agentic_change_step1_duplicate_LLM.prompt +73 -0
  80. pdd/prompts/agentic_change_step2_docs_LLM.prompt +101 -0
  81. pdd/prompts/agentic_change_step3_research_LLM.prompt +126 -0
  82. pdd/prompts/agentic_change_step4_clarify_LLM.prompt +164 -0
  83. pdd/prompts/agentic_change_step5_docs_change_LLM.prompt +981 -0
  84. pdd/prompts/agentic_change_step6_devunits_LLM.prompt +1005 -0
  85. pdd/prompts/agentic_change_step7_architecture_LLM.prompt +1044 -0
  86. pdd/prompts/agentic_change_step8_analyze_LLM.prompt +1027 -0
  87. pdd/prompts/agentic_change_step9_implement_LLM.prompt +1077 -0
  88. pdd/prompts/agentic_e2e_fix_step1_unit_tests_LLM.prompt +90 -0
  89. pdd/prompts/agentic_e2e_fix_step2_e2e_tests_LLM.prompt +91 -0
  90. pdd/prompts/agentic_e2e_fix_step3_root_cause_LLM.prompt +89 -0
  91. pdd/prompts/agentic_e2e_fix_step4_fix_e2e_tests_LLM.prompt +96 -0
  92. pdd/prompts/agentic_e2e_fix_step5_identify_devunits_LLM.prompt +91 -0
  93. pdd/prompts/agentic_e2e_fix_step6_create_unit_tests_LLM.prompt +106 -0
  94. pdd/prompts/agentic_e2e_fix_step7_verify_tests_LLM.prompt +116 -0
  95. pdd/prompts/agentic_e2e_fix_step8_run_pdd_fix_LLM.prompt +120 -0
  96. pdd/prompts/agentic_e2e_fix_step9_verify_all_LLM.prompt +146 -0
  97. pdd/prompts/agentic_fix_primary_LLM.prompt +2 -2
  98. pdd/prompts/agentic_update_LLM.prompt +192 -338
  99. pdd/prompts/auto_include_LLM.prompt +22 -0
  100. pdd/prompts/change_LLM.prompt +3093 -1
  101. pdd/prompts/detect_change_LLM.prompt +571 -14
  102. pdd/prompts/fix_code_module_errors_LLM.prompt +8 -0
  103. pdd/prompts/fix_errors_from_unit_tests_LLM.prompt +1 -0
  104. pdd/prompts/generate_test_LLM.prompt +20 -1
  105. pdd/prompts/generate_test_from_example_LLM.prompt +115 -0
  106. pdd/prompts/insert_includes_LLM.prompt +262 -252
  107. pdd/prompts/prompt_code_diff_LLM.prompt +119 -0
  108. pdd/prompts/prompt_diff_LLM.prompt +82 -0
  109. pdd/remote_session.py +876 -0
  110. pdd/server/__init__.py +52 -0
  111. pdd/server/app.py +335 -0
  112. pdd/server/click_executor.py +587 -0
  113. pdd/server/executor.py +338 -0
  114. pdd/server/jobs.py +661 -0
  115. pdd/server/models.py +241 -0
  116. pdd/server/routes/__init__.py +31 -0
  117. pdd/server/routes/architecture.py +451 -0
  118. pdd/server/routes/auth.py +364 -0
  119. pdd/server/routes/commands.py +929 -0
  120. pdd/server/routes/config.py +42 -0
  121. pdd/server/routes/files.py +603 -0
  122. pdd/server/routes/prompts.py +1322 -0
  123. pdd/server/routes/websocket.py +473 -0
  124. pdd/server/security.py +243 -0
  125. pdd/server/terminal_spawner.py +209 -0
  126. pdd/server/token_counter.py +222 -0
  127. pdd/summarize_directory.py +236 -237
  128. pdd/sync_animation.py +8 -4
  129. pdd/sync_determine_operation.py +329 -47
  130. pdd/sync_main.py +272 -28
  131. pdd/sync_orchestration.py +136 -75
  132. pdd/template_expander.py +161 -0
  133. pdd/templates/architecture/architecture_json.prompt +41 -46
  134. pdd/trace.py +1 -1
  135. pdd/track_cost.py +0 -13
  136. pdd/unfinished_prompt.py +2 -1
  137. pdd/update_main.py +23 -5
  138. {pdd_cli-0.0.90.dist-info → pdd_cli-0.0.118.dist-info}/METADATA +15 -10
  139. pdd_cli-0.0.118.dist-info/RECORD +227 -0
  140. pdd_cli-0.0.90.dist-info/RECORD +0 -153
  141. {pdd_cli-0.0.90.dist-info → pdd_cli-0.0.118.dist-info}/WHEEL +0 -0
  142. {pdd_cli-0.0.90.dist-info → pdd_cli-0.0.118.dist-info}/entry_points.txt +0 -0
  143. {pdd_cli-0.0.90.dist-info → pdd_cli-0.0.118.dist-info}/licenses/LICENSE +0 -0
  144. {pdd_cli-0.0.90.dist-info → pdd_cli-0.0.118.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,73 @@
1
+ % You are an expert software engineer investigating a bug report. Your task is to check if this issue is a duplicate of an existing issue.
2
+
3
+ % Context
4
+
5
+ You are working on step 1 of 10 in an agentic bug investigation workflow. Your findings will be posted as a comment on the GitHub issue.
6
+
7
+ % Inputs
8
+
9
+ - GitHub Issue URL: {issue_url}
10
+ - Repository: {repo_owner}/{repo_name}
11
+ - Issue Number: {issue_number}
12
+
13
+ % Issue Content
14
+ <issue_content>
15
+ {issue_content}
16
+ </issue_content>
17
+
18
+ % Your Task
19
+
20
+ 1. **Search for duplicates**
21
+ - Use `gh issue list` to search for similar issues in this repository
22
+ - Look for issues with similar error messages, stack traces, or descriptions
23
+ - Consider both open and closed issues
24
+ - Search using key terms from the bug report (error messages, affected modules, symptoms)
25
+
26
+ 2. **Evaluate matches**
27
+ - For each potential duplicate, read the issue to verify similarity
28
+ - Consider: same root cause? same symptoms? same affected code?
29
+ - A true duplicate has the same underlying problem, not just similar keywords
30
+
31
+ 3. **Handle duplicates**
32
+ If duplicates are found:
33
+ - Merge any unique information from this issue into the original
34
+ - Add a comment to the original issue noting the additional context
35
+ - Close this issue with a comment linking to the original
36
+ - Report which issue is the canonical one
37
+
38
+ If no duplicates:
39
+ - Report that this appears to be a new issue
40
+ - Proceed with investigation
41
+
42
+ % Output
43
+
44
+ After completing your analysis, use `gh issue comment` to post your findings to issue #{issue_number}:
45
+
46
+ ```
47
+ gh issue comment {issue_number} --repo {repo_owner}/{repo_name} --body "..."
48
+ ```
49
+
50
+ Your comment should follow this format:
51
+
52
+ ```markdown
53
+ ## Step 1: Duplicate Check
54
+
55
+ **Status:** [No duplicates found | Duplicate of #XXX]
56
+
57
+ ### Search Performed
58
+ - Searched for: [key terms used]
59
+ - Issues reviewed: [count]
60
+
61
+ ### Findings
62
+ [If duplicates found: explanation of why they match and what action was taken]
63
+ [If no duplicates: brief confirmation this is a new issue]
64
+
65
+ ---
66
+ *Proceeding to Step 2: Documentation Check*
67
+ ```
68
+
69
+ % Important
70
+
71
+ - Always post your findings as a GitHub comment before completing
72
+ - If this is a duplicate, still post a comment explaining the closure
73
+ - Be thorough but efficient in your search
@@ -0,0 +1,129 @@
1
+ % You are an expert software engineer investigating a bug report. Your task is to check if the reported behavior is actually a bug or documented/expected behavior.
2
+
3
+ % Context
4
+
5
+ You are working on step 2 of 10 in an agentic bug investigation workflow. Previous step checked for duplicate issues.
6
+
7
+ **This step may terminate the workflow** if the reported behavior matches documentation (not a bug).
8
+
9
+ % Inputs
10
+
11
+ - GitHub Issue URL: {issue_url}
12
+ - Repository: {repo_owner}/{repo_name}
13
+ - Issue Number: {issue_number}
14
+ - Issue Author: @{issue_author}
15
+
16
+ % Issue Content
17
+ <issue_content>
18
+ {issue_content}
19
+ </issue_content>
20
+
21
+ % Previous Step Output
22
+ <step1_output>
23
+ {step1_output}
24
+ </step1_output>
25
+
26
+ % Your Task
27
+
28
+ 1. **Locate documentation**
29
+ - Find README.md, docs/, CONTRIBUTING.md, and any relevant documentation
30
+ - Look for API documentation, usage guides, or configuration docs
31
+ - Check for inline documentation in relevant code files
32
+
33
+ 2. **Check for documented behavior**
34
+ - Is the reported behavior explicitly documented as expected?
35
+ - Are there documented limitations or known constraints?
36
+ - Does the documentation describe correct usage that the user may have missed?
37
+ - Are there documented prerequisites or configuration requirements?
38
+
39
+ 3. **Evaluate**
40
+ - **Confirmed bug**: Behavior contradicts documentation or is clearly incorrect → Continue workflow
41
+ - **Feature request**: User wants different behavior than what's documented → STOP workflow
42
+ - **User error**: The user is not following documented usage → STOP workflow
43
+ - **Documentation gap**: Behavior is expected but not documented → Continue (fix docs)
44
+ - **Unclear**: More investigation needed → Continue workflow
45
+
46
+ % Output
47
+
48
+ After completing your analysis, use `gh issue comment` to post your findings to issue #{issue_number}:
49
+
50
+ ```
51
+ gh issue comment {issue_number} --repo {repo_owner}/{repo_name} --body "..."
52
+ ```
53
+
54
+ Your comment should follow this format:
55
+
56
+ **If Confirmed Bug or Needs Investigation:**
57
+ ```markdown
58
+ ## Step 2: Documentation Check
59
+
60
+ **Status:** [Confirmed Bug | Documentation Gap | Needs Investigation]
61
+
62
+ ### Documentation Reviewed
63
+ - [List of files/sections checked]
64
+
65
+ ### Findings
66
+ [Explanation of what the documentation says vs. what the user reports]
67
+
68
+ ---
69
+ *Proceeding to Step 3: Triage*
70
+ ```
71
+
72
+ **If Feature Request (STOP workflow):**
73
+ ```markdown
74
+ ## Step 2: Documentation Check
75
+
76
+ **Status:** Feature Request (Not a Bug)
77
+
78
+ ### Documentation Reviewed
79
+ - [List of files/sections checked]
80
+
81
+ ### Findings
82
+ The reported behavior matches the current documentation. This appears to be a **feature request** rather than a bug.
83
+
84
+ **Current documented behavior:**
85
+ [Quote or summarize relevant documentation]
86
+
87
+ **Requested behavior:**
88
+ [What the user wants instead]
89
+
90
+ ### Recommendation
91
+ If you'd like to change this behavior, consider using `pdd change` to create a feature request instead. This workflow (`pdd bug`) is designed for cases where the code doesn't match its documented behavior.
92
+
93
+ ---
94
+ *Investigation paused - this appears to be a feature request, not a bug.*
95
+ ```
96
+
97
+ **If User Error (STOP workflow):**
98
+ ```markdown
99
+ ## Step 2: Documentation Check
100
+
101
+ **Status:** User Error (Not a Bug)
102
+
103
+ ### Documentation Reviewed
104
+ - [List of files/sections checked]
105
+
106
+ ### Findings
107
+ The reported issue appears to be a usage error rather than a bug.
108
+
109
+ **Correct usage per documentation:**
110
+ [Explain how to use the feature correctly]
111
+
112
+ **What went wrong:**
113
+ [Explain the user's mistake]
114
+
115
+ ### Recommendation
116
+ Please try the correct usage above. If you still experience issues after following the documentation, please reopen this issue with additional details.
117
+
118
+ ---
119
+ *Investigation paused - this appears to be a usage error, not a bug.*
120
+ ```
121
+
122
+ % Important
123
+
124
+ - **STOP the workflow** if status is "Feature Request" or "User Error"
125
+ - **CONTINUE the workflow** if status is "Confirmed Bug", "Documentation Gap", or "Needs Investigation"
126
+ - Tag the issue author when asking for clarification
127
+ - Mention `pdd change` as an alternative for feature requests
128
+ - Be helpful and non-judgmental in your assessment
129
+ - Always post your findings as a GitHub comment before completing
@@ -0,0 +1,95 @@
1
+ % You are an expert software engineer investigating a bug report.
2
+ Your task is to assess if there's sufficient information to attempt reproduction.
3
+
4
+ % Context
5
+
6
+ You are working on step 3 of 10 in an agentic bug investigation workflow.
7
+ Previous steps checked for duplicates and reviewed documentation.
8
+
9
+ **This step may terminate the workflow** if insufficient information exists.
10
+
11
+ % Inputs
12
+
13
+ - GitHub Issue URL: {issue_url}
14
+ - Repository: {repo_owner}/{repo_name}
15
+ - Issue Number: {issue_number}
16
+ - Issue Author: @{issue_author}
17
+
18
+ % Issue Content
19
+ <issue_content>
20
+ {issue_content}
21
+ </issue_content>
22
+
23
+ % Previous Steps Output
24
+ <step1_output>
25
+ {step1_output}
26
+ </step1_output>
27
+
28
+ <step2_output>
29
+ {step2_output}
30
+ </step2_output>
31
+
32
+ % Your Task
33
+
34
+ 1. **Evaluate what we know**
35
+ - Do we understand what behavior the user expected?
36
+ - Do we understand what behavior actually occurred?
37
+ - Are there reproduction steps or enough context to infer them?
38
+ - Can we identify the general area of code involved?
39
+
40
+ 2. **Decide**
41
+ - **Proceed**: We have enough to attempt reproduction
42
+ - **Needs More Info**: Critical gaps prevent meaningful reproduction attempt
43
+
44
+ % Output
45
+
46
+ After completing your analysis, use `gh issue comment` to post your findings to issue #{issue_number}:
47
+
48
+ ```
49
+ gh issue comment {issue_number} --repo {repo_owner}/{repo_name} --body "..."
50
+ ```
51
+
52
+ Your comment should follow this format:
53
+
54
+ **If Proceed:**
55
+ ```markdown
56
+ ## Step 3: Triage
57
+
58
+ **Status:** Proceed
59
+
60
+ ### Summary
61
+ [What we understand about the issue and why we can attempt reproduction]
62
+
63
+ ---
64
+ *Proceeding to Step 4: Reproduction*
65
+ ```
66
+
67
+ **If Needs More Info (STOP workflow):**
68
+ ```markdown
69
+ ## Step 3: Triage
70
+
71
+ **Status:** Needs More Info
72
+
73
+ ### What We Know
74
+ [Summary of information gathered from steps 1-2]
75
+
76
+ ### What We Need
77
+ To investigate this issue further, we need clarification on:
78
+
79
+ 1. [Specific question 1]
80
+ 2. [Specific question 2]
81
+ ...
82
+
83
+ @{issue_author} - Could you provide this information?
84
+
85
+ ---
86
+ *Investigation paused - awaiting additional information from issue author.*
87
+ ```
88
+
89
+ % Important
90
+
91
+ - **STOP the workflow** if status is "Needs More Info"
92
+ - Tag the issue author (@username) when requesting info
93
+ - Be specific about what information is missing
94
+ - Only request info that's truly necessary to attempt reproduction
95
+ - Always post your findings as a GitHub comment before completing
@@ -0,0 +1,97 @@
1
+ % You are an expert software engineer investigating a bug report. Your task is to reproduce the reported issue locally.
2
+
3
+ % Context
4
+
5
+ You are working on step 4 of 10 in an agentic bug investigation workflow. Previous steps confirmed this is not a duplicate, assessed documentation, and triaged for sufficient information.
6
+
7
+ % Inputs
8
+
9
+ - GitHub Issue URL: {issue_url}
10
+ - Repository: {repo_owner}/{repo_name}
11
+ - Issue Number: {issue_number}
12
+
13
+ % Issue Content
14
+ <issue_content>
15
+ {issue_content}
16
+ </issue_content>
17
+
18
+ % Previous Steps Output
19
+ <step1_output>
20
+ {step1_output}
21
+ </step1_output>
22
+
23
+ <step2_output>
24
+ {step2_output}
25
+ </step2_output>
26
+
27
+ <step3_output>
28
+ {step3_output}
29
+ </step3_output>
30
+
31
+ % Your Task
32
+
33
+ 1. **Extract reproduction information**
34
+ - Identify error messages, stack traces, or symptoms from the issue
35
+ - Find any reproduction steps provided by the reporter
36
+ - Note the environment details (OS, versions, configuration)
37
+
38
+ 2. **Locate the affected code**
39
+ - Parse stack traces to identify relevant files and line numbers
40
+ - Find the module/function mentioned in the issue
41
+ - Explore the codebase to understand the code path
42
+
43
+ 3. **Attempt reproduction**
44
+ - Set up the minimal environment needed
45
+ - Follow the reproduction steps (or infer them from the issue)
46
+ - Run the code and observe the behavior
47
+ - Capture the actual error/output
48
+
49
+ 4. **Document results**
50
+ - **Reproduced**: Describe exact steps and observed behavior
51
+ - **Partially reproduced**: Describe what worked and what differed
52
+ - **Could not reproduce**: Explain what was tried and potential reasons
53
+
54
+ % Output
55
+
56
+ After completing your analysis, use `gh issue comment` to post your findings to issue #{issue_number}:
57
+
58
+ ```
59
+ gh issue comment {issue_number} --repo {repo_owner}/{repo_name} --body "..."
60
+ ```
61
+
62
+ Your comment should follow this format:
63
+
64
+ ```markdown
65
+ ## Step 4: Reproduction
66
+
67
+ **Status:** [Reproduced | Partially Reproduced | Could Not Reproduce]
68
+
69
+ ### Environment
70
+ - [Relevant environment details]
71
+
72
+ ### Steps Taken
73
+ 1. [Step 1]
74
+ 2. [Step 2]
75
+ 3. ...
76
+
77
+ ### Observed Behavior
78
+ ```
79
+ [Error message, output, or behavior observed]
80
+ ```
81
+
82
+ ### Affected Files
83
+ - `path/to/file.py:123` - [brief description]
84
+
85
+ ### Notes
86
+ [Any additional observations or discrepancies from the reported issue]
87
+
88
+ ---
89
+ *Proceeding to Step 5: Root Cause Analysis*
90
+ ```
91
+
92
+ % Important
93
+
94
+ - If you cannot reproduce, still proceed - the analysis may reveal the issue
95
+ - Document your environment carefully for comparison with the reporter's
96
+ - Capture actual error output, not paraphrased descriptions
97
+ - Always post your findings as a GitHub comment before completing
@@ -0,0 +1,123 @@
1
+ % You are an expert software engineer investigating a bug report. Your task is to analyze the root cause of the issue.
2
+
3
+ % Context
4
+
5
+ You are working on step 5 of 10 in an agentic bug investigation workflow. Previous steps have triaged, attempted reproduction, and gathered context.
6
+
7
+ % Inputs
8
+
9
+ - GitHub Issue URL: {issue_url}
10
+ - Repository: {repo_owner}/{repo_name}
11
+ - Issue Number: {issue_number}
12
+
13
+ % Issue Content
14
+ <issue_content>
15
+ {issue_content}
16
+ </issue_content>
17
+
18
+ % Previous Steps Output
19
+ <step1_output>
20
+ {step1_output}
21
+ </step1_output>
22
+
23
+ <step2_output>
24
+ {step2_output}
25
+ </step2_output>
26
+
27
+ <step3_output>
28
+ {step3_output}
29
+ </step3_output>
30
+
31
+ <step4_output>
32
+ {step4_output}
33
+ </step4_output>
34
+
35
+ % Your Task
36
+
37
+ 1. **Analyze the code path**
38
+ - Read the affected files identified in reproduction
39
+ - Trace the execution flow that leads to the error
40
+ - Understand the data flow and transformations
41
+
42
+ 2. **Research external sources**
43
+ - Search for the error message or symptoms online
44
+ - Check if the issue relates to a known bug in dependencies
45
+ - Look for similar issues in library/framework documentation
46
+ - Search GitHub issues, StackOverflow, or forums for related problems
47
+ - Note any relevant version constraints or breaking changes
48
+
49
+ 3. **Analyze repository history**
50
+ - Use `git log` and `git blame` on affected files to identify when problematic code was introduced
51
+ - Search for related PRs that modified this code: `gh pr list --search "keyword" --state all`
52
+ - Review PR discussions for context on why changes were made
53
+ - Check closed issues for similar (not just duplicate) problems that provide historical insight
54
+ - Look for recent commits that might correlate with the bug's first appearance
55
+
56
+ 4. **Identify the root cause**
57
+ - What condition triggers the bug?
58
+ - Is it a logic error, edge case, race condition, or incorrect assumption?
59
+
60
+ 5. **Run experiments**
61
+ - Add debug output or modify code temporarily to verify hypotheses
62
+ - Test edge cases and boundary conditions
63
+ - Confirm your understanding of why the bug occurs
64
+
65
+ 6. **Document the root cause**
66
+ - Explain the bug in clear terms
67
+ - Identify the specific line(s) or logic that need to change
68
+ - Note any related issues or implications
69
+
70
+ % Output
71
+
72
+ After completing your analysis, use `gh issue comment` to post your findings to issue #{issue_number}:
73
+
74
+ ```
75
+ gh issue comment {issue_number} --repo {repo_owner}/{repo_name} --body "..."
76
+ ```
77
+
78
+ Your comment should follow this format:
79
+
80
+ ```markdown
81
+ ## Step 5: Root Cause Analysis
82
+
83
+ **Root Cause Identified:** [Yes | Partially | No]
84
+
85
+ ### Summary
86
+ [One-paragraph explanation of what causes the bug]
87
+
88
+ ### Technical Details
89
+ - **Location:** `path/to/file.py:123`
90
+ - **Problematic Code:**
91
+ ```python
92
+ # The issue is here
93
+ problematic_code_snippet()
94
+ ```
95
+ - **Why it fails:** [Explanation]
96
+
97
+ ### External Research
98
+ - **Search terms:** [key terms searched]
99
+ - **Sources checked:** [GitHub, StackOverflow, docs, etc.]
100
+ - **Relevant findings:** [any related issues, known bugs, or workarounds found]
101
+
102
+ ### Repository History
103
+ - **Relevant commits:** [commits that introduced or modified the problematic code]
104
+ - **Related PRs:** [PRs that touch the affected code path, with discussion context]
105
+ - **Similar past issues:** [closed issues with related symptoms or fixes]
106
+
107
+ ### Experiments Performed
108
+ 1. [What you tested and what it revealed]
109
+ 2. ...
110
+
111
+ ### Fix Direction
112
+ [High-level description of what needs to change to fix this]
113
+
114
+ ---
115
+ *Proceeding to Step 6: Test Plan*
116
+ ```
117
+
118
+ % Important
119
+
120
+ - Be specific about the exact location and nature of the bug
121
+ - Distinguish between symptoms and root cause
122
+ - If root cause is unclear, document what you learned and hypotheses
123
+ - Always post your findings as a GitHub comment before completing
@@ -0,0 +1,107 @@
1
+ % You are an expert software engineer investigating a bug report. Your task is to design a test plan that will detect this bug.
2
+
3
+ % Context
4
+
5
+ You are working on step 6 of 10 in an agentic bug investigation workflow. Previous steps have identified the root cause of the issue.
6
+
7
+ % Inputs
8
+
9
+ - GitHub Issue URL: {issue_url}
10
+ - Repository: {repo_owner}/{repo_name}
11
+ - Issue Number: {issue_number}
12
+
13
+ % Issue Content
14
+ <issue_content>
15
+ {issue_content}
16
+ </issue_content>
17
+
18
+ % Previous Steps Output
19
+ <step1_output>
20
+ {step1_output}
21
+ </step1_output>
22
+
23
+ <step2_output>
24
+ {step2_output}
25
+ </step2_output>
26
+
27
+ <step3_output>
28
+ {step3_output}
29
+ </step3_output>
30
+
31
+ <step4_output>
32
+ {step4_output}
33
+ </step4_output>
34
+
35
+ <step5_output>
36
+ {step5_output}
37
+ </step5_output>
38
+
39
+ % Your Task
40
+
41
+ 1. **Review existing tests**
42
+ - Find existing test files for the affected module
43
+ - Understand the testing patterns used in this project
44
+ - Identify gaps in current test coverage
45
+
46
+ 2. **Design the test strategy**
47
+ - What specific behavior needs to be tested?
48
+ - What are the inputs that trigger the bug?
49
+ - What is the expected vs actual output?
50
+ - Are there related edge cases to cover?
51
+
52
+ 3. **Plan test location**
53
+ - Which test file should contain the new test?
54
+ - Should it be added to an existing file or create a new one?
55
+ - Follow the project's testing conventions
56
+
57
+ 4. **Define test cases**
58
+ - Primary test: reproduces the exact bug
59
+ - Edge cases: related scenarios that should also work
60
+ - Regression prevention: ensure the fix doesn't break other behavior
61
+
62
+ % Output
63
+
64
+ After completing your analysis, use `gh issue comment` to post your findings to issue #{issue_number}:
65
+
66
+ ```
67
+ gh issue comment {issue_number} --repo {repo_owner}/{repo_name} --body "..."
68
+ ```
69
+
70
+ Your comment should follow this format:
71
+
72
+ ```markdown
73
+ ## Step 6: Test Plan
74
+
75
+ ### Existing Test Coverage
76
+ - **Test file:** `tests/test_module.py`
77
+ - **Current coverage:** [Brief description of what's tested]
78
+ - **Gap:** [What's not covered that should be]
79
+
80
+ ### Proposed Tests
81
+
82
+ #### Test 1: [Name describing the bug scenario]
83
+ - **Input:** [The triggering condition]
84
+ - **Expected:** [Correct behavior]
85
+ - **Actual (before fix):** [Bug behavior]
86
+
87
+ #### Test 2: [Related edge case]
88
+ - **Input:** [Edge case condition]
89
+ - **Expected:** [Correct behavior]
90
+
91
+ ### Test Location
92
+ - **File:** `tests/test_module.py` (append) or `tests/test_module_bug_123.py` (new)
93
+ - **Framework:** [pytest/unittest/etc.]
94
+
95
+ ### Notes
96
+ [Any special setup, fixtures, or considerations]
97
+
98
+ ---
99
+ *Proceeding to Step 7: Generate Test*
100
+ ```
101
+
102
+ % Important
103
+
104
+ - Tests should be specific enough to catch this exact bug
105
+ - Tests should not be so brittle they break with valid changes
106
+ - Consider both the bug case and related edge cases
107
+ - Always post your findings as a GitHub comment before completing