Skip to content

fix: exit 1 when a PR's state could not be fetched during merge - #98

Merged
3 commits merged into
mainfrom
fix/merge-fetch-error-exit
Sep 27, 2026
Merged

3 commits merged into
mainfrom
fix/merge-fetch-error-exit

Conversation

@vitali87

Copy link
Copy Markdown
Owner

Problem

When get_pr_state returned nothing (expired gh session, API hiccup), merge logged a warning, recorded the group as skipped, and still finished with exit 0 and "Merge complete". Scripts and the webhook saw success for a run that never verified — let alone merged — the PR. The --auto polling path had the same gap: a fetch error while waiting was discarded and surfaced only as a generic incomplete_batch.

Fix

  • Sync path: fetch errors are collected in fetch_errors; the summary prints Could not fetch PR state for (N): … Check 'gh auth status' and re-run, the webhook gets exit_reason: "fetch_error" / success: false, and the command exits 1.
  • --auto path: _poll_for_merged reports polling fetch errors to the caller, which records them in fetch_errors and skipped like the sync path (siblings in the batch still merge).
  • fetch_error outranks unmerged_dependency in the webhook reason, since blocked children caused by an unfetchable parent are a symptom, not something "re-run once merged" fixes.
  • README's exit-1 sentence names the new cause.

Tests

Unfetchable sibling → exit 1, no "Merge complete", fetch_error; unfetchable parent with a child → fetch_error (not unmerged_dependency); fetch error during --auto polling → fetch_error with the group in skipped. All fail on base.

Local review: 5/5. 452 tests pass, ruff clean. Stacked on #67.

A get_pr_state failure was recorded as a skip and the run still ended
with exit 0 and 'Merge complete', so a broken gh session or transient
API error looked like success to scripts and webhooks. Report the
affected groups, exit 1, and send exit_reason=fetch_error.
@coderabbitai

coderabbitai Bot commented Aug 30, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 50 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 6ec68460-1cdf-48bf-ae75-e6d7e23244d1

📥 Commits

Reviewing files that changed from the base of the PR and between 671a081 and 4b4bab2.

📒 Files selected for processing (3)
  • README.md
  • pr_split/cli.py
  • tests/test_cli_new_features.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015rnEEjXWDBdePRhKMmZr1w
@vitali87 vitali87 closed this pull request by merging all changes into main in 8ca9e3b Sep 27, 2026
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.

2 participants