Skip to content

Commit

Permalink
Fix tool records giving path relative to base path. (#1098)
Browse files Browse the repository at this point in the history
* Make modified files be always relative to current working directory instead of base path

* Support push triggers in pr
  • Loading branch information
CTY-git authored Dec 13, 2024
1 parent b693b28 commit 16d47d3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ on:
- resolveissue-*
- demo*

# Credits to https://blog.maximeheckel.com/posts/building-perfect-github-action-frontend-teams/
# Credits to https://blog.maximeheckel.com/posts/building-perfect-github-action-frontend-teams/#you-are-terminated
concurrency:
# Here the group is defined by the head_ref of the PR
group: ${{ github.head_ref }}
group: ${{ github.head_ref || github.ref_name }}
# Here we specify that we'll cancel any "in progress" workflow of the same group. Thus if we push, ammend a commit and push
# again the previous workflow will be cancelled, thus saving us github action build minutes and avoid any conflicts
cancel-in-progress: true
Expand Down
4 changes: 2 additions & 2 deletions patchwork/common/tools/code_edit_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,13 @@ def execute(
return f"Error: {str(e)}"

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

return result

@property
def tool_records(self):
return dict(modified_files=[{"path": str(file)} for file in self.modified_files])
return dict(modified_files=[file for file in self.modified_files])

def __get_abs_path(self, path: str):
wanted_path = Path(path).resolve()
Expand Down
4 changes: 3 additions & 1 deletion patchwork/steps/FixIssue/FixIssue.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,5 +126,7 @@ def run(self):
self.multiturn_llm_call.execute(limit=100)
for tool in self.multiturn_llm_call.tool_set.values():
if isinstance(tool, CodeEditTool):
return tool.tool_records
cwd = Path.cwd()
modified_files = [file_path.relative_to(cwd) for file_path in tool.tool_records["modified_files"]]
return dict(modified_files=[{"path": str(file)} for file in modified_files])
return dict()

0 comments on commit 16d47d3

Please sign in to comment.