Pr delivery loop

From avibe-bot/avibe · View interactive version

Pr delivery loop is an AI agent skill from the GitHub repository avibe-bot/avibe. Deliver Avibe, avibe-bot-backend, avibe-docs, avault, and vault-sandbox PRs from worktree and implementation through Codex review, CI, and Merge. Use it for implementation work on every Agent backend.

How to use this skill

Skill file

PR Delivery

Your job is to deliver a change for real: pass review and CI, then Merge it, or drive it to Merge-ready so that only the user's approval remains. There is no intermediate "state" where you can stop. Whenever you are resumed, inspect the live situation first and answer two questions: what is still between this PR and Merge, and what is the most useful thing I can do now? Then do it.

The reasons behind these rules, with the failures that produced them, are in references/rationale.md. Read the relevant section when a rule seems wrong for your situation or a failure is unfamiliar; routine delivery does not need it.

Keep moving

Start and implement

Keep one Watch on the PR

The background-watch-hook skill owns Watch mechanics: scripts, cursors, filters, retries, and delivery acknowledgements. Load it before a managed wait. This skill defines only the principle: one persistent Watch per PR and owner (the orchestrator and each delegated lane are separate owners); arm it after creating the PR and before the first watched push or review trigger; keep it alive throughout delivery; remove it at close-out. Do not rebuild it or reset its cursor between rounds: doing so can consume already-arrived reviews as old events and make a completed review look silent. If the Watch actually fails, follow that skill's recovery procedure and preserve the evidence.

Codex review

Codex signals are easy to misread:

Findings and review threads

A finding belongs to the head on which it was raised. Compare it with the current code before deciding whether it still applies. After fixing and verifying it, explain the change in the thread and resolve it; do not wait for CI. If you do not fix it, explain why. For an intentional design that keeps recurring, cite the Known-by-design ledger. If another person's pending review prevents a reply, do not delete or dismiss it; preserve the draft, do other safe work, and retry after it is submitted or discarded. Reply to concrete threads only; do not post round summaries on the PR.

CI

Applicable CI is whatever this repository requires for this change. Every required workflow run for the current head must succeed or be explicitly skipped; if the same workflow still has any pending or failed run, it has not passed. Missing, queued, cancelled, timed out, awaiting approval, or unreadable results do not pass.

Unrelated third-party integrations (for example, Vercel checks from a client repository) should not block delivery: confirm they are not required checks and are unrelated to this change, mention that in the report, and continue instead of waiting for a terminal result. The same applies when they leave GitHub UNSTABLE rather than CLEAN.

When CI fails, reproduce the failing command or file locally first, then narrow the fix. If the PR is DIRTY and CI does not arrive, diagnose a conflict instead of continuing to wait.

Merge-ready

The PR is Merge-ready only when all of these are true:

These must all be facts about the current head. If any item is uncertain, treat it as not passed and go establish it.

Merge

Merge follows intent, not a fixed authorization phrase:

Before merging, recheck the Merge-ready conditions live and make sure no delegated lane is still writing this PR. Land dependency contracts before creating consuming PRs; independent Merge-ready PRs may merge without serially waiting for each other. Then:

gh pr merge <PR-URL> --squash --match-head-commit <verified-head-SHA>

--match-head-commit binds the merge to the verified head. Never use --admin, bypass actors, direct pushes to the protected branch, or weaker checks to get around a requirement. Command success or an auto-merge request is not MERGED; read the PR state back. If a branch ever requires a merge queue, this command only enqueues: keep the Watch, branch, and worktree until MERGED, and if the PR is dequeued, read the timeline reason, fix it, pass the exact-head gates again, and re-enqueue.

Only after GitHub reports MERGED, read back the merge commit and clean up this task's Watch, worktree, and branch without touching other work.

Merge does not authorize deployment, service restarts, or credential changes. Each needs the user's approval. Local regression updates follow the repository's own rule.

Talk to the user

Use the conversation's language and lead with the result. The user cares about what changed, why it matters, remaining risks, and the next step. SHAs, run counts, and thread counts are internal evidence; mention them only to explain a blocker or when asked. Do not turn the report into a gate checklist.

```text


[Merge PR]

```

If buttons are unavailable, say the same next step visibly and include the link.

Buttons belong only in user-facing replies, not lane reports or GitHub comments. When offering one, record the target PR and head internally. After a click, re-fetch live state for that PR; if the head changed or readiness was lost, explain it and offer again instead of using stale approval. If the target PR is unclear, ask rather than guess.

Delegation and lanes

Maintain this skill

Avibe's .agents/skills/pr-delivery-loop/ is the sole source of truth. After the change passes review, synchronize the entire maintained package, including references/, byte-for-byte to the mirrors in other repositories, preserving unrelated files in those repositories.

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.