Batch pr resolver

From MoonLadderStudios/MoonMind · View interactive version

Batch pr resolver is an AI agent skill from the GitHub repository MoonLadderStudios/MoonMind. Discover open PRs in a repository, optionally limited to selected PR numbers, and enqueue one `pr-resolver` task for each.

How to use this skill

Skill file

Batch PR Resolver Skill

Purpose

Create one queue task per open pull request so each PR branch can be resolved by pr-resolver on its existing branch. Fork PRs are skipped.

This parent batch skill does not publish repository changes itself. It records

child workflow queueing evidence in artifacts/batch_pr_resolver_result.json;

each queued existing-PR coordinator delegates repository publication to its pr-resolver children and owns their durable external waits.

The coordinator's execution-local publish mode none does not override the

children's auto publishing contract. Preserve any explicit user restriction

on child publishing; do not infer one from the coordinator's local mode.

Inputs (skill args)

Workflow

The helper requires Python 3 and httpx, plus gh for discovery. Keep the

portable _shared/workflow_execution_client.py beside the skill directories;

resolved snapshots include it automatically. No MoonMind or API-service

installation is required. Resolve helpers exclusively from the run's immutable

active bundle:

BATCH_PR_RESOLVER_SKILL_DIR="${BATCH_PR_RESOLVER_SKILL_DIR:-${MOONMIND_ACTIVE_SKILLS_DIR:+$MOONMIND_ACTIVE_SKILLS_DIR/batch-pr-resolver}}"
test -n "$BATCH_PR_RESOLVER_SKILL_DIR" && test -f "$BATCH_PR_RESOLVER_SKILL_DIR/SKILL.md"

Inside MoonMind, MOONMIND_ACTIVE_SKILLS_DIR is always set; a checked-in

.agents/skills directory must never shadow the selected snapshot. When no

skill-specific override is present, the helper resolves to

${MOONMIND_ACTIVE_SKILLS_DIR:-.agents/skills}/batch-pr-resolver/bin/batch_pr_resolver.py.

Outside

MoonMind, set BATCH_PR_RESOLVER_SKILL_DIR to the directory containing this

SKILL.md (no MoonMind-only environment variables required). A missing

selected helper is a materialization/packaging error: stop as blocked instead

of substituting stale repository code.

  1. Run the helper script:
python3 "$BATCH_PR_RESOLVER_SKILL_DIR/bin/batch_pr_resolver.py" \
  --repo <owner/repo> \
  --state <open|merged|closed> \
  --max-attempts 3 \
  --priority 0 \
  --merge-method squash \
  --max-iterations 5 \
  --runtime-mode <runtime_mode> \
  --runtime-model <model> \
  --runtime-effort <effort> \
  --runtime-provider-profile <profile_id>
  1. Map inputs to flags:

Always forward the parent task's explicit runtime selection fields when they are present so the queued pr-resolver tasks reuse the same runtime, model, effort, and provider profile instead of falling back to the deployment default runtime.

Carry user constraints into every child through childInstructions; pass

--child-instructions explicitly when no task context is materialized.

The adopting PR coordinator carries these instructions through its durable

gate into each repair and final resolver pass.

When the request names specific PRs or a PR range (for example "Select PRs

from #4724 to #4746"), pass that selection with --pull-requests so the

helper filters discovery before it submits anything. Never wrap, shim, or

monkeypatch the helper to narrow its selection; a selection the flag cannot

express is a blocker to report, not a reason to queue every open PR.

  1. For each selected open PR in the target repo (every open PR when no selection is given):

require the canonical workflowId in the response, and verify that ID via

GET /api/executions/{workflowId} before counting it as queued;

MOONMIND_URL must point at the MoonMind API from the managed session.

When MoonMind supplies MOONMIND_EXECUTION_FANOUT_BEARER_TOKEN_FILE

(preferred) or MOONMIND_EXECUTION_FANOUT_BEARER_TOKEN, read and forward

the execution-scoped bearer and mark both calls as fan-out v1. A declared

token file that is missing or empty is a hard failure; do not fall back to

the ambient value.

  1. Write one summary artifact at batch_pr_resolver_result.json under the managed session artifact spool path when available, otherwise under the configured --artifacts-dir. For the default artifacts path, use a materialized task context's artifact directory when present; a missing context never redirects writes outside the current run workspace. The helper binds it to MOONMIND_STEP_EXECUTION_ID and records running before discovery, then queued, no_op, partial_failure, or failed. MoonMind validates this terminal evidence before accepting completion; a clean harness exit with no result is incomplete.
  2. On any submission or verification error, write skill_outcome.json with a

failed or partial status so the managed runtime cannot report the batch

as successful.

  1. Print a short count summary to stdout (queued, skipped, errors).

Security constraints

(isCrossRepository=true) or whose head is not on owner/repo are recorded

as fork-pr skips. There is no fork-inclusion option; queued pr-resolver

jobs cannot reliably check out fork-only head refs.

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.