Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion skills/github-pr-reviewer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ This skill is activated by:
assertions, generated mockups, and reconstructed captures cannot substitute.
Missing evidence yields a COMMENT review that names the gap, so no approval
and no maintainer handoff
- Ends each published review, fallback comment, and error comment with the LLM
- Ends each published review and error comment with the LLM
profile and model of the conversation that wrote it:
`LLM profile: <profile> · Model: <model>`. The deterministic script appends
the footer, never the agent. With default agent publication, it updates only
Expand Down
8 changes: 4 additions & 4 deletions skills/github-pr-reviewer/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -497,9 +497,9 @@ For each repository:
verifies a submitted review by the token's own user at that head SHA and
appends the recorded LLM profile and model to each review carrying this
conversation's marker before marking the review complete. Reviews without
that marker are confirmed but never edited. If no review exists, the
agent's final response is posted as a comment with provenance. Failed
verification or publication is retried on the next poll.
that marker are confirmed but never edited. If no review exists, a later
worker scan reconciles a finished marked response and submits it as a
review. Failed verification or publication is retried on the next scan.
- Abandons a conversation that has not reached a terminal status within two
hours, so its checkout can be reclaimed.
6. Removes the checkout of every finished review, but only after confirming the
Expand Down Expand Up @@ -539,6 +539,6 @@ The completion callback fires once for the whole run.
| Only a few reviews start on a large backlog | The per-scan `max_new_per_run` bound (default 2) reached | No action; later scans drain the remaining oldest eligible PRs, or raise `max_new_per_run` if the deployment can hold more agents |
| Review result never posts | Conversation still running or stuck | Open the conversation link from the acknowledgement comment |
| Stale review suppressed | PR head SHA changed while the agent was reviewing | Re-apply the trigger label after the latest commit |
| Review arrives as a plain comment, not a review | Publishing failed, so the script posted the text as a fallback | Check that the token has Pull requests: Read and Write |
| Review arrives as a plain comment, not a review | A legacy main.py poll used its comment fallback | Check that the token has Pull requests: Read and Write |
| Agent reports it cannot clone the repo | Prompt asked it not to; the workspace is already the checkout | No action - the code is at the head SHA in its working directory |
| Checkouts remain under `repositories/` | Their conversations had not stopped yet | They are removed by a later poll once the conversation is terminal |
39 changes: 39 additions & 0 deletions skills/github-pr-reviewer/scripts/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -1264,6 +1264,10 @@ def run(self):
f"{quote(trigger_label, safe='')}",
)
continue
if not self.structured_reviews and self._recover_finished_review(
repository_id, pr
):
continue
if not self.structured_reviews and delivery_key is None and self._finish_completed_review(
pr, trigger, trigger_label, submitted_review
):
Expand Down Expand Up @@ -1397,6 +1401,41 @@ def _start_review(
)
return result

def _recover_finished_review(self, repository_id, pr):
"""Publish a finished conversation's stored review when GitHub missed it."""
conversation_id = self.dispatcher.subject_conversation(
f"{repository_id}:pr:{pr['number']}"
)
if not conversation_id:
return False
try:
snapshot = self.dispatcher.review_snapshot(conversation_id)
except Exception as exc: # noqa: BLE001 - recovery must not block other PRs
print(f" Warning: finished review recovery unavailable: {exc}")
return False
if not isinstance(snapshot, tuple) or len(snapshot) != 2:
return False
status, final = snapshot
if status != "finished" or not final:
return False
body = workflow._without_llm_provenance(final).strip()
marker = workflow._review_run_marker(conversation_id)
if body.count(marker) != 1 or not body.endswith(
("✅ APPROVED", "🔄 CHANGES REQUESTED")
):
return False
if self._has_current_head_review(pr["number"], pr["head"]["sha"]):
return True
self.gh(
"POST",
f"/pulls/{pr['number']}/reviews",
{"body": body, "event": "COMMENT", "commit_id": pr["head"]["sha"]},
)
if not self._has_current_head_review(pr["number"], pr["head"]["sha"]):
return False
self._finish_completed_review(pr, None)
return True


def run_scan(dispatcher):
"""Run one scheduled scan over every configured repository, then drain.
Expand Down
Loading