claude-code - 💡(How to fix) Fix [FEATURE] CI monitor: surface branch-out-of-date (BEHIND) alongside failing checks

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Fix Action

Fix / Workaround

Workaround today: a custom /sync-main slash command that fetches origin/main, merges, and pushes. Requires the user to notice the PR is behind and invoke it manually — defeating the purpose of having a CI monitor at all.

A passive Stop-hook that runs git fetch && git rev-list --count HEAD..origin/main after each turn is another workaround but adds network cost to every assistant turn and is configured per-repo, not per-session.

RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing requests and this feature hasn't been requested yet
  • This is a single feature request (not multiple features)

Problem Statement

The CI monitor dropdown (the small CI chip in the desktop / agents view header) tracks GitHub Actions check status but doesn't reflect GitHub's mergeStateStatus. When a PR has all green checks but the branch is "out of date with the base branch" — a common protected-branch rule — the GitHub merge button is greyed out, yet the CI monitor stays green and silent.

Today the only way to notice this is to refresh the GitHub PR page, see the warning banner, then come back and ask Claude (or run a sync command) to merge main into the branch. The CI monitor knows everything else about the PR but skips this state.

Proposed Solution

Extend the CI monitor to query mergeStateStatus (already exposed by gh pr view --json mergeStateStatus and the GraphQL API) and surface it in the same dropdown as failing checks. A new state — e.g. BEHIND — would show a distinct icon and text like "Out of date with base; merge main to enable merging." Clicking it could optionally trigger a sync action (or just open the PR's update-branch GitHub page).

The same surface covers the other "merge-blocked" states GitHub exposes — BEHIND (out of date), DIRTY (conflicting), BLOCKED (gated by review). All three are cases where merge is blocked but CI alone is green — exactly the current gap.

Alternative Solutions

Workaround today: a custom /sync-main slash command that fetches origin/main, merges, and pushes. Requires the user to notice the PR is behind and invoke it manually — defeating the purpose of having a CI monitor at all.

A passive Stop-hook that runs git fetch && git rev-list --count HEAD..origin/main after each turn is another workaround but adds network cost to every assistant turn and is configured per-repo, not per-session.

Priority

Medium - Would be very helpful

Feature Category

Interactive mode (TUI)

Use Case Example

  1. Open Claude Code on a feature branch with an active PR.
  2. CI runs green; merge button on GitHub is enabled.
  3. Someone else merges a different PR to main; the protected-branch rule now requires this PR to be up to date.
  4. GitHub greys out the merge button. Claude Code's CI monitor stays green.
  5. I waste a few minutes wondering why merge is blocked — only finding the cause by refreshing the GitHub page.

With the proposed change, the CI monitor would flip to an "Out of date" state at step 4, eliminating step 5.

Additional Context

Related but distinct: #58649 asks for branch/merge state in the Agents view for non-PR sessions. This request is about the CI monitor for PR-linked sessions — same underlying GitHub data (mergeStateStatus / ahead-behind), different surface.

GitHub's mergeStateStatus is one of CLEAN | BEHIND | DIRTY | BLOCKED | UNSTABLE | HAS_HOOKS | UNKNOWN. BEHIND is the case described above; the others are also "merge blocked despite CI green" cases that would benefit from the same surface.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING