Spaces:
Running
Running
include posting errors in receipts
Browse files- nodes/executor.py +6 -0
nodes/executor.py
CHANGED
|
@@ -17,6 +17,7 @@ GITHUB_API_BASE = "https://api.github.com"
|
|
| 17 |
|
| 18 |
|
| 19 |
_GITHUB_SESSION: GitHubSession | None = None
|
|
|
|
| 20 |
|
| 21 |
|
| 22 |
def _gh_session() -> GitHubSession:
|
|
@@ -102,6 +103,7 @@ def _post_review_comment(
|
|
| 102 |
"Failed to post inline comment: HTTP %s — %s",
|
| 103 |
resp.status_code, resp.text[:200],
|
| 104 |
)
|
|
|
|
| 105 |
return False
|
| 106 |
except requests.RequestException as exc:
|
| 107 |
logger.warning("Request failed for inline comment: %s", exc)
|
|
@@ -125,6 +127,7 @@ def _post_issue_comment(owner: str, repo: str, pr_number: int, body: str) -> boo
|
|
| 125 |
"Failed to post fallback comment: HTTP %s — %s",
|
| 126 |
resp.status_code, resp.text[:200],
|
| 127 |
)
|
|
|
|
| 128 |
return False
|
| 129 |
except requests.RequestException as exc:
|
| 130 |
logger.warning("Request failed for fallback comment: %s", exc)
|
|
@@ -210,6 +213,8 @@ def executor_node(state: OpenCodeReviewState) -> dict:
|
|
| 210 |
logger.info("Not approved \u2014 skipping executor")
|
| 211 |
return {"posting_result": {"status": "skipped", "reason": "not_approved"}}
|
| 212 |
|
|
|
|
|
|
|
| 213 |
parts = state.repo.split("/")
|
| 214 |
if len(parts) != 2:
|
| 215 |
logger.warning("Cannot post results: invalid repo '%s'", state.repo)
|
|
@@ -319,4 +324,5 @@ def executor_node(state: OpenCodeReviewState) -> dict:
|
|
| 319 |
"finding_failed": finding_failed,
|
| 320 |
"verdict_failed": verdict_failed,
|
| 321 |
"verdict_posted": verdict_posted,
|
|
|
|
| 322 |
}}
|
|
|
|
| 17 |
|
| 18 |
|
| 19 |
_GITHUB_SESSION: GitHubSession | None = None
|
| 20 |
+
_POST_ERRORS: list[str] = []
|
| 21 |
|
| 22 |
|
| 23 |
def _gh_session() -> GitHubSession:
|
|
|
|
| 103 |
"Failed to post inline comment: HTTP %s — %s",
|
| 104 |
resp.status_code, resp.text[:200],
|
| 105 |
)
|
| 106 |
+
_POST_ERRORS.append(f"inline:{resp.status_code}:{resp.text[:200]}")
|
| 107 |
return False
|
| 108 |
except requests.RequestException as exc:
|
| 109 |
logger.warning("Request failed for inline comment: %s", exc)
|
|
|
|
| 127 |
"Failed to post fallback comment: HTTP %s — %s",
|
| 128 |
resp.status_code, resp.text[:200],
|
| 129 |
)
|
| 130 |
+
_POST_ERRORS.append(f"issue:{resp.status_code}:{resp.text[:200]}")
|
| 131 |
return False
|
| 132 |
except requests.RequestException as exc:
|
| 133 |
logger.warning("Request failed for fallback comment: %s", exc)
|
|
|
|
| 213 |
logger.info("Not approved \u2014 skipping executor")
|
| 214 |
return {"posting_result": {"status": "skipped", "reason": "not_approved"}}
|
| 215 |
|
| 216 |
+
_POST_ERRORS.clear()
|
| 217 |
+
|
| 218 |
parts = state.repo.split("/")
|
| 219 |
if len(parts) != 2:
|
| 220 |
logger.warning("Cannot post results: invalid repo '%s'", state.repo)
|
|
|
|
| 324 |
"finding_failed": finding_failed,
|
| 325 |
"verdict_failed": verdict_failed,
|
| 326 |
"verdict_posted": verdict_posted,
|
| 327 |
+
"errors": list(_POST_ERRORS),
|
| 328 |
}}
|