К основному содержанию
скилл CX Codex

pr-merge-ready — скилл для Claude Code: что делает и как установить

Скилл pr-merge-ready закрывает замечания к пулл-реквесту за один проход: группирует правки по файлам, валидирует код один раз и не спамит комментариями в тредах.

Apache-2.0 ★ 5 622 обновлён 2026-11-17

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add weave-os/router --skill pr-merge-ready -a claude-code
Открыть на GitHub

Что делает pr-merge-ready

Скилл автоматизирует подготовку пулл-реквеста к мержу. Сначала он разбирает все открытые треды и присваивает каждому действию статус: исправить, отклонить, пропустить или эскалировать. Правки группируются по файлам. Каждый файл открывается и модифицируется ровно один раз. Вместо постоянных проверок после каждой правки валидация запускается единожды и только для затронутых файлов. В репозиторий уходит один коммит и один пуш, что исключает лишние шестиминутные циклы CI.

В тредах ревью действует жёсткий запрет на публикацию ответов через gh pr comment или вызовы API. Если замечание отклонено, тред закрывается без текстового ответа, а объяснение причин скилл выводит прямо в чат пользователю. Для ботов cursor[bot], cubic-dev-ai[bot] и weave-checks[bot] ручной резолв не вызывается: они сканируют пуш и закрывают ветку сами. Треды от людей и остальных ботов закрываются вручную.

Без локального скрипта ./.claude/skills/pr-merge-ready/scripts/pr-fix-plan.sh скилл не запустится, так как он не рассчитан на запуск из системного PATH. Для работы также требуются авторизованный GitHub CLI (gh auth status), установленный jq версии 1.6+ и тулчейн Go. Спорные архитектурные или продуктовые решения скилл не принимает самостоятельно — он делает паузу и задаёт вопрос разработчику.

Какие задачи решает

  • Разобрать скопившиеся замечания ревьюеров в пулл-реквесте
  • Сгруппировать правки по файлам и применить их за один проход
  • Сократить лишние перезапуски тестов и сборок в CI
  • Эскалировать человеку продуктовые и архитектурные развилки

Примеры запросов агенту

  • /pr-merge-ready
  • Разбери замечания в PR #42 и подготовь ветку к мержу
  • Примени правки ревьюеров к PR и запусти тесты для затронутых файлов

Как установить pr-merge-ready

1Через Skills CLI (Vercel)

npx skills add weave-os/router --skill pr-merge-ready -a claude-code

2Вручную: положить файлы

~/.claude/skills/pr-merge-ready/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/pr-merge-ready/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о pr-merge-ready

Как установить pr-merge-ready в Claude Code?

Выполните команду npx skills add weave-os/router --skill pr-merge-ready -a claude-code.

Что делает скилл pr-merge-ready?

Он классифицирует все комментарии в PR, пачкой применяет исправления к файлам, проводит разовую проверку кода и отправляет один коммит для экономии прогонов CI.

Какие системные требования нужны для запуска?

Потребуются утилита jq версии 1.6 или выше, авторизованный клиент gh auth status, тулчейн Go и локальный скрипт scripts/pr-fix-plan.sh из папки скилла.

Исходный текст

SKILL.md · Apache-2.0
---
name: pr-merge-ready
description: Addresses all review comments on a PR automatically. Escalates genuine human decisions. Use when asked to /pr-merge-ready, create and babysit a PR, batch-fix PR comments, or address review feedback quickly.
---

# PR Merge Ready (one pass, then validate once)

It follows the same merge-ready loop (threads resolved, reviewers done, CI green) with a **speed contract**:

1. **Triage every open thread before editing any file.**
2. **Apply every Fix in one pass** (group by file; one file is opened/edited once).
3. **Validate once**, after all edits, scoped to the files you touched — never after each comment.
4. **One commit, one push** per iteration. Extra pushes cost ~6–7 min of CI each and re-trigger bot reviewers.
5. **Comments first, CI second.** Never sit in a CI wait while unresolved actionable threads exist.

Do **not** auto-fix decisions that belong to a human. Product/architecture/scope/intent trade-offs are **Escalate** — pause, ask with options grounded in existing patterns, wait. Never guess.

**This repo is public.** Commit messages, code comments, and fixtures written while fixing feedback follow the root `CLAUDE.md` rule: no customer/org names, org IDs, emails, or private ticket/Slack links — describe triggers generically.

## Absolute rule: never reply on PR threads

**Never post a reply or comment on any PR review thread** — no `addPullRequestReviewThreadReply`, no `gh pr comment`, no posted text of any kind. Where you would otherwise reply (declines, decided escalations), **resolve the thread silently** and **surface the rationale to the user in chat**. Resolving a thread is a status change, not a reply, and is allowed.

## Which reviewers auto-resolve their own threads

Not every reviewer needs a manual `resolveReviewThread` call. Some bots re-scan the pushed commit and close their own thread once the flagged issue is gone; calling `resolveReviewThread` on those threads yourself is redundant, and for weave-checks it's actively wrong — it marks a thread resolved against a code state the bot never re-verified.

| Reviewer                                                         | Auto-resolves?                              | Action                                                                                                                                              |
| ---------------------------------------------------------------- | ------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| `cursor[bot]` (Cursor Bugbot)                                    | Yes, once it re-scans and the issue is gone | **Fix:** push the code change only — do not call `resolveReviewThread`. **Decline:** resolve manually (there's nothing new for the bot to re-scan). |
| `cubic-dev-ai[bot]` (Cubic)                                      | Yes, same as above                          | Same as Cursor Bugbot.                                                                                                                              |
| `weave-checks[bot]` (body carries `<!-- weave-check:<slug> -->`) | Yes, same as above                          | Same as Cursor Bugbot.                                                                                                                              |
| `greptile-apps[bot]`                                             | No                                          | Always resolve manually — Fix and Decline both.                                                                                                     |
| Human reviewers                                                  | No                                          | Always resolve manually — Fix and Decline both.                                                                                                     |
| Any other/unrecognized author                                    | Assume no                                   | Always resolve manually. Only skip the mutation for the three named auto-resolving bots above.                                                      |

Identify the author(s) from each `unresolved_comments` entry's `authors` field (or the `<!-- weave-check: -->` marker in `body`) during triage, and carry that classification into the resolve step.

**Reading a weave-checks finding against its own criteria.** The marker's `<slug>` maps to a repo-local `.weave-checks/<slug>.md` if one exists, else to the default check `starter-checks/<slug>.md` in `weave-os/checks` at the release tag pinned in `.github/workflows/weave-checks.yml` (this repo runs with `use-default-checks: true`). When triaging a `weave-checks[bot]` thread, read that file — "Do Not Flag"/"Exclusions" is the fastest false-positive check:

```bash
REF=$(sed -nE 's#.*weave-os/checks/.github/workflows/weave-checks.yml@(v[0-9]+\.[0-9]+\.[0-9]+).*#\1#p' .github/workflows/weave-checks.yml)
gh api "repos/weave-os/checks/contents/starter-checks/<slug>.md?ref=$REF" -H 'Accept: application/vnd.github.raw'
```

**Collapsed threads and mixed authorship:** `pr-fix-plan` collapses same-location threads into one entry with a deduplicated `authors` list and a separately deduplicated `thread_ids` list — the two are **not positionally paired**. Apply the auto-resolving-bot exception only when **every** entry in `authors` is one of the three auto-resolving bots. If mixed, resolve **all** of that entry's `thread_ids` manually.

## Prerequisites

- GitHub CLI authenticated: `gh auth status`
- `jq` 1.6+ installed
- Stacked PRs: `gh stack` extension
- On the PR branch locally, or provide PR number
- Use the bundled analyzer at `./.claude/skills/pr-merge-ready/scripts/pr-fix-plan.sh`; do not assume `pr-fix-plan.sh` is installed on `PATH`
- Go toolchain; `golangci-lint` is optional locally (reported as blocked by `scripts/agent_checks.py` when missing — CI still runs it)

## Commit workflow

**NEVER `git add -A`.** Stage only files you changed.

1. Lint/format autofix on changed files (included in the one validation pass, Step 4)
2. `git add <specific files>`
3. `git commit -m "message"`
4. `git push` (in a stack: push only the branches you changed — see [Stacks](#stacks-one-loop-for-the-whole-stack))

If the branch is out of date: `git push --force-with-lease` only after verifying you don't overwrite someone else's work. Never raw `git push --force`.

## High-level loop

```
0. Identify or create PR; align checkout with the PR's base repository and head SHA
0b. WEAVE-CHECKS PREFLIGHT: read weave-checks criteria for the files in play
1. Fetch fresh state
2. If DONE → exit
3. If actionable threads:
   a. TRIAGE ALL threads first (Fix / Decline / Skip / Escalate)
   b. Surface Escalates in one AskQuestion batch; wait if they block
   c. APPLY ALL Fixes in one pass (group by file)
   d. Resolve all Declines (and decided Escalates) silently
   e. Validate ONCE, scoped to touched files (Step 4) + re-run weave checks
   f. One commit + one push
   g. Go to step 1 — do NOT wait for CI yet
4. Else (zero actionable threads):
   a. Foreground CI-wait with cheap comment sentinel (Step 6)
   b. New comment → abort CI wait, go to Step 1
   c. CI all green + DONE → exit
```

### DONE conditions (ALL must hold against the LATEST head SHA)

Exit only when every condition is true on the same poll, _after CI has dispatched for the current head SHA_:

1. **No actionable review comments** — `unresolved_comments` is empty, or every remaining entry is Skip, `is_outdated: true`, or the issue no longer applies (`code_context`). For any thread in the skip ledger (an auto-resolving-bot thread left open under the exception): if the bot has closed it, count DONE; if the bounded fallback has **not** yet fired (≥2 pr-fix-plan polls AND ≥5 min), **do not count DONE and do not force-resolve** — wait for the bot. Only after that window, if the thread is still open, force-resolve, surface the deviation, then count DONE. Escalate threads awaiting a user decision **block DONE**. Unapplied Fix nits from `top_level_comments` (including advisory review bodies) also block DONE. If `reviews_fetch_failed` or `conversation_comments_fetch_failed` is true, feedback is incomplete and DONE is blocked.
2. **All required CI checks for the head SHA are present and concluded.**
3. **No CI pending/running** — `checks_summary.pending == 0` and `checks_fetch_failed` is absent. If `checks_fetch_failed: true`, CI is unknown — do not count as done.
4. **No `REVIEW_REQUESTED`** — `reviewRequests` is empty.
5. **No `CHANGES_REQUESTED`** — `reviewDecision` is not `CHANGES_REQUESTED`; each `latestReviews` state is `APPROVED`, `COMMENTED`, or `DISMISSED`.
6. **Architecture gates pass on the head** — see [Architecture gates](#architecture-gates-before-declaring-done).

## Stacks: one loop for the whole stack

When the PR is part of a GitHub Stack (`gh stack view --short`, or `gh api repos/<owner>/<repo>/stacks`), run **one** loop for the whole stack, not one loop per PR. CI and the bot reviewers run on a PR when its own head moves (`opened`/`synchronize`), not when its parent branch moves. A lower fix reaches the branches above only when you rebase them, and each rebase force-pushes those branches and re-runs everything on them. So fix every PR's own findings in the same cycle, but rebase each upper branch onto its parent once, after the parent is green, not after every lower fix. Bots review each PR's diff alone, so many findings belong to a different layer than the one they are filed on.

- **One writer.** A single agent owns every branch checkout, commit, rebase and push for the stack. Helpers (subagents) may only triage or draft edits for one PR and hand them back; they never push.
- **One cycle covers every PR:**
  1. Fetch Step 1 state for every PR in the stack (in parallel), bottom to top.
  2. Triage all threads and failing checks across the stack together. Attribute each to the PR that **introduced** the code (`git log -L`/`git blame` on the top branch), and fix it there, even when it was filed or fails on a higher PR. A "no caller" / "unused" finding on a lower PR is a Decline when a higher PR uses it (`git grep` on the top branch). A CI failure on a higher PR caused by a lower PR's code is fixed in the lower PR; the higher PR stays red until its cascade, so don't patch it there.
  3. Fix each affected branch on its current base, without rebasing: check it out, apply its fixes, run Step 4 on it, and commit. Its diff against its parent doesn't change, so its existing reviews still apply.
  4. Push only the branches you changed (`git push origin <branch>`; no rebase, so no force). Branches above them keep their CI and review state.
  5. Resolve threads per PR as in Step 5, then watch every PR with the Step 6 sentinel; new activity on any PR starts the next cycle.
- **Cascade once per layer, bottom-up.** When a PR meets the DONE conditions and the branch directly above it doesn't contain its tip, check out that branch and run `gh stack rebase --downstack --no-trunk` (resolve conflicts with `gh stack rebase --continue`). Rerun Step 4 on that branch's own files (`git diff --name-only <parent>...HEAD`), then `gh stack push`. That PR's post-rebase review round is handled by the normal cycle. Repeat for the next branch up. If a parent changes again after its child was cascaded, cascade the child again. Until its cascade, an upper PR that conflicts only because its parent moved skips the Step 1 conflict gate; resolve that conflict during its cascade. In a stack the conflict gate applies only to the bottom PR conflicting with trunk: from the bottom branch run `gh stack rebase --downstack`, then `gh stack push`.
- **DONE** when every PR meets the DONE conditions on its current head and each branch contains its parent's tip. The 5-iteration cap counts stack cycles. Merge (`gh stack merge`) only when asked.

## Execution

### Step 0: Identify or create the PR and align the local branch

Single-PR scoped. Use the user's PR number, else infer from the current branch. If the branch has
no PR yet, create one before fetching review state:

1. Ensure the intended changes are committed. Stage only the changed files; **never** use `git add -A`.
2. Push the branch, using `git push -u origin HEAD` when it has no upstream.
3. Open a ready-for-review PR with `gh pr create --base main` (do not pass `--draft` unless the user explicitly asks).
4. Capture the resulting PR number and continue with the same workflow below.

If there are no changes to publish and no PR exists, stop and ask the user what should be reviewed.

Resolve `OWNER/REPO` to the PR's **base repository** from the current repository context. The head owner/repository identify the fork containing the code; do not pass those values to the analyzer, which queries the PR in its base repository.

```bash
read -r OWNER REPO < <(gh repo view --json owner,name --jq '[.owner.login, .name] | @tsv')
gh pr view "${PR_NUMBER:-}" --repo "$OWNER/$REPO" \
  --json number,headRepositoryOwner,headRepository,headRefName,headRefOid \
  -q '{number: .number, head_owner: .headRepositoryOwner.login, head_repo: .headRepository.name, branch: .headRefName, sha: .headRefOid}'
```

If the base repository cannot be resolved from the checkout, use the base repository explicitly; never substitute the fork's head repository.

For a mid-stack PR (`gh stack view --short`), run `gh stack checkout <headRefName>` when needed, then verify `git rev-parse HEAD` equals the PR's `headRefOid`. For a non-stack PR, use the PR number and base repository so GitHub CLI can select the correct fork ref; do not check out by branch name alone:

```bash
# Stop rather than switching away from uncommitted work.
test -z "$(git status --porcelain)" || { echo "Working tree is dirty" >&2; exit 1; }
gh pr checkout "$PR_NUMBER" --repo "$OWNER/$REPO" --branch "pr-${PR_NUMBER}-${HEAD_SHA:0:12}"
test "$(git rev-parse HEAD)" = "$HEAD_SHA" || { echo "PR head SHA mismatch" >&2; exit 1; }
```

If that unique local branch already exists at a different commit, choose another unused local name rather than resetting it. Before editing or pushing, verify the local branch tracks the PR head ref from `head_owner/head_repo`. If the checkout or upstream cannot be verified safely, stop and ask. Fixes always go on the PR's own head branch.

### Step 0b: Weave-checks preflight (once, before any triage or edit)

Read the weave-checks criteria (repo-local `.weave-checks/*.md`, else the pinned `starter-checks/*.md` — see "Reading a weave-checks finding" above) that apply to the files this PR touches, plus the `CLAUDE.md` guide of each touched package. Reviewer asks that contradict those guides (layering, magic provider strings, logging keys, tautological tests) are Decline or Escalate, not Fix.

### Step 1: Fetch fresh PR state (every iteration)

Re-fetch every iteration. Never reuse stale data. **Do not hand-roll GraphQL for review threads.**

```bash
./.claude/skills/pr-merge-ready/scripts/pr-fix-plan.sh "$PR_NUMBER" --owner "$OWNER" --repo "$REPO" --max-comments 0 --json
gh pr view "$PR_NUMBER" --json headRefOid,reviewDecision,reviewRequests,latestReviews
```

`--max-comments 0` = no display cap. pr-fix-plan paginates all review threads (fails loudly past 20 pages / 2,000 threads). GitHub orders threads oldest-first and resolved threads never leave the connection — a single-page `first:100` fetch goes permanently blind past 100 total threads.

`pr-fix-plan --json` returns:

- `head_branch`, `head_sha`, and `is_checked_out` — `is_checked_out` means the local `HEAD` SHA equals the PR head SHA; if false, use Step 0's safe checkout rather than checking out by branch name alone
- `changed_files` — do NOT re-derive via `git diff`
- `unresolved_comments` — unresolved, collapsed. Each has `file`, `line`, `start_line`, `authors`, `body`, `urls`, `thread_ids`, `is_outdated`, `collapsed_count`, `code_context`, `related_lines_in_pr`, `thread_comments`
- `top_level_comments` — omitted when empty
- `pattern_summary`
- `checks` / `checks_summary` — if `checks_fetch_failed: true`, the empty list is NOT trustworthy
- `reviews_fetch_failed` / `conversation_comments_fetch_failed` — if true, feedback is incomplete and DONE is blocked

Skip `is_outdated: true` entries when counting actionable work. Also skip any whose `code_context` shows the issue is already addressed.

`top_level_comments` are not line-anchored. Triage them the same Fix/Decline/Escalate/Skip way, but they have no `thread_ids` to GraphQL-resolve — Fix by editing, Decline/Skip by noting in chat only.

**Advisory review bodies are nitlists.** Bots such as `workweave-bot` post `COMMENTED` reviews with zero threads and a body listing several nits across files; these arrive as `top_level_comments` entries with `source: "review"`. Split each body into **one item per nit** and triage each individually — an empty `unresolved_comments` does not mean "no feedback". Track which nits you've applied across iterations (by review URL + nit) so an already-applied body isn't re-triaged; it stays on the PR forever.

**Comment-first:** any non-Skip entry whose issue still applies → Steps 2–5 immediately. Do not wait for CI, even if checks are running or failed.

**CI-wait:** only when zero actionable comments → Step 6.

### Step 2: Triage ALL unresolved threads before touching code

Walk every actionable `unresolved_comments` entry **before any edit**. Produce a batch plan:

```
Fix     : [thread ids / files]
Decline : [thread ids + one-line rationale]
Escalate: [thread ids]
Skip    : [thread ids]
```

Announce this list to the user, then execute. Do not drip-triage (classify one, edit, classify next).

| Category | Type                                                                 | Action                                                   |
| -------- | -------------------------------------------------------------------- | -------------------------------------------------------- |
| Fix      | Bug, security, style, clear refactor, nit                            | Implement in the Step 3 pass                             |
| Decline  | False positive, already handled, would make code worse, out of scope | No code change; resolve silently; note rationale in chat |
| Escalate | Genuine human decision                                               | Do not change code. Ask (Step 3.5)                       |
| Skip     | Pure questions / discussion                                          | Leave unresolved                                         |

**Fix vs Escalate.** Fix = one objectively-correct resolution matching existing patterns. Escalate signals:

- Product / UX / behavior change
- Architectural trade-off with lasting consequences
- Scope expansion beyond the PR
- Ambiguous intent only the author knows
- Conflicting reviewers
- Risk / blast radius (security, data integrity, billing, migrations)

When in genuine doubt between Fix and Escalate, **Escalate**. (Low-stakes mechanical nits still default to Fix.)

**Bot `suggestion` blocks are authoritative.** When a bot (`workweave-bot`, `greptile-apps[bot]`, `cubic-dev-ai[bot]`, …) offers a fenced ```` ```suggestion ```` replacement — especially comment-length / doc-brevity nits — it is a Fix: apply the replacement **verbatim**. Don't paraphrase or skip because the existing wording seems fine. Only decline if applying it would break the build or contradict a package `CLAUDE.md` rule. Free-form bot feedback without a `suggestion` block is triaged like any other comment.

### Step 3: Apply the whole Fix set in one pass

**Do not validate, commit, or push inside this step.**

1. Group Fix threads by file. Open each file once.
2. Use `code_context` and `related_lines_in_pr` instead of re-reading the diff / grepping. Open the file only for surrounding context.
3. Apply every requested change in that file, including every `related_lines_in_pr` site (fix the pattern once, everywhere it appears in the PR).
4. Move to the next file.
5. Independent files may be edited in parallel (multiple Edit/Write calls in one turn). Dependent edits (same file, or A must land before B compiles) stay serial.

Guidelines: only the changes requested; no unrelated refactors.

#### Decline

No code change, no PR reply. Resolve in Step 5. Collect one concise chat line each: what was asked, why you're declining (1–3 sentences, specific).

#### Skip

Leave alone.

#### Escalate → Step 3.5

Never change code or resolve on your own.

1. Investigate first (referenced file/line, surrounding code, how similar cases are handled).
2. Frame each thread: reviewer ask + link; why it needs a human; 2–4 options grounded in existing patterns with trade-offs; your recommendation.
3. Present **all** escalations in one `AskQuestion` batch.
4. If the user has not responded and the only remaining work is escalations, **stop the loop** — do not spin or sit in CI wait. Resume from Step 1 when they answer.
5. Once they choose, treat the chosen option as a Fix (fold into the current pass if you haven't validated yet; otherwise a new iteration). Resolve silently. If they defer, leave unresolved — the PR is blocked on it.

Do not auto-resolve an escalated thread. Do not let it slip through as a Fix because asking felt slower.

### Step 4: Validate ONCE, scoped to what you touched

Run this **after every Fix in this iteration is applied**, and **never per comment**. Skip the whole step if this iteration was all-Decline (no files changed).

Scope to **this iteration's uncommitted edits**.

```bash
CHANGED_FILES=()
while IFS= read -r -d '' file; do
  [[ -f $file ]] && CHANGED_FILES+=("$file")
done < <({
  git diff --name-only -z
  git diff --cached --name-only -z
  git ls-files --others --exclude-standard -z
})
```

#### Autofix first (so formatting lands in the same commit)

Format only existing Go paths from this iteration's `CHANGED_FILES`; do not run a repository-wide write formatter here.

```bash
GO_FILES=()
for f in "${CHANGED_FILES[@]}"; do [[ $f == *.go ]] && GO_FILES+=("$f"); done
((${#GO_FILES[@]})) && gofmt -w -- "${GO_FILES[@]}"
```

#### Regenerate if a generator input changed

Generated files must land in the same commit, or CI fails on drift. Never hand-edit `internal/sqlc/` or `AGENTS.md`.

| Touched                                                       | Run                              |
| ------------------------------------------------------------- | -------------------------------- |
| `db/queries/`, `db/migrations/`                               | `make generate`                  |
| `internal/router/policy/inference_registry.go`                | `make generate-inference-policy` |
| `internal/router/catalog/` model/pricing data                 | `make generate-statusline`       |
| Any `CLAUDE.md`                                               | `make generate-agent-guides`     |
| `install/directives.tsv`, `install/registry.sh`               | `make embed-registry`            |

#### Then run the scoped checks

```bash
# Tests for the touched Go packages only (whole-module `go test ./...` is CI's job)
if ((${#GO_FILES[@]})); then
  GO_PKGS=($(for f in "${GO_FILES[@]}"; do echo "./$(dirname "$f")"; done | sort -u))
  go vet "${GO_PKGS[@]}" && go test -count=1 "${GO_PKGS[@]}"
fi
# Request-path / dispatch / policy / provider edits:
make inference-boundary
# Discover any other suites the touched paths select (docs, lint, install, frontend, smoke):
python3 scripts/agent_checks.py plan --paths "${CHANGED_FILES[@]}"
```

Run the non-Go suites the planner selects that are cheap and local (`docs`, `install`, `lint` if `golangci-lint` is installed; `cd frontend && npm run typecheck && npm run lint` for `frontend/`). Suites the planner marks `integration: true` (smoke, database) are left to CI — say so in chat; never report them as passed.

### Step 5: One commit, one push, then resolve

**Push before resolving human/Greptile Fix threads.** Resolving first and then failing the push leaves threads closed against code that never landed. Declines have no code change, so they can resolve immediately.

Resolve all Decline threads now. After a successful push, resolve Fix threads and decided Escalates — **except** the auto-resolving-bot exception below. Use each entry's `thread_ids` (collapsed comments may list more than one — resolve every id).

**Auto-resolving-bot exception (Fix only):** for a Fix whose `authors` are entirely `cursor[bot]`, `cubic-dev-ai[bot]`, or `weave-checks[bot]`, do **not** call `resolveReviewThread` — push and let the bot close it. Declines on those same threads still need a manual resolve. Greptile and humans always get a manual resolve.

**Bounded fallback:** carry a skip ledger `(thread_id, first_seen_unresolved_at)`. On every **full** pr-fix-plan poll inside Step 6 (~2 min cadence, not the cheap sentinel), if a skipped bot thread has been open across **≥2 full pr-fix-plan polls AND ≥5 min** since first seen, force-resolve it and tell the user the bot never closed it. Fire this from Step 6 too — Step 5 may never run again during a CI wait.

```bash
gh api graphql -f query='
  mutation($threadId: ID!) {
    resolveReviewThread(input: {threadId: $threadId}) { thread { isResolved } }
  }
' -f threadId='{THREAD_ID}'
```

Then **one** commit and **one** push (skip if no files changed):

```bash
git add path/to/fixed1.go path/to/fixed2.tsx
git commit -m "fix: address PR review feedback (iteration N)

Fixed:
- [summary of fix 1]
- [summary of fix 2]

Declined (with explanation):
- [summary of declined 1]"
git push   # stack: push only changed branches; cascade upper branches separately (see Stacks)
PUSHED_HEAD_SHA=$(git rev-parse HEAD)
# now resolve human/Greptile Fix thread_ids (Declines already resolved above)
```

If push is rejected as out of date: `gh stack sync` (or `git fetch origin && git rebase origin/main`) then `git push --force-with-lease`. Never raw `--force`. Do not resolve Fix threads until the push succeeds.

**After push:** enter the Step 6 watcher. Do not run an in-band `pr-fix-plan`. Auto-reviewers file new threads on the new commit asynchronously — "zero threads right before push" is meaningless for the new SHA.

Skipped bot Fix threads may still show `isResolved: false` until the bot re-scans. If `code_context` shows the issue is gone, treat as non-actionable — but not merge-ready until the bot closes it or the bounded fallback fires.

### Step 6: Foreground CI wait with comment sentinel

**Enter only when Step 1 found zero actionable threads.** The instant the sentinel detects a new unresolved thread, abort and return to Step 1.

A naive `gh pr checks` right after push reports `pending=0` because GitHub has not dispatched yet. Anchor on the head SHA; validate dispatch before treating CI as done.

#### Cheap sentinel + full fetch-on-fire

Do not run `pr-fix-plan` every 15s (~2s/call). Poll a cheap GraphQL sentinel; full `pr-fix-plan` only when something changed.

- **Sentinel** every 15–30s (~0.3s): unresolved count plus newest review-thread, review-body, and conversation-comment timestamps. Tune toward 15s in the first 2 min after push (bots are most active); 30s later.
- **Full fetch** when the sentinel fires, or every ~2 min for CI status.

This pins the session. That is the point: responsiveness.

#### Sentinel query

`CAPTURED_UNRESOLVED_COUNT` / `CAPTURED_THREAD_TOTAL` are taken from **one sentinel read at CI-wait entry**. Baseline and every poll must count the same population — every non-outdated unresolved thread, including Skip and pending auto-resolving-bot threads. Do **not** derive the baseline from pr-fix-plan's actionable count (that excludes those, so every poll looks like "new thread").

The sentinel MUST read the **newest** page (`last:100`, never `first:100`). GitHub orders oldest-first and resolved threads stay forever, so `first:100` reports `unresolved=0` on busy PRs while new comments sit at the tail.

```bash
gh api graphql -f query='
  query($owner: String!, $repo: String!, $pr: Int!) {
    repository(owner: $owner, name: $repo) {
      pullRequest(number: $pr) {
        headRefOid
        reviewThreads(last: 100) {
          totalCount
          edges {
            node {
              isOutdated
              isResolved
              comments(last: 1) { edges { node { updatedAt } } }
            }
          }
        }
        reviews(last: 10, states: [COMMENTED, APPROVED, CHANGES_REQUESTED]) {
          edges { node { updatedAt } }
        }
        comments(last: 1) { edges { node { updatedAt } } }
      }
    }
  }
' -f owner="$OWNER" -f repo="$REPO" -F pr="$PR_NUMBER" --jq '
  .data.repository.pullRequest | {
    sha: .headRefOid,
    thread_total: .reviewThreads.totalCount,
    unresolved: [.reviewThreads.edges[].node | select(.isResolved == false and .isOutdated == false)] | length,
    latest_thread_timestamp: ([.reviewThreads.edges[].node.comments.edges[].node.updatedAt] | sort | last),
    latest_review_timestamp: ([.reviews.edges[].node.updatedAt] | sort | last),
    latest_conversation_comment_timestamp: ([.comments.edges[].node.updatedAt] | sort | last)
  }
'
```

`thread_total` is the arrival detector (monotonic — resolved threads never leave). `unresolved` is the state detector. Compare **both** to the entry baseline. `unresolved` alone misses a swap (new thread filed in the same interval an old one closed). A **reply on an existing unresolved thread** changes neither count — detect it via `latest_thread_timestamp`. The separate `latest_review_timestamp` and `latest_conversation_comment_timestamp` detect new top-level review bodies and conversation comments even when no thread is unresolved.

#### Watcher loop

```
captured_unresolved_count, captured_thread_total = one sentinel read at entry
last_seen_sha = HEAD_SHA
last_seen_thread_timestamp, last_seen_review_timestamp, last_...

© weave-os · Apache-2.0 · weave-os/router

Похожие скиллы

Все скиллы по теме «Код-ревью и рефакторинг» →
om-approve-merge-pr open-mercato Скилл om-approve-merge-pr для Claude Code, Codex, Cursor и других AI-редакторов одобряет PR и выполняет squash-merge по одному номеру. CX Codex +1 4 300установок om-merge-buddy open-mercato Скилл om-merge-buddy сканирует открытые пуллреквесты через трекер и сортирует их по готовности к слиянию в режиме чтения. Ничего не меняет в репозитории. CX Codex +1 3 600установок re0-merge LilMGenius Скилл re0-merge для Claude Code проводит ревью и слияние внешних пулл-реквестов с сохранением авторства. Агент оценивает вклад по правилам проекта перед подтверждением изменений. CX Codex +1 1 400установок merge-risk alexj11324 Скилл merge-risk для Claude Code оценивает уровень риска перед слиянием пуллреквеста. Запускается при проверке изменений перед мержем ветки. CX Codex +1 ★ 88звёзд репо babysit thedotmack Скилл babysit для Claude Code следит за пул-реквестом: проверяет CI, комментарии и треды ревью, пока все замечания не закрыты. CX Codex +1 5 400установок merge-open-prs jssblck Скилл merge-open-prs для Claude Code собирает список открытых PR, выбирает порядок и сливает их через GitHub. Последовательно обрабатывает несколько PR. CX Codex +1 1 700установок

Из того же набора20

Весь набор →
router-session Скилл router-session для Codex печатает идентификатор сессии, который Weave Router использует в телеметрии и логах. Идентификатор используют для поиска запуска в панели роутера. CX Codex +1 ★ 5 622звёзд репо force-parent Скилл force-parent закрепляет текущую ветку разговора за выбранной моделью через Weave Router. Субагенты при этом маршрутизируются сами — пригодится, когда одна задача требует другой модели. CX Codex +1 ★ 5 622звёзд репо models Команда models показывает список доступных моделей в Weave Router и переключает их прямо из чата без перезапуска роутера. CX Codex +1 ★ 5 622звёзд репо router-models Скилл router-models для Claude Code и Codex показывает модели Weave Router, меняет их статус и порядок предпочтения. CX Codex +1 ★ 5 622звёзд репо lsp-guide Скилл lsp-guide учит агента спрашивать языковой сервер, где определён символ, где он используется и что сломалось после правки, вместо поиска по тексту. CX Codex +1 ★ 5 622звёзд репо debug-claude-session Скилл debug-claude-session находит локальный транскрипт сессии Claude Code и сопоставляет его с облачными логами роутера по времени и модели. Помогает понять, почему клиент отобразил пустой или битый блок. CX Codex +1 ★ 5 622звёзд репо test-claude-locally Скилл test-claude-locally для Claude Code запускает локальный Weave router в Docker Compose и проверяет маршрутизацию через claude -p. Воспроизводит баги и проверяет модели. CX Codex +1 ★ 5 622звёзд репо test-codex-locally Скилл test-codex-locally поднимает роутер Weave в docker compose и гоняет его через codex exec в отдельном CODEX_HOME: воспроизводит баги маршрутизации, проверяет маркеры и /force-model. CX Codex +1 ★ 5 622звёзд репо

Спонсоры проекта

Компании, которые помогают держать аналитику открытой