fix: improve prompts, error messages, and workspace concurrency

- Externalize coordinator, notification, and planning prompts to separate files
- Add workspace mutex for concurrent file operations
- Improve error messages across file_tools, issue_tools, and pr_tools
- Add logging to tool modules for better debugging
- Update tests to match new error message strings
This commit is contained in:
meeks
2026-07-19 17:49:33 +02:00
committed by Michael
parent ee01487ce3
commit dfdd8c0931
11 changed files with 300 additions and 107 deletions
+17 -9
View File
@@ -58,7 +58,8 @@ def test_close_pull_request_failure() -> None:
pr_tools: PRTools = PRTools(mock_client)
res: str = pr_tools.close_pull_request("owner", "repo", 1)
assert "Error closing pull request: API Error" in res
assert "Could not close PR" in res
assert "owner/repo" in res
def test_get_pull_request_comments_success() -> None:
@@ -79,7 +80,8 @@ def test_get_pull_request_comments_failure() -> None:
pr_tools: PRTools = PRTools(mock_client)
res: str = pr_tools.get_pull_request_comments("owner", "repo", 1)
assert "Error getting PR comments: API Error" in res
assert "Could not retrieve comments" in res
assert "owner/repo" in res
def test_list_assigned_pull_requests_success() -> None:
@@ -124,7 +126,7 @@ def test_list_pull_requests_empty() -> None:
pr_tools: PRTools = PRTools(mock_client)
res: str = pr_tools.list_pull_requests("owner", "repo")
assert res == "No PRs in owner/repo."
assert res == "No open PRs in owner/repo."
def test_list_pull_requests_failure() -> None:
@@ -133,7 +135,8 @@ def test_list_pull_requests_failure() -> None:
pr_tools: PRTools = PRTools(mock_client)
res: str = pr_tools.list_pull_requests("owner", "repo")
assert "Error listing PRs: API Error" in res
assert "Could not list PRs" in res
assert "owner/repo" in res
def test_create_pull_request_success() -> None:
@@ -179,7 +182,8 @@ def test_add_label_to_pr_failure() -> None:
pr_tools: PRTools = PRTools(mock_client)
res: str = pr_tools.add_label_to_pr("owner", "repo", 1, "bug")
assert "Error adding label to PR #1: API Error" in res
assert "Could not add label" in res
assert "bug" in res
def test_get_pull_request_diff_success() -> None:
@@ -197,7 +201,8 @@ def test_get_pull_request_diff_failure() -> None:
pr_tools: PRTools = PRTools(mock_client)
res: str = pr_tools.get_pull_request_diff("owner", "repo", 1)
assert "Error getting PR diff: API Error" in res
assert "Could not retrieve diff" in res
assert "owner/repo" in res
def test_get_pull_request_patch_success() -> None:
@@ -215,7 +220,8 @@ def test_get_pull_request_patch_failure() -> None:
pr_tools: PRTools = PRTools(mock_client)
res: str = pr_tools.get_pull_request_patch("owner", "repo", 1)
assert "Error getting PR patch: API Error" in res
assert "Could not retrieve patch" in res
assert "owner/repo" in res
def test_approve_pull_request_success() -> None:
@@ -233,7 +239,8 @@ def test_approve_pull_request_failure() -> None:
pr_tools: PRTools = PRTools(mock_client)
res: str = pr_tools.approve_pull_request("owner", "repo", 1, "good")
assert "Error approving PR: API Error" in res
assert "Could not approve PR" in res
assert "owner/repo" in res
def test_request_changes_success() -> None:
@@ -251,4 +258,5 @@ def test_request_changes_failure() -> None:
pr_tools: PRTools = PRTools(mock_client)
res: str = pr_tools.request_changes("owner", "repo", 1, "bad")
assert "Error requesting changes: API Error" in res
assert "Could not request changes" in res
assert "owner/repo" in res