-
Notifications
You must be signed in to change notification settings - Fork 1
feat: implement issue #1407 — [Phase 4] Demote dev-lead-retry from normal-path driver to a true backstop — resume blocked states event-first #1489
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
53c7078
feat: implement issue #1407 — [Phase 4] Demote dev-lead-retry from no…
8f8cdca
fix(reviews): address review comments [skip ci-relay]
donpetry-bot 879db59
chore: dev-lead update (review-changes) [skip ci-relay]
donpetry-bot 491e5b9
fix(bot): address bot feedback [skip ci-relay]
donpetry-bot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
| # dev-lead-resume.sh — event-first resume of a blocked/rate-limited dev-lead | ||
| # state (#1407). | ||
| # | ||
| # When a *clearing event* arrives on a PR — a review submitted or a check_run | ||
| # success — this bridge resumes any pending status=rate-limited dev-lead retry | ||
| # IMMEDIATELY, instead of waiting for the 2 h dev-lead-retry.yml safety-net cron | ||
| # (the #860 "amplifier" the retry cron used to be). It is Bridge A of | ||
| # docs/agentic-interaction-model.md §5: the caller resolves the PR from the event | ||
| # and this script fires a PAT-backed repository_dispatch so dev-lead's normal | ||
| # event-driven retry path wakes — GITHUB_TOKEN cannot fire the downstream event | ||
| # (the recursion guard), which is exactly why a PAT bridge is required. | ||
| # | ||
| # The resume reuses scan_pr_for_rate_limits from dev-lead-retry.sh, so the | ||
| # dispatch AND every stop condition are IDENTICAL to the cron path: the shared | ||
| # pr_resume_suppressed gate (human markers + per-PR automation budget, #1407 | ||
| # AC #3), the rate-limit reset window, and the terminal-marker dedupe. The two | ||
| # paths cannot diverge, so the event fast-path is provably as safe as the timer. | ||
| # | ||
| # Env (required): | ||
| # GH_TOKEN — PAT with repo + contents:write scopes (the dispatch identity) | ||
| # REPO — "owner/repo" the clearing event fired in | ||
| # PR_NUMBER — the PR resolved from the clearing event (empty ⇒ clean no-op) | ||
| # | ||
| # Env (optional): | ||
| # DRY_RUN — if "true", log what would be dispatched but don't send | ||
| # NOW_ISO — override current time for testing (ISO-8601 UTC) | ||
|
|
||
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
| # Reuse the dispatch + scan + stop-condition logic. dev-lead-retry.sh guards its | ||
| # main() behind a BASH_SOURCE check, so sourcing it here exposes the functions | ||
| # without running the org-wide scan; it also sources lib/pr-automation-budget.sh. | ||
| # shellcheck source=dev-lead-retry.sh | ||
| source "$SCRIPT_DIR/dev-lead-retry.sh" | ||
|
|
||
| resume_main() { | ||
| local repo="${REPO:-}" pr="${PR_NUMBER:-}" | ||
|
|
||
| # A clearing event that carries no resolvable PR (e.g. a check_run on a commit | ||
| # with no open non-fork PR) is a clean no-op — there is nothing to resume. | ||
| if [ -z "$repo" ] || [ -z "$pr" ]; then | ||
| echo "::notice::dev-lead-resume: no PR resolved from the clearing event — nothing to resume" | ||
| return 0 | ||
| fi | ||
|
|
||
| echo "[resume] event-first resume check for ${repo}#${pr} (dry_run=${DRY_RUN})" | ||
| local dispatched | ||
| dispatched=$(scan_pr_for_rate_limits "$repo" "$pr") | ||
|
don-petry marked this conversation as resolved.
|
||
| echo "[resume] dispatched ${dispatched} resume(s) for ${repo}#${pr}" | ||
| } | ||
|
|
||
| # Run main only when executed directly, not when sourced by unit tests. | ||
| if [ "${BASH_SOURCE[0]}" = "${0}" ]; then | ||
| resume_main "$@" | ||
| fi | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.