Skip to content

SWE-agent takes a GitHub issue and tries to automatically fix it, using your LM of choice. It can also be employed for offensive cybersecurity or competitive coding challenges. [NeurIPS 2024]

Fix: Correctly format commit message for PR creation (#1155)

Mahshooq Zubair1bcfa733e63d
diff --git a/sweagent/run/hooks/open_pr.py b/sweagent/run/hooks/open_pr.py
index 03bd83d1..d77b5017 100644
--- a/sweagent/run/hooks/open_pr.py
+++ b/sweagent/run/hooks/open_pr.py
@@ -50,8 +50,8 @@ def open_pr(*, logger, token, env: SWEEnv, github_url, trajectory, _dry_run: boo
env.communicate(input="git add .", error_msg="Failed to add commits", timeout=10, check="raise")
dry_run_flag = "--allow-empty" if _dry_run else ""
commit_msg = [
- shlex.quote("Fix: {issue.title}"),
- shlex.quote("Closes #{issue.number}"),
+ shlex.quote(f"Fix: {issue.title}"),
+ shlex.quote(f"Closes #{issue.number}"),
]
out = env.communicate(
input=f"git commit -m {commit_msg[0]} -m {commit_msg[1]} {dry_run_flag}",