Skip to content

Commit 546a915

Browse files
committed
Add run_reproduce_test option to issue handling and update related descriptions
1 parent 43c8c01 commit 546a915

8 files changed

Lines changed: 29 additions & 4 deletions

File tree

prometheus/app/api/issue.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ def answer_issue(issue: IssueRequest, request: Request) -> Response[IssueRespons
4747
issue_type=issue.issue_type,
4848
run_build=issue.run_build,
4949
run_existing_test=issue.run_existing_test,
50+
run_reproduce_test=issue.run_reproduce_test,
5051
number_of_candidate_patch=issue.number_of_candidate_patch,
5152
dockerfile_content=issue.dockerfile_content,
5253
image_name=issue.image_name,

prometheus/app/models/requests/issue.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,17 @@ class IssueRequest(BaseModel):
3333
)
3434
run_build: Optional[bool] = Field(
3535
default=False,
36-
description="When editing the code, whenver we should run the build to verify the fix",
36+
description="When editing the code, whenever we should run the build to verify the fix",
3737
examples=[False],
3838
)
3939
run_existing_test: Optional[bool] = Field(
4040
default=False,
41-
description="When editing the code, whenver we should run the existing test to verify the fix",
41+
description="When editing the code, whenever we should run the existing test to verify the fix",
42+
examples=[False],
43+
)
44+
run_reproduce_test: Optional[bool] = Field(
45+
default=True,
46+
description="When editing the code, whenever we should run the reproduce test to verify the fix",
4247
examples=[False],
4348
)
4449
number_of_candidate_patch: Optional[int] = Field(

prometheus/app/services/issue_service.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def answer_issue(
4343
issue_type: IssueType,
4444
run_build: bool,
4545
run_existing_test: bool,
46+
run_reproduce_test: bool,
4647
number_of_candidate_patch: int,
4748
dockerfile_content: Optional[str] = None,
4849
image_name: Optional[str] = None,
@@ -62,6 +63,7 @@ def answer_issue(
6263
issue_type (IssueType): The type of the issue (BUG or QUESTION).
6364
run_build (bool): Whether to run the build commands.
6465
run_existing_test (bool): Whether to run existing tests.
66+
run_reproduce_test (bool): Whether to run reproduce tests.
6567
number_of_candidate_patch (int): Number of candidate patches to generate.
6668
dockerfile_content (Optional[str]): Content of the Dockerfile for user-defined environments.
6769
image_name (Optional[str]): Name of the Docker image.
@@ -118,6 +120,7 @@ def answer_issue(
118120
issue_type,
119121
run_build,
120122
run_existing_test,
123+
run_reproduce_test,
121124
number_of_candidate_patch,
122125
)
123126

prometheus/lang_graph/graphs/issue_graph.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ def invoke(
102102
issue_type: IssueType,
103103
run_build: bool,
104104
run_existing_test: bool,
105+
run_reproduce_test: bool,
105106
number_of_candidate_patch: int,
106107
):
107108
"""
@@ -116,6 +117,7 @@ def invoke(
116117
"issue_type": issue_type,
117118
"run_build": run_build,
118119
"run_existing_test": run_existing_test,
120+
"run_reproduce_test": run_reproduce_test,
119121
"number_of_candidate_patch": number_of_candidate_patch,
120122
}
121123

prometheus/lang_graph/graphs/issue_state.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class IssueState(TypedDict):
1818
issue_type: IssueType
1919
run_build: bool
2020
run_existing_test: bool
21+
run_reproduce_test: bool
2122
number_of_candidate_patch: int
2223

2324
edit_patch: str

prometheus/lang_graph/nodes/issue_bug_subgraph_node.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ def __call__(self, state: IssueState):
5757
issue_comments=state["issue_comments"],
5858
run_build=state["run_build"],
5959
run_existing_test=state["run_existing_test"],
60+
run_reproduce_test=state["run_reproduce_test"],
6061
number_of_candidate_patch=state["number_of_candidate_patch"],
6162
)
6263

prometheus/lang_graph/subgraphs/issue_bug_state.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ class IssueBugState(TypedDict):
77
issue_comments: Sequence[Mapping[str, str]]
88
run_build: bool
99
run_existing_test: bool
10+
run_reproduce_test: bool
1011
number_of_candidate_patch: int
1112

1213
reproduced_bug: bool

prometheus/lang_graph/subgraphs/issue_bug_subgraph.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,17 @@ def __init__(
7777
)
7878

7979
workflow.add_node("issue_bug_responder_node", issue_bug_responder_node)
80-
# Set the entry point for the workflow
81-
workflow.set_entry_point("bug_reproduction_subgraph_node")
80+
81+
# Start with bug reproduction subgraph if reproducing bug is required,
82+
# otherwise start with not verified bug subgraph
83+
workflow.set_conditional_entry_point(
84+
lambda state: state["run_reproduce_test"],
85+
{
86+
True: "bug_reproduction_subgraph_node",
87+
False: "issue_not_verified_bug_subgraph_node",
88+
},
89+
)
90+
8291
# Go to verified bug subgraph if the bug is verified, otherwise go to not verified bug subgraph
8392
workflow.add_conditional_edges(
8493
"bug_reproduction_subgraph_node",
@@ -109,6 +118,7 @@ def invoke(
109118
issue_comments: Sequence[Mapping[str, str]],
110119
run_build: bool,
111120
run_existing_test: bool,
121+
run_reproduce_test: bool,
112122
number_of_candidate_patch: int,
113123
recursion_limit: int = 30,
114124
):
@@ -120,6 +130,7 @@ def invoke(
120130
"issue_comments": issue_comments,
121131
"run_build": run_build,
122132
"run_existing_test": run_existing_test,
133+
"run_reproduce_test": run_reproduce_test,
123134
"number_of_candidate_patch": number_of_candidate_patch,
124135
}
125136

0 commit comments

Comments
 (0)