Gh 27 wait approval status - #28
Merged
Merged
Conversation
Azure Pipelines stages and GitHub Actions environments can pause a run on a manual approval gate. That leaves the run "in progress" indefinitely, so --wait polled forever waiting for something only a human can resolve. Detect it explicitly instead: on Azure DevOps, look for an open Checkpoint.Approval timeline record and resolve its stage name by walking the parent chain; on GitHub, a CheckRun's status "WAITING" already flags a deployment protection rule. Either way, --wait now stops, prints which stage/check needs a reviewer plus a link to act on it, and exits with a dedicated code (2) distinct from success/failure. Fixes #27. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
- gh_pr.py / pr_build.py: don't let a pending-approval report mask an already-failed check/pipeline elsewhere in the same PR — report the failure (exit 1) instead of just prompting for approval (exit 2), and don't silently fall back into the old infinite-poll loop when the failure suppressed the approval check. - pr_build.py: only fetch a build's timeline when its status is actually "inProgress" — a build that's "notStarted"/"postponed" has no timeline yet and the endpoint 404s, which crashed --wait. - Add regression tests for both wait-loop interactions and the not-started-build skip. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Resolves conflicts from main's concurrent `bdt pr retry`/`bdt pr watch-deploy` work against this branch's approval-wait fix. The new `watch-deploy` command (run_watch_deploy in both gh_pr.py and pr_build.py) had the identical hang-on-approval bug, so it gets the same fix as `pr status --wait`. Also fixes issues found by code review during the merge: - Change EXIT_NEEDS_APPROVAL from 2 to 3 (2 collides with Click/Typer's own usage-error exit code). - An already-failed pipeline/check must not be masked by a co-occurring waiting-approval report, in either direction (fixed in both gh_pr.py and pr_build.py, for both commands). - gh_pr.py's run() could still hang if a failed check, a waiting-approval check, and a separately-stuck pending check all coexisted. - pr_build.py's --wait baseline/staleness check treated an already in-progress build (present before --wait was even invoked) as perpetually "stale, waiting for a new build to start", so the new approval detection was never reached unless --wait happened to be invoked in the split second before the build was created. - find_pending_approvals now fails open on a timeline 404 (a build can briefly report in-progress before its timeline document exists). - print_build's result formatting crashed on ADO's explicit `result: null` for an in-progress build. - Extracted shared helpers (exit_if_blocked_on_approval in pr_build.py, exit_needs_approval in gh_pr.py) instead of duplicating the approval-report logic across run()/run_watch_deploy(). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.