Skip to content

feat(review): surface review failures as a PR comment#5

Merged
lapa2112 merged 2 commits into
LingoVerse:mainfrom
lapa2112:feat/review-failure-notice
Jul 3, 2026
Merged

feat(review): surface review failures as a PR comment#5
lapa2112 merged 2 commits into
LingoVerse:mainfrom
lapa2112:feat/review-failure-notice

Conversation

@lapa2112

@lapa2112 lapa2112 commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

What

A review that throws before it can post (e.g. a model context-size overflow on a large PR) previously died silently after the webhook's 200 — nothing appeared on the PR, and the only trace was in the worker logs. The primary/escalation pass can fail non-retryably, and the run terminated before postReview with no feedback.

This wraps the review run so any failure posts a ⚠️ Mimir review failed comment carrying the error reason. The notice is:

  • idempotent — stored under a separate …#<n>::failed key, so a re-run updates one notice instead of stacking;
  • non-destructive — its own <!-- mimir-review-failed --> marker keeps it distinct from the summary comment, so a failed run never clobbers a prior good review.

A structured review failed event is also logged for wrangler tail.

Why

Turning a silent no-op into an actionable, re-runnable notice: when a review fails, the maintainer sees why on the PR and can /review again, instead of assuming the bot is broken or the PR was skipped.

Changes

  • lib/post-review.ts: new postReviewFailure() (update-or-create on a ::failed key).
  • workflows/review-pr.ts: thin run wrapper around the review body that catches, logs, and posts the failure notice; re-resolving the (cached) installation client to post.

Test

  • typecheck, lint, and the existing suite (91 tests) pass.

@mimir-code-assist

mimir-code-assist Bot commented Jul 2, 2026

Copy link
Copy Markdown

Mimir review — 🟢 No blocking issues

Well-structured PR adding a post-review failure notification mechanism. postReviewFailure creates/updates a PR comment when a review crashes, keyed separately (::failed) so it never overwrites a good summary. postReview retracts any stale failure notice on success. The code is well-tested (7 test cases for the new function, 2 for the retraction integration). No blocking issues found; the existing minor findings (no integration test for the error wrapper, stale store keys) remain valid.

Findings: 0 critical · 0 major · 2 minor · 0 nit

💰 Review cost: $0.0136 — primary deepseek/deepseek-v4-flash $0.0136

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces error handling and failure reporting for the PR review workflow. It adds a postReviewFailure function to surface failures (such as model context-size overflows) as PR comments, and wraps the main workflow execution in a try-catch block to prevent silent failures. The review feedback is highly constructive and suggests cleaning up stale failure comments upon a successful run, sanitizing error messages to prevent markdown formatting issues, and rethrowing the caught error so the workflow platform can accurately track execution failures.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/lib/post-review.ts Outdated
Comment thread src/lib/post-review.ts Outdated
Comment thread src/workflows/review-pr.ts
Comment thread src/lib/post-review.ts
ephor
ephor previously approved these changes Jul 2, 2026
lapa2112 added 2 commits July 2, 2026 23:43
A review that throws before posting (e.g. a model context-size overflow)
died silently after the webhook's 200, leaving nothing on the PR. Wrap the
run so any failure posts an idempotent notice with the reason, stored under
a separate key/marker so it never clobbers a prior good review.
… comment

Address PR review feedback:
- On a successful review, retract any lingering "review failed" comment from an
  earlier failed run (best-effort delete) so the PR never shows a good review
  beside a stale failure notice.
- Sanitize triple backticks in the error reason so a message can't prematurely
  close the fenced code block in the comment.
- Document why the run returns (not re-throws) on failure: the pass already
  exhausted transient retries, so a throw would make Flue re-run the whole
  review up to its max-attempts for a deterministic failure.
- Add tests for postReviewFailure (create/update/404-fallback/non-Error/sanitize)
  and the success-path retract.
@lapa2112 lapa2112 force-pushed the feat/review-failure-notice branch from e41f06c to eefda92 Compare July 2, 2026 21:47
Comment thread src/lib/post-review.ts
Comment thread src/workflows/review-pr.ts
@lapa2112 lapa2112 merged commit 164f567 into LingoVerse:main Jul 3, 2026
1 check passed
@lapa2112 lapa2112 deleted the feat/review-failure-notice branch July 3, 2026 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants