Skip to content

chore: review workflow supports merge conflicts — Phase A0 before CI failures - #35

Merged
mhenrixon merged 2 commits into
mainfrom
chore/review-pr-merge-conflicts
Jul 9, 2026
Merged

chore: review workflow supports merge conflicts — Phase A0 before CI failures#35
mhenrixon merged 2 commits into
mainfrom
chore/review-pr-merge-conflicts

Conversation

@mhenrixon

@mhenrixon mhenrixon commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds a merge-conflict-aware full-review workflow: a new /github-review-pr orchestrator whose Phase A0 (merge conflicts) runs before the CI-failures phase, which runs before review comments.

Phase A0: detection via gh pr view --json mergeable, with a local git merge-tree --write-tree --name-only fallback for UNKNOWN that tests the PR's ACTUAL head (git fetch origin pull/<PR>/head + FETCH_HEAD, never the local HEAD), verifying both refs resolve before trusting merge-tree's exit code. Resolution: gh pr checkout, merge never rebase (the branch is shared; force-push is forbidden), semantic per-file rules, verification gates before pushing, plain git push. Loop-back rules: a new conflict mid-pass returns to A0; a new CI failure during comment work returns to Phase A. Phase C reports the A0 outcome (conflicted files, resolutions, merge SHA).

/github-ci-failures gains a detection-only pre-flight: on CONFLICTING it stops and hands off to the orchestrator (its toolset deliberately lacks the merge machinery); on UNKNOWN it proceeds.

Repo-specific adaptations (verified against this repo, not copied)

  • Child command name: the orchestrator invokes this repo's existing /github-ci-failures (not phlex-reactive's /github-review-failures) and /github-review-comments.
  • Lockfiles: all THREE tracked lockfiles get the never-hand-merge rule — root Gemfile.lock, docs/Gemfile.lock (re-resolve via bundle install), and docs/bun.lock (bun install in docs/). (In phlex-reactive only docs/Gemfile.lock is tracked.)
  • Version conflict rule holds here: rake release[X.Y.Z] aborts off-main and pushes the bump directly to origin/main, so a lib/daisy_ui/version.rb conflict means the branch bumped on purpose. lib/daisy_ui/updated_at.rb is machine-written each release → take the base's side.
  • register_modifiers merges must preserve the responsive variant comments (# "sm:...") above every modifier — Tailwind scans them; a merge that drops one silently breaks responsive classes.
  • No generated-artifact rules: docs CSS builds and tailwind.sources.css are gitignored, so phlex-reactive's min.js/vendored-twin regeneration rules were dropped — everything tracked merges semantically.
  • Verification gates are this repo's real CI commands: bundle exec rubocop lib spec, bundle exec rspec, and for docs/: bin/rubocop, bun run lint:js, bun run lint:css, bun run build:css && bundle exec rspec.
  • Check-name table matches the actual workflow jobs: Lint, Gem Tests (Ruby 3.2/3.3/3.4/4.0), Docs Lint, Docs Tests; run URLs point at mhenrixon/daisyui.
  • allowed-tools now covers every command each runbook instructs (gh pr list/checkout, git fetch/merge/merge-tree/rev-parse/status/switch, bundle install, bun, docs bin/rubocop); existing model: opus pins preserved.
  • CLAUDE.md slash-command table registers /github-review-pr.

Backport of zoolutions/phlex-reactive#220.

Summary by CodeRabbit

  • New Features
    • Added a new PR review command that guides a complete end-to-end pass: merge conflicts, CI failures, review comments, and final status reporting.
    • Expanded troubleshooting guidance for failed CI checks, including clearer steps for identifying checks and finding related logs.
  • Documentation
    • Updated command guidance to support more GitHub CLI and shell actions during PR workflows.
    • Added clearer instructions for handling merge conflicts, unknown mergeability, and common repo-specific conflict cases.

…failures

Backport of zoolutions/phlex-reactive#220, adapted to this repo:

- New /github-review-pr orchestrator: Phase A0 (merge conflicts) runs
  before CI failures, which run before review comments. Detection via
  gh pr view --json mergeable with a local git merge-tree fallback that
  tests the PR's actual head (git fetch origin pull/<PR>/head +
  FETCH_HEAD), ref verification before trusting exit codes, and the
  --name-only conflict list as the work list. Resolution is
  merge-never-rebase with repo-specific semantic rules.
- /github-ci-failures gains a detection-only merge-conflict pre-flight
  that hands off to the orchestrator, plus a check-name table matching
  the actual CI jobs (Lint, Gem Tests, Docs Lint, Docs Tests).
- allowed-tools frontmatter now covers every command each runbook
  instructs (gh pr list/checkout, git fetch/merge/merge-tree/rev-parse/
  status/switch, bundle install, bun, docs bin/rubocop).
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 53 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8d1d4c7a-728d-4776-8087-3ba4a4e4f411

📥 Commits

Reviewing files that changed from the base of the PR and between 9cfb50e and 14da429.

📒 Files selected for processing (1)
  • .claude/commands/github-review-pr.md
📝 Walkthrough

Walkthrough

Adds a new /github-review-pr orchestrator command runbook that sequences merge-conflict resolution, CI failure fixing, and review-comment resolution phases. Expands github-ci-failures.md with richer Phase 1 flow and tool permissions, extends github-review-comments.md allowed-tools, and registers the new command in CLAUDE.md.

Changes

PR review orchestration runbooks

Layer / File(s) Summary
CI failures runbook update
.claude/commands/github-ci-failures.md
Expands allowed-tools and replaces Phase 1 with PR confirmation, merge-conflict handling, and a check-to-log mapping table.
Review comments runbook update
.claude/commands/github-review-comments.md
Adds gh pr list to allowed-tools.
New review-pr command setup
.claude/commands/github-review-pr.md
Defines command metadata, purpose, required phase ordering, and Phase 0 PR detection/confirmation.
Merge-conflict resolution phase
.claude/commands/github-review-pr.md
Adds Phase A0 conflict-state handling, resolution procedure with repo-specific rules, verification gates, and exit criteria.
CI and comment phase delegation
.claude/commands/github-review-pr.md
Adds Phase A delegation to /github-ci-failures and Phase B delegation to /github-review-comments, each with exit criteria.
Final reporting and notes
.claude/commands/github-review-pr.md
Defines Phase C reporting and Important Notes governing phase ordering and loop-backs.
Command registry entry
CLAUDE.md
Adds /github-review-pr row to the slash command table.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ReviewPR as /github-review-pr
    participant CIFailures as /github-ci-failures
    participant ReviewComments as /github-review-comments
    participant GitHub

    User->>ReviewPR: invoke with PR number/branch
    ReviewPR->>GitHub: gh pr view (confirm PR)
    ReviewPR->>GitHub: check mergeable state
    alt CONFLICTING
        ReviewPR->>ReviewPR: resolve conflicts, push merge commit
    else UNKNOWN or MERGEABLE
        ReviewPR->>ReviewPR: proceed
    end
    ReviewPR->>CIFailures: delegate Phase A
    CIFailures->>GitHub: gh pr checks / fetch logs
    CIFailures-->>ReviewPR: exit criteria met
    ReviewPR->>ReviewComments: delegate Phase B
    ReviewComments->>GitHub: gh pr list / resolve threads
    ReviewComments-->>ReviewPR: exit criteria met
    ReviewPR->>GitHub: re-check mergeability/CI
    ReviewPR-->>User: final report
Loading

Poem

A rabbit hops through phases three,
Conflicts, then checks, then comments free 🐇
Merge, review, and CI green,
One tidy runbook, crisp and clean.
Thump-thump — the PR's now ready to ship! 🥕

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly reflects the new merge-conflict-aware review workflow and its Phase A0 ordering before CI failures.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.claude/commands/github-ci-failures.md (1)

14-18: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Unblock the blank-argument PR lookup.

git branch --show-current is used here, but Bash(git branch:*) isn’t in this command’s allowlist, so the auto-detect path will fail before it can resolve a PR. Add the permission or switch the snippet to a whitelisted branch lookup.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.claude/commands/github-ci-failures.md around lines 14 - 18, The auto-detect
path in the `$ARGUMENTS` parsing flow uses `git branch --show-current`, which is
blocked by the current allowlist and will fail before `gh pr list` runs. Update
the command in the `github-ci-failures` snippet to either use a whitelisted way
to determine the current branch or add the needed `git branch` permission so the
empty-argument PR lookup can resolve correctly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.claude/commands/github-review-pr.md:
- Around line 37-43: The auto-detect PR lookup uses git branch --show-current
inside the gh pr list command, but that git subcommand is not permitted by this
file’s toolset. Update the branch lookup in the github-review-pr command to use
the already-whitelisted git rev-parse --abbrev-ref HEAD, or otherwise add git
branch to the allowed tools, so the existing PR detection flow remains
executable.

---

Outside diff comments:
In @.claude/commands/github-ci-failures.md:
- Around line 14-18: The auto-detect path in the `$ARGUMENTS` parsing flow uses
`git branch --show-current`, which is blocked by the current allowlist and will
fail before `gh pr list` runs. Update the command in the `github-ci-failures`
snippet to either use a whitelisted way to determine the current branch or add
the needed `git branch` permission so the empty-argument PR lookup can resolve
correctly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 68f0d0e6-d968-40d6-8d75-25a7572faeda

📥 Commits

Reviewing files that changed from the base of the PR and between 86e055f and 9cfb50e.

📒 Files selected for processing (4)
  • .claude/commands/github-ci-failures.md
  • .claude/commands/github-review-comments.md
  • .claude/commands/github-review-pr.md
  • CLAUDE.md

Comment thread .claude/commands/github-review-pr.md
@mhenrixon
mhenrixon merged commit 1fc5a89 into main Jul 9, 2026
8 checks passed
@mhenrixon
mhenrixon deleted the chore/review-pr-merge-conflicts branch July 9, 2026 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant