fix(review): truthful, fault-tolerant review-request (#377) #379
No reviewers
Labels
No labels
Agent
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No assignees
2 participants
Notifications
Total time spent: 2 minutes
Due date
igor
2 minutes
No due date set.
Dependencies
No dependencies set
Reference
joshtronic/igor!379
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/review-request-idempotent"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes the intermittent
review-request to joshtronic failedwarning on APPROVE verdicts.Root cause (verified)
do_review_tickloggedrequested review from joshtronicunconditionally, right after a request that could fail — hence the "warning-then-requested" pair in the journal. And a live probe showed re-requesting an already-requested reviewer is a harmless Forgejo no-op (HTTP 201, empty body) — so the real failures are transient (5xx / timeout), not "already requested."Fix
forgejo_request_reviewcaptures HTTP status+body (via a stubbable_forgejo_post_reviewersseam), retries once on a transient code (5xx / curl000), and on persistent failure surfaces the status+body + returns non-zero.review_request_humanwrapper logs the outcome truthfully — a success line only when the request lands, else one warning carrying the API reason. Replaces the three duplicated request-then-log blocks (APPROVE/COMMENT, unvalidated, escalation).Tests
bin/test-forgejo.sh: success / transient-retry / persistent-error / client-error.make testgreen; shellcheck clean on changed lines.Note
WIP draft on purpose so the live review loop leaves it alone overnight. Touches
lib/forgejo.sh+bin/test-forgejo.shlike #376 does but in disjoint regions — if #376 merges first this may want a trivial rebase; I'll keep it current.Closes #377
WIP: fix(review): truthful, fault-tolerant review-request (#377)to fix(review): truthful, fault-tolerant review-request (#377)🤖 Review —
COMMENT(automated)CI for
6461f5e1: successTruthful/fault-tolerant review-request refactor: splits the HTTP POST into a stubbable seam, retries once on transient (5xx/000) codes, surfaces the real HTTP status+body on persistent failure, and consolidates three duplicated request-then-log blocks into
review_request_human. Small (~90 lines), focused on #377, CI green. The retry/classification logic is correct and well-covered.Strengths
forgejo_request_reviewstate machine is right:2*→rc 0,5*|000→retry once then fail, everything else→immediate fail-no-retry. The four test cases (success / transient-retry / persistent-5xx / client-422) exercise each path, including asserting exactly 2 attempts.respparsing (${resp##*$'\n'}for code,${resp%$'\n'*}for body) handles empty-body responses correctly since-w $'\n%{http_code}'always appends the code as the last line.review_request_humannow only logs "requested" when the request actually landed — the stated bug (unconditional success log after a failable request) is genuinely fixed. Checklist matches the diff; tests are present.One thing a human should confirm (why this is COMMENT, not APPROVE)
_forgejo_post_reviewersbypasses the existing_fjhelper and hand-builds the URL as"$FORGEJO_URL/api/v1/repos/${repo}/pulls/${number}/requested_reviewers". The old code was_fj POST "/repos/...". Because the tests stub the seam, the real URL string is never exercised — a mismatch with_fj's actual base (trailing slash, or_fjnot prepending exactly/api/v1) would 404 in production while every test stays green. I can't see_fj/FORGEJO_URLdefinitions in this diff to verify they agree. Please confirm the constructed URL matches what_fjproduces.Minor
tr '\n' ' ' | head -c 200— fine; no secret leakage risk sinceFORGEJO_TOKENis only in the request header, never echoed.No blocking defect found; the only open question is the untested real-URL construction, which is worth a human glance before merge.
Independent review by the harness on
claude-opus-4-8(effort: high). The human reviewer is requested once Igor has reviewed; a human still merges.🤖 Review —
COMMENT(automated)CI for
480b4b75: successClean, well-tested fix for the contradictory "warning-then-requested" journal pair:
forgejo_request_reviewnow classifies the HTTP result, retries once on transient (5xx/000), surfaces the real reason on persistent failure, and a newreview_request_humanwrapper logs the outcome truthfully. In scope (only the review-request path), small diff, honest checklist — the four described tests (success / transient-retry / persistent-error / client-error) all exist in the diff. CI green. My only reservations are verification gaps I can't close from the diff alone.Logic — looks correct:
code="${resp##*$'\n'}"/body="${resp%$'\n'*}") correctly splits curl's trailing\n%{http_code}, and handles the empty-body 201 case (\n201→ code201, body empty).2*→return 0;5*|000on attempt 1 → sleep+continue, on attempt 2 → falls through tobreak;4xxskips the case arms and hitsbreakimmediately (no retry). Matches the 422 "no retry" test.review_request_humancaptures2>&1, andforgejo_request_reviewwrites nothing to stdout on success, so the success/warning branches log cleanly.Reservation 1 (main) — unverifiable URL base + new DRY divergence. The extracted
_forgejo_post_reviewershardcodes"$FORGEJO_URL/api/v1/repos/...", whereas the old code went through_fj POST "/repos/...". This bakes in an assumption that_fjprepends exactly$FORGEJO_URL/api/v1(and thatFORGEJO_URLcarries no/api/v1itself). I can't see_fjin this diff to confirm, and because every test stubs the_forgejo_post_reviewersseam, no test exercises the real curl/URL path — so a base-URL mismatch would pass CI and only surface in production. Please confirm the base matches_fj's convention; ideally the base construction would be shared rather than duplicated, so the two can't drift.Reservation 2 (minor):
--max-time 30and the direct auth/content-type headers are now duplicated from whatever_fjdoes; same drift risk as above.Non-blocking:
review_request_humanre-checksFORGEJO_REVIEWERinternally while all three call sites still guard withif [ -n "${FORGEJO_REVIEWER:-}" ]— harmless redundancy.Nothing here is a defect I can point to as wrong — it's the untested real-HTTP seam plus the duplicated base URL that keep me from a confident APPROVE. A quick human glance at
_fj's URL construction should clear it.Independent review by the harness on
claude-opus-4-8(effort: high). The human reviewer is requested once Igor has reviewed; a human still merges.