Skip to content

t1048: Fix auto-rebase: handle AI-completed rebase and increase max attempts#1478

Merged
marcusquinn merged 1 commit intomainfrom
feature/t1048
Feb 14, 2026
Merged

t1048: Fix auto-rebase: handle AI-completed rebase and increase max attempts#1478
marcusquinn merged 1 commit intomainfrom
feature/t1048

Conversation

@marcusquinn
Copy link
Owner

@marcusquinn marcusquinn commented Feb 14, 2026

Summary

Fixes the auto-rebase failure in deploy.sh where resolve_rebase_conflicts() spawns an AI agent that completes the rebase itself, causing the subsequent git rebase --continue to fail with "fatal: no rebase in progress".

Changes

  1. Detect rebase-already-done state: Check for REBASE_HEAD before running git rebase --continue. If the AI agent has already completed the rebase, skip the continue step.

  2. Increase max_rebase_attempts: Changed from 2 to 5 to handle 10+ sibling PRs without hitting the limit prematurely.

  3. Applied to both code paths: Fixed both the worktree and non-worktree rebase paths in rebase_sibling_pr().

Testing

  • ✅ ShellCheck passes (pre-existing warnings in unrelated code)
  • ✅ Bash syntax validation passes
  • ✅ Logic verified: checks REBASE_HEAD existence before attempting continue

Impact

Unblocks 17 PRs that were failing due to this race condition.

Ref #1476

Summary by CodeRabbit

  • Chores
    • Enhanced pull request automation robustness by improving conflict resolution and rebase continuation logic, increasing retry tolerance from 2 to 5 attempts before blocking.

- Check for REBASE_HEAD before running git rebase --continue
- AI agent may complete rebase itself, causing "no rebase in progress" error
- Increase max_rebase_attempts from 2 to 5 for 10+ sibling PRs
- Applied fix to both worktree and non-worktree code paths
@gemini-code-assist
Copy link

Summary of Changes

Hello @marcusquinn, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical issue in the automatic rebase mechanism where an AI agent completing a rebase prematurely would cause subsequent git rebase --continue commands to fail. By introducing a check for the rebase state and increasing the maximum rebase attempts, the system is now more robust, preventing rebase failures and unblocking numerous dependent pull requests.

Highlights

  • Rebase Completion Detection: Implemented a check for the existence of REBASE_HEAD before attempting git rebase --continue. This prevents failures when an AI agent has already completed the rebase process, avoiding the 'fatal: no rebase in progress' error.
  • Increased Rebase Attempts: The maximum number of automatic rebase attempts has been increased from 2 to 5, providing more resilience for handling multiple sibling pull requests without prematurely hitting the rebase limit.
  • Comprehensive Application: The rebase completion detection and retry logic improvements have been applied consistently to both the worktree and non-worktree rebase paths within the rebase_sibling_pr() function.
Changelog
  • .agents/scripts/supervisor/deploy.sh
    • Increased the max_rebase_attempts variable from 2 to 5.
    • Added a conditional check using git rev-parse --verify REBASE_HEAD before executing git rebase --continue in the non-worktree rebase path.
    • Added a conditional check using git rev-parse --verify REBASE_HEAD before executing git rebase --continue in the worktree rebase path.
Activity
  • The author verified ShellCheck passes (with pre-existing warnings in unrelated code).
  • The author confirmed Bash syntax validation passes.
  • The author verified the logic by checking REBASE_HEAD existence before attempting continue.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 14, 2026

Caution

Review failed

The pull request is closed.

Walkthrough

The deployment script is enhanced to improve pull request rebase automation by increasing retry limits from 2 to 5 attempts and refining rebase continuation logic. After AI-based conflict resolution, the script now detects via REBASE_HEAD whether the rebase was completed by the AI agent or requires manual continuation, with proper abort and branch-return handling across multiple code paths.

Changes

Cohort / File(s) Summary
Rebase Automation Improvements
.agents/scripts/supervisor/deploy.sh
Increased automatic rebase retry attempts to 5; enhanced rebase_sibling_pr with AI-resolved conflict detection (REBASE_HEAD checks) and continuation/abort logic; applied consistent error handling and branch-return behavior across multiple rebase paths.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related issues

  • Issue #1476: Directly addresses the same fixes—raising max rebase attempts to 5 and updating rebase_sibling_pr to detect and handle AI-completed rebases with conditional skip/continue/abort logic.

Possibly related PRs

  • PR #1355: Updates auto-retry logic in supervisor pulse that invokes rebase_sibling_pr, making it directly dependent on the rebase continuation behavior enhanced here.
  • PR #1203: Also modifies rebase_sibling_pr to integrate AI-assisted conflict resolution with REBASE_HEAD detection and branch-return handling, mirroring the patterns introduced in this PR.

🔄 Five chances now to rebase with grace,
AI resolves the merge space,
Check the HEAD, continue or rest,
Branch returns home—automation at its best!

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/t1048

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 and usage tips.

@github-actions
Copy link

🔍 Code Quality Report

�[0;35m[MONITOR]�[0m Code Review Monitoring Report

�[0;34m[INFO]�[0m Latest Quality Status:
SonarCloud: 0 bugs, 0 vulnerabilities, 5 code smells

�[0;34m[INFO]�[0m Recent monitoring activity:
Sat Feb 14 14:53:40 UTC 2026: Code review monitoring started
Sat Feb 14 14:53:40 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 5

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 5
  • VULNERABILITIES: 0

Generated on: Sat Feb 14 14:53:43 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

@sonarqubecloud
Copy link

@marcusquinn marcusquinn merged commit f5cc4b7 into main Feb 14, 2026
9 of 11 checks passed
@marcusquinn marcusquinn deleted the feature/t1048 branch February 14, 2026 14:55
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request effectively addresses the auto-rebase failure by checking if a rebase is already complete before attempting to continue. Increasing the max rebase attempts is also a sensible adjustment for handling a larger number of sibling PRs.

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