Apply reviewed labels without risking PR creation - #138
Conversation
hamzamerzic
left a comment
There was a problem hiding this comment.
Verdict for exact head 989432f: CHANGES_REQUESTED
Blocker — recover a possibly accepted PR when pr create loses its response via TimeoutExpired or OSError.
At backend/app/routes/github.py:1839, _gh(... pr create ..., check=False) may raise either exception directly. The only inner handler at line 1866 catches ContributionSubmitError, so this bypasses _find_existing_pr at lines 1843-1850. The endpoint then takes the generic exception path at lines 2560-2572, returns 500, and moves the ledger back to prepared without the durable PR URL/number. If GitHub accepted the create before the timeout/transport loss, the response and ledger are therefore untruthful and the next retry risks rediscovery only indirectly.
Expected transition: after the branch push, treat TimeoutExpired/OSError from pr create as an ambiguous create result; run the same exact head/base _find_existing_pr lookup used for a nonzero return. If found, apply labels best-effort and persist/return status=open plus URL/number and the truthful label patch. If no PR can be confirmed, keep status=prepared, preserve the pushed-stage patch, and return the actionable retry error. Please add regressions for both TimeoutExpired and OSError proving the found-existing path lands open and records label outcomes.
The revised first-two-visible label boundary itself looks correct: malformed/blank inputs are filtered like the review UI, then two visible labels are selected before validation/dedupe, so an invalid or duplicate visible label cannot promote a hidden third.
|
Concrete reproduction on exact head 989432f, with _find_existing_pr stubbed to return https://github.com/mobius-os/app-demo/pull/77: The harness drove _submit_prepared_pr through successful validation, push, and into the pr create call, then injected each transport exception. In both cases the existing-PR reconciliation hook was never called. This confirms the source-level transition described in the review comment. |
Co-authored-by: Möbius Agent <mobius-agent@users.noreply.github.com>
|
Blocking create/recovery integrity finding on exact head Standalone PR creation and recovery still do not pin the base branch. This is not merely an omitted filter: GitHub CLI documents that when Please use the already-proven upstream branch as the explicit standalone base for both operations:
Keep |
|
Final exact-head review on |
|
APPROVED on exact head The previous wrong-base blocker is closed. Standalone create now pins Verification: all 95 GitHub route tests pass locally; exact-head GitHub privacy/backend/frontend/packager/core-apps/E2E checks are green; diff is clean. The PR is currently behind |
Summary
Recovery contract
PR creation is the durable boundary. Every label operation happens afterward and is best-effort. Timeout and OSError paths now return a truthful warning patch instead of escaping into the submit endpoint and leaving an already-created PR presented as a failed or stranded submission.
Verification
Rebuilt from production commit db1c2ddb onto current upstream main 7b1eb41. Core PR: review only; do not merge without the required independent reviews.