Skip to content

t1072, t1073: Multi-commit rebase loop + sequential subtask dispatch#1558

Merged
marcusquinn merged 1 commit intomainfrom
bugfix/t1071-pulse-mergedat-crash
Feb 17, 2026
Merged

t1072, t1073: Multi-commit rebase loop + sequential subtask dispatch#1558
marcusquinn merged 1 commit intomainfrom
bugfix/t1071-pulse-mergedat-crash

Conversation

@marcusquinn
Copy link
Owner

@marcusquinn marcusquinn commented Feb 17, 2026

Summary

Two fixes that address the root cause of 5 tech-stack PRs being permanently stuck in merge-conflict blocked state:

t1072: Multi-commit rebase loop

  • Problem: rebase_sibling_pr() resolved conflicts for the first commit, called git rebase --continue, but if the next commit also conflicted, it aborted the entire rebase
  • Fix: Extract conflict resolution into _resolve_rebase_loop() — a while loop (max 10 iterations) that keeps resolving conflicts and continuing until the rebase completes or a resolution fails
  • Also: Deduplicates the resolution logic that was copy-pasted for worktree vs non-worktree paths

t1073: Sequential subtask dispatch

  • Problem: Subtasks (t1063, t1063.1, t1063.2, t1063.3) were dispatched in parallel, each branching from the same main commit. They all modified the same files (tech-stack-helper.sh, tech-stack-lookup.md), so when the first merged, all siblings conflicted
  • Fix: cmd_next() now checks if a queued subtask has earlier siblings still in non-terminal states. If so, it defers the subtask until the earlier sibling completes. Subtasks dispatch sequentially by suffix order automatically
  • No TODO.md parsing needed — works purely from the supervisor DB using task ID pattern matching (t1063.%)

Impact

  • Unblocks: t1063, t1063.1, t1064, t1065, t1068 (via rebase loop)
  • Prevents recurrence for all future subtask groups (via sequential dispatch)

Closes #1556
Closes #1557

Summary by CodeRabbit

  • Refactor
    • Centralized and improved rebase conflict resolution for more reliable automated merges
    • Enhanced task dispatch logic to better manage interdependent tasks and respect processing limits

…1073)

t1072: Add _resolve_rebase_loop() to deploy.sh — wraps the AI conflict
resolution + git rebase --continue cycle in a while loop (max 10
iterations) so branches with multiple conflicting commits are fully
rebased instead of aborting after the first conflict. Replaces the
duplicated single-shot resolution logic in both worktree and non-worktree
code paths.

t1073: Add subtask sibling sequencing to cmd_next() in state.sh — when
selecting queued tasks for dispatch, skip subtasks (IDs like t1063.2) if
any earlier sibling (t1063.1) is still in a non-terminal state. This
prevents parallel dispatch of subtasks that modify the same files,
eliminating the merge conflicts that caused 5 tech-stack PRs to stall.
Subtasks now dispatch sequentially by suffix order automatically.
@marcusquinn marcusquinn merged commit 5925ab6 into main Feb 17, 2026
7 of 8 checks passed
@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 introduces critical fixes to the supervisor's task management and Git rebase capabilities. It resolves issues where multi-commit branches would fail to rebase correctly after the first conflict, and where related subtasks would cause conflicts by being dispatched in parallel. These changes significantly improve the robustness of automated PR merging and prevent recurring merge conflicts for interdependent tasks, unblocking several existing PRs and ensuring smoother future operations.

Highlights

  • Multi-commit rebase loop fixed: The rebase_sibling_pr() function now correctly handles multiple conflicts during a rebase by extracting conflict resolution into a _resolve_rebase_loop() function. This new function iteratively resolves conflicts and continues the rebase for up to 10 commits, preventing premature abortion of multi-commit rebases.
  • Sequential subtask dispatch implemented: The cmd_next() function has been updated to ensure subtasks (e.g., t1063.1, t1063.2) are dispatched sequentially. It checks for earlier siblings that are still in non-terminal states and defers the current subtask until those siblings complete, preventing parallel execution that led to merge conflicts.
Changelog
  • .agents/scripts/supervisor/deploy.sh
    • Introduced _resolve_rebase_loop function to handle multi-commit rebase conflicts iteratively.
    • Refactored rebase_sibling_pr to utilize the new _resolve_rebase_loop for both worktree and non-worktree paths, removing duplicated conflict resolution logic.
  • .agents/scripts/supervisor/state.sh
    • Modified cmd_next to implement logic for sequential subtask dispatch, deferring subtasks if earlier siblings are still active.
    • Increased the LIMIT for candidate task selection to allow for filtering of deferred subtasks.
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 17, 2026

Caution

Review failed

The pull request is closed.

Walkthrough

This pull request centralizes AI-assisted rebase conflict resolution into a dedicated loop function and adds filtering to prevent parallel execution of interdependent subtasks, improving reliability of multi-commit rebases and task dependency handling.

Changes

Cohort / File(s) Summary
Rebase Conflict Resolution Refactor
.agents/scripts/supervisor/deploy.sh
Introduces _resolve_rebase_loop() helper function to encapsulate iterative AI-assisted conflict resolution with iteration capping. Consolidates scattered inline rebase logic from rebase_sibling_pr() into a single configurable loop, covering both worktree and non-worktree paths with consistent abort/cleanup behavior.
Subtask Dependency Filtering
.agents/scripts/supervisor/state.sh
Extends cmd_next() candidate selection with sibling-subtask filtering to prevent parallel execution of dependent tasks. Expands candidate fetch limit by factor of 3, detects in-flight earlier siblings by subtask ID suffix, and defers execution of tasks with unresolved predecessors.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Poem

🔄 A loop to tame the rebase dance,
While siblings wait their rightful chance—
Conflicts resolved with patience deep,
Dependencies in order kept! ✨

✨ 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 bugfix/t1071-pulse-mergedat-crash

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, 16 code smells

�[0;34m[INFO]�[0m Recent monitoring activity:
Tue Feb 17 01:21:50 UTC 2026: Code review monitoring started
Tue Feb 17 01:21:51 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 16

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 16
  • VULNERABILITIES: 0

Generated on: Tue Feb 17 01:21:53 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

@sonarqubecloud
Copy link

marcusquinn added a commit that referenced this pull request Feb 17, 2026
marcusquinn added a commit that referenced this pull request Feb 17, 2026
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 introduces two important fixes: a robust rebase loop for multi-commit branches and a sequential dispatch mechanism for subtasks to prevent merge conflicts. The changes are well-structured, particularly the refactoring in deploy.sh which deduplicates the rebase logic.

My review includes a few suggestions for improvement:

  • In deploy.sh, there's a minor violation of the shell style guide and an opportunity to improve efficiency by moving a repeated command out of a loop.
  • In state.sh, I've identified a potential N+1 query performance issue and a risky error suppression pattern that could mask database problems.

Addressing these points will enhance the robustness and maintainability of the new logic.

AND id != '$(sql_escape "$cid")'
AND CAST(REPLACE(id, '$(sql_escape "$parent_id").', '') AS INTEGER) < $suffix
AND status NOT IN ('verified','cancelled','deployed','complete');
" 2>/dev/null || echo "0")

Choose a reason for hiding this comment

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

high

Suppressing stderr with 2>/dev/null and defaulting to 0 with || echo "0" is risky. It can mask underlying database errors (e.g., a malformed query, DB corruption), causing the script to proceed with incorrect assumptions. This could lead to subtasks being dispatched out of order. This also violates the repository style guide (line 50), which prohibits blanket error suppression. It would be safer to let the script fail on a database error so the problem can be investigated.

References
  1. 2>/dev/null is acceptable ONLY when redirecting to log files, not blanket suppression (link)

Comment on lines +2141 to +2142
local git_dir="$1"
local task_id="$2"

Choose a reason for hiding this comment

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

medium

This function violates the repository's shell script style guide. Line 11 requires declaring local variables and assigning values from positional parameters in separate statements to ensure exit code safety (e.g., local var; var="$1").

Suggested change
local git_dir="$1"
local task_id="$2"
local git_dir; git_dir="$1"
local task_id; task_id="$2"
References
  1. Use local var="$1" pattern in functions (declare and assign separately for exit code safety) (link)

Comment on lines +2158 to +2159
local git_state_dir
git_state_dir="$(git -C "$git_dir" rev-parse --git-dir 2>/dev/null)"

Choose a reason for hiding this comment

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

medium

The git_state_dir variable is calculated on each loop iteration by calling git rev-parse --git-dir. Since the .git directory path is constant within the scope of this function, this call can be moved outside and before the while loop. This would improve efficiency by avoiding redundant process execution and also remove the need for the second identical call on line 2174.

Comment on lines +962 to +988
while IFS=$'\t' read -r cid crepo cdesc cmodel; do
[[ "$count" -ge "$limit" ]] && break

# Check if this is a subtask (contains a dot)
if [[ "$cid" == *.* ]]; then
local parent_id="${cid%.*}"
local suffix="${cid##*.}"

# Check if any earlier sibling (same parent, lower suffix) is non-terminal
local earlier_active
earlier_active=$(db "$SUPERVISOR_DB" "
SELECT count(*) FROM tasks
WHERE id LIKE '$(sql_escape "$parent_id").%'
AND id != '$(sql_escape "$cid")'
AND CAST(REPLACE(id, '$(sql_escape "$parent_id").', '') AS INTEGER) < $suffix
AND status NOT IN ('verified','cancelled','deployed','complete');
" 2>/dev/null || echo "0")

if [[ "$earlier_active" -gt 0 ]]; then
log_info " cmd_next: deferring $cid — earlier sibling(s) of $parent_id still active"
continue
fi
fi

printf '%s\t%s\t%s\t%s\n' "$cid" "$crepo" "$cdesc" "$cmodel"
count=$((count + 1))
done <<<"$candidates"

Choose a reason for hiding this comment

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

medium

This while loop executes a database query for every candidate subtask. This is a classic N+1 query problem and can be inefficient, especially if the number of candidate tasks is large. Consider fetching the status of all potentially relevant sibling tasks in a single query before the loop, then performing the filtering logic in memory within the loop. This would significantly reduce the number of database round-trips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant