Skip to content

Commit 16d47d3

Browse files
authored
Fix tool records giving path relative to base path. (#1098)
* Make modified files be always relative to current working directory instead of base path * Support push triggers in pr
1 parent b693b28 commit 16d47d3

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ on:
1616
- resolveissue-*
1717
- demo*
1818

19-
# Credits to https://blog.maximeheckel.com/posts/building-perfect-github-action-frontend-teams/
19+
# Credits to https://blog.maximeheckel.com/posts/building-perfect-github-action-frontend-teams/#you-are-terminated
2020
concurrency:
2121
# Here the group is defined by the head_ref of the PR
22-
group: ${{ github.head_ref }}
22+
group: ${{ github.head_ref || github.ref_name }}
2323
# Here we specify that we'll cancel any "in progress" workflow of the same group. Thus if we push, ammend a commit and push
2424
# again the previous workflow will be cancelled, thus saving us github action build minutes and avoid any conflicts
2525
cancel-in-progress: true

patchwork/common/tools/code_edit_tools.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,13 @@ def execute(
104104
return f"Error: {str(e)}"
105105

106106
if command in {"create", "str_replace", "insert"}:
107-
self.modified_files.update({abs_path.relative_to(self.repo_path)})
107+
self.modified_files.update({abs_path})
108108

109109
return result
110110

111111
@property
112112
def tool_records(self):
113-
return dict(modified_files=[{"path": str(file)} for file in self.modified_files])
113+
return dict(modified_files=[file for file in self.modified_files])
114114

115115
def __get_abs_path(self, path: str):
116116
wanted_path = Path(path).resolve()

patchwork/steps/FixIssue/FixIssue.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,5 +126,7 @@ def run(self):
126126
self.multiturn_llm_call.execute(limit=100)
127127
for tool in self.multiturn_llm_call.tool_set.values():
128128
if isinstance(tool, CodeEditTool):
129-
return tool.tool_records
129+
cwd = Path.cwd()
130+
modified_files = [file_path.relative_to(cwd) for file_path in tool.tool_records["modified_files"]]
131+
return dict(modified_files=[{"path": str(file)} for file in modified_files])
130132
return dict()

0 commit comments

Comments
 (0)