Babysit pr to pass ci

From HYGON-AI/sglang-das · View interactive version

Babysit pr to pass ci is an AI agent skill from the GitHub repository HYGON-AI/sglang-das. Start and persistently pursue a goal to babysit an SGLang pull request until selected GitHub Actions workflows pass on the latest PR head. Use when asked to monitor, babysit, retry, or fix PR CI for lint.yml, pr-test.yml, pr-test-extra.yml, AMD, or other named workflows; classify failures as PR-rela

How to use this skill

Skill file

Babysit a PR Until Selected CI Passes

Drive only the selected workflows to green on the PR's latest head commit. Keep working across turns by starting a durable goal; do not stop merely because a run was dispatched, a retry began, or a fix was pushed.

Invocation and arguments

Accept:

$babysit-pr-to-pass-ci [PR_NUMBER|PR_URL] [WORKFLOW ...]
$babysit-pr-to-pass-ci [PR_NUMBER|PR_URL] --only WORKFLOW [WORKFLOW ...]

Examples:

$babysit-pr-to-pass-ci
$babysit-pr-to-pass-ci 12345
$babysit-pr-to-pass-ci https://github.com/sgl-project/sglang/pull/12345 pr-test-extra.yml
$babysit-pr-to-pass-ci 12345 --only pr-test-amd.yml

Start or continue the durable goal

Treat explicit invocation of this skill as authorization to create a goal and perform the scoped CI actions below.

  1. Resolve the PR and exact workflow set first.
  2. Inspect the current goal.
  3. If no unfinished goal exists, create one immediately using the product's goal mechanism. Include the resolved PR URL, selected workflow files, and this stopping condition: every selected workflow has a successful run for the PR's latest head SHA.
  4. Include these constraints in the goal objective:
  1. If the active goal already represents this same PR and workflow set, continue it instead of creating another goal.
  2. If a different unfinished goal is active, do not replace it silently. Report the conflict and ask the user to pause or clear it.

Do not mark the goal complete until the completion check at the end of this skill succeeds.

Preflight

  1. Verify GitHub authentication and resolve the repository without changing remote configuration.
  2. Resolve the PR and record at least:
  1. Require an open PR. If it is draft and a selected workflow is blocked by the draft gate, stop and ask the user to mark it ready; do not change draft state automatically.
  2. Normalize every selected workflow to an existing file under .github/workflows/. Fail fast on ambiguous or nonexistent names.
  3. Read each selected workflow's triggers and gates. Do not assume all optional workflows behave like pr-test.yml.
  4. Inspect git status. Preserve all user changes. If a fix becomes necessary and the current checkout is dirty, on a different branch, or otherwise unsafe, use an isolated worktree for the PR head.

Known SGLang gates:

Adding the known CI opt-in labels is within scope. Do not add unrelated labels, mark the PR ready, alter reviewers, merge, or mutate other PR metadata.

Track only current-head runs

Use both PR checks and workflow-run data so workflow names, run IDs, attempts, jobs, and logs can be correlated. Prefer workflow file IDs over display names when filtering runs.

For each selected workflow:

  1. Select the newest run associated with the current PR head SHA.
  2. Ignore runs for older head SHAs, including green runs made stale by a new push.
  3. Treat queued, requested, waiting, pending, and in_progress as active; keep monitoring.
  4. Treat a workflow as passing only when its current-head run concludes success.
  5. If no current-head run exists, wait briefly for event delivery, then inspect the workflow's path filters, event triggers, and label gates.
  6. Trigger only through a mechanism explicitly supported by that workflow. Never invent workflow_dispatch inputs or dispatch a workflow against the default branch when the intent is to test the PR head.
  7. If a selected workflow cannot safely be triggered for the PR head, report the exact blocker and request direction.

After any user push or skill-authored push, re-read the PR head SHA, discard stale run selections, and start tracking the new head. Reset retry counters for the new head SHA.

Monitor persistently

Diagnose a selected-workflow failure

  1. Inspect the failed jobs and failed-step logs. In pr-test.yml, distinguish the root failure from cascade failures caused by check-pr-test-health, wait jobs, or final aggregation.
  2. Record the exact failing test/check, error text, affected runner or hardware, and relevant log URL.
  3. Compare the failure against the PR's changed files and diff.
  4. Classify it:

PR-related when evidence ties the failure to changed code, tests, dependencies, configuration, generated files, or behavior introduced by the PR. A reproducible failure on the PR that does not occur on the base is strong evidence.

Unrelated/infrastructure when evidence points to a transient network or download error, runner loss, GPU/driver instability, service outage, pre-existing main-branch failure, known flaky threshold, unrelated test area, or another environmental cause.

Uncertain when evidence is insufficient. Do not label a failure flaky merely because it might be intermittent. Narrowly reproduce it, compare recent main/scheduled CI, inspect relevant code, or otherwise gather enough evidence to choose a category.

  1. When several root failures exist, classify each one. Address PR-related failures before spending retries on unrelated cascades.

Handle a PR-related failure

Estimate the proposed fix before editing.

A fix is eligible for automatic execution only when all are true:

If any condition fails, stop before editing. Report the diagnosis, proposed approach, expected files, estimated size, risks, and validation plan, then wait for user review.

For an eligible fix:

  1. Work from the latest PR head in a clean checkout or isolated worktree.
  2. Make only the necessary change and add or update focused tests when appropriate.
  3. Run the smallest meaningful local validation. For lint failures, reproduce the specific hook/check before considering broader lint validation.
  4. Review the resulting patch and count changed lines. If it becomes over 100 lines or turns tricky/dirty, do not commit or push it; stop for review and clearly identify the uncommitted skill-authored changes.
  5. Commit only skill-authored files. Never use git add ., rewrite user commits, amend without request, or include pre-existing local changes.
  6. Push a new commit non-forcibly to the exact PR head repository and branch. Never force-push. If permission or fork routing is unclear, stop and report the push command/target that needs authorization.
  7. Resolve the new PR head SHA and return to current-head monitoring. A push is progress, not completion.

Handle an unrelated or infrastructure failure

Retry only the failed jobs in the current selected-workflow run:

gh run rerun <RUN_ID> --failed --repo <OWNER/REPO>

Rules:

If GitHub cannot rerun only the failed portion of the selected run, stop and ask the user rather than rerunning the full workflow.

Completion check

Before completing the goal:

  1. Fetch the PR head SHA again.
  2. For every selected workflow, verify that its newest applicable run is for that exact SHA and concludes success.
  3. Verify no selected workflow is still pending and no success was invalidated by a newer push.
  4. Ignore all unselected workflows even if they are failing.
  5. Mark the goal complete only after all selected workflows satisfy these checks.

Report the final PR URL, head SHA, selected workflows, passing run links, any commits pushed, and retry counts. Keep the report scoped to the selected workflows.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.