agentleFS
rotnovrotnov/pycc/.claude/skills/gha-watch-ci-pr/SKILL.md

gha-watch-ci-pr

Skill2 starsChanged 3 months agoMITView on GitHub

Use when driving the pycc autonomous-delivery autopilot loop and deciding how to wait on async state — a pull request, a CI run, or any dispatched `Agent`. Provides `ci-watch.sh` for PR/CI polling and rules for serialization, session identification, and dispatched-agent lifecycles.

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 2 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Run via Monitor (persistent: false, generous timeout_ms — the script exits on its own):

    line 16
  2. Very specific:

    When every failing check is CANCELLED (no genuine FAILURE/TIMED_OUT among them), the line adds a hint that this is often a partial-rerun or …

    line 44
  3. Very specific:

    After STALE, update the branch and re-arm a fresh Monitor call for the remaining PR(s) — the script does not retry a resolved PR itself.

    line 49
  4. Very specific:

    If ci-watch.sh is not applicable (e.g.

    line 52
  5. Very specific:

    Add a footer line identifying the session and client, e.g.: Session: claude-code <$CLAUDE_CODE_SESSION_ID>.

    line 68
  6. Distinctive:

    Default to serializing: fully land one PR before opening the next.

    line 76
  7. Distinctive:

    Instead: check actual current state directly, or resume the agent.

    line 96

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Autopilot async monitoring

Procedural rules and tools for waiting on asynchronous state during the project's autonomous PR-by-PR delivery loop: pull requests, CI runs, and dispatched background agents.

Tools

scripts/ci-watch.sh — poll PRs until terminal state

Run via Monitor (persistent: false, generous timeout_ms — the script exits on its own):

scripts/ci-watch.sh <repo> <pr-number> [<pr-number> ...]

Polls every $POLL_INTERVAL seconds (default 10). Silent between polls. Emits exactly one line per PR when it reaches a terminal state: MERGED/CLOSED, CONFLICTS, STALE (branch behind base), CHECK FAILED -- <name> (<conclusion>)[, ...] (every non-passing check named), BLOCKED (all checks completed with no failures but not CLEAN — typically an unresolved required review), or READY (all green + CLEAN). READY and BLOCKED are only reported after the same verdict holds on two consecutive polls, and — when the base branch's required status contexts are readable — only once every required context is present and completed in the rollup, so a gap between chained workflows cannot resolve the watch early however long the next workflow takes to register; a required context that stays missing for $REQ_MISS_POLLS consecutive polls (default 30) drops the binding with one non-terminal NOTE and the confirmation alone remains, so a name-mismatched context cannot suppress the verdict forever; a head change (new push) resets the confirmation. An empty statusCheckRollup (Actions not started yet) is never terminal — after $EMPTY_NOTE_POLLS consecutive empty polls (default 30) the script emits one non-terminal NOTE line (once per consecutive-empty streak, so it can recur after a later non-empty poll) and keeps watching.

When every failing check is CANCELLED (no genuine FAILURE/TIMED_OUT among them), the line adds a hint that this is often a partial-rerun or GitHub Actions infra artifact — see issue-implement's "Attribute CI failures before reacting" step for how to act on it.

After STALE, update the branch and re-arm a fresh Monitor call for the remaining PR(s) — the script does not retry a resolved PR itself.

If ci-watch.sh is not applicable (e.g. watching something that isn't a GitHub PR), write an equivalent poll-loop script that exits once every tracked item resolves, rather than reverting to a fixed ScheduleWakeup.

Rules

Check real state before waiting

Query actual current state directly — don't assume a prior plan is still accurate. For pull requests: check mergeStateStatus/mergeable and the check list (gh pr checks) before waiting on CI. For dispatched agents: look at their actual reported result, branch/worktree git log, or written artifacts — never assume "still running" without evidence.

Identify the session in every PR body

Add a footer line identifying the session and client, e.g.: Session: claude-code <$CLAUDE_CODE_SESSION_ID>. Makes background-dispatched PRs traceable back to the session that produced them.

Serialize PRs under strict branch protection

Under strict protection, opening multiple PRs in parallel creates a race: merging any one immediately makes every other open PR STALE/BEHIND. Default to serializing: fully land one PR before opening the next.

Draft-then-ready queuing lets you prepare more than one PR's worth of work concurrently: open every independent change as a draft PR, mark only one "Ready for review" at a time. Land it fully, then rebase the next queued draft onto the new main, mark it ready, and let its CI run.

Monitor only active work

Scope monitoring to what the current task genuinely depends on. Don't keep checking on PRs, branches, or tasks from earlier, already-merged or superseded milestones.

Don't stop-and-wait on dispatched agents

A dispatched agent's notification fires only when it stops with no live background children of its own. If it ends its turn while a background shell, container, or Monitor-watched process is still running, the notification is deferred — potentially arbitrarily long.

Instead: check actual current state directly, or resume the agent. Never end your own turn to "wait for the notification."

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.