Interactive git bisect assistant with pattern detection and automation
Interactive git bisect assistant that guides you through finding the exact commit that introduced a bug or change. Use it when you need to pinpoint which commit caused a regression, but don't know which one.
/plugin marketplace add openshift-eng/ai-helpers/plugin install git@ai-helpers[good-commit] [bad-commit]git:bisect
/git:bisect # Fully interactive - will ask for all inputs
/git:bisect [good-commit] [bad-commit] # With commit references
The git:bisect command is an interactive git bisect assistant that helps find the exact commit that introduced a specific change (bug, behavior change, feature, performance regression, etc.) using binary search.
What This Command Does:
Git bisect uses confusing terms. This command uses clearer labels:
| What You See | Git Term | Meaning |
|---|---|---|
| "Change IS in the code" | bad | The change you're looking for EXISTS in this commit |
| "Change is NOT in the code" | good | The change you're looking for does NOT exist yet |
Never use "good" or "bad" alone - always explain what they mean in context.
1. Provide (or select) reference commits
↓
2. Describe what change you're looking for
↓
3. [If criterion is clear] Confirm understanding → Choose manual/auto
↓
4. Evaluate commits (manually or automatically)
↓
5. Receive final report with culprit commit
↓
6. Clean up (git bisect reset)
At any point during the bisect, you can:
skip if a commit cannot be tested (build failure, unrelated issue)Arguments provided: $ARGUMENTS
Parse arguments:
You may NEVER execute git bisect good or git bisect bad without explicit user confirmation.
Even if you're 100% certain, you MUST ask first. No exceptions.
If the user describes a criterion that you can verify programmatically (e.g., "when dependency X was updated to version > Y"), and you have ≥70% confidence you understand it correctly:
BEFORE evaluating any commit, present your understanding with maximum precision:
"Based on your description, I believe you're looking for: [exact criterion with specific details]
To verify this, I would check: [specific file/command/method]
Is this correct?"
Wait for user response. Then:
If user confirms the criterion is correct, ask:
"Would you like me to automatically evaluate commits based on this criterion? I will show each decision as I make it."
If user says the criterion is wrong:
If you don't have ≥70% confidence initially, or after a criterion reset:
When automation is enabled (user explicitly said yes):
git bisect good or git bisect badRun git bisect log to check if a bisect is in progress.
If bisect IS in progress:
git bisect reset and optionally start freshIf NO bisect in progress: Continue to Step 1.2
Run git status --porcelain to check for uncommitted changes.
If there are uncommitted changes:
git stash push -m "Pre-bisect stash"If commits were provided as arguments:
git rev-parse <commit>git log -1 --format="%h %s" <commit>)If commits were NOT provided:
git log --oneline -20Validate the relationship:
Ask the user:
What change are you looking for?
Please describe:
- What behavior or code changed?
- How can you determine if a commit has or doesn't have this change?
- Is there a specific file, function, or behavior to check?
Store this description for analysis.
After the user describes the change, analyze their response:
If you have ≥70% confidence that you understand a verifiable criterion:
Present your understanding with maximum precision:
"Based on your description, I believe you're looking for: [exact criterion]
To verify this, I would check: [specific method]
Is this correct?"
WAIT for user response before proceeding.
If user confirms:
"Would you like me to automatically evaluate commits based on this criterion? I will show each decision as I make it."
If user says criterion is wrong:
Only proceed to Step 1.6 after this interaction is complete.
Execute:
git bisect start
git bisect bad <commit-with-change>
git bisect good <commit-without-change>
Parse the output to show:
Maintain a session log throughout the bisect:
## Session Log
**Search criterion**: [user's description]
**Detected pattern**: [none yet / description]
**Confidence level**: [0-100%]
**Automation enabled**: [no / yes]
| Step | Commit | Files Changed | Verdict | Observation |
|------|--------|---------------|---------|-------------|
Display:
═══════════════════════════════════════════════════════════
TESTING COMMIT [step X of ~Y estimated]
═══════════════════════════════════════════════════════════
Commit: [short hash]
Author: [author name]
Date: [date]
Message: [subject line]
Files Changed:
[output of: git show --stat --format="" HEAD]
Summary: [X files changed, Y insertions(+), Z deletions(-)]
═══════════════════════════════════════════════════════════
If AUTOMATION MODE is enabled:
Commit [hash]: Checking [criterion]...
Result: [what you found]
Decision: Change [IS / is NOT] in the code → marking as [bad/good]
git bisect bad or git bisect goodIf MANUAL MODE (automation not enabled):
Ask the user:
Is the change you're looking for present in this commit?
[1] Change IS in the code (will mark as 'bad')
[2] Change is NOT in the code (will mark as 'good')
[3] Cannot test this commit (skip)
[4] Show more details (diff, full message)
[5] Abort bisect
If in manual mode and confidence reaches ≥70%:
Before showing options, present your understanding:
I've noticed a pattern: [description of what you've observed]
Based on this, I believe the change [IS / is NOT] in this commit.
Is this the criterion you're using? If so, would you like me to automate?
[1] Yes, that's correct - please automate
[2] Yes, that's correct - but I'll decide manually
[3] No, that's not what I'm looking for
[4] Show more details first
If user chooses [1] → Enable automation mode If user chooses [2] → Stay in manual mode but show suggestions If user chooses [3] → Reset pattern analysis, continue manual
Based on user response:
| Response | Action |
|---|---|
| Change IS in code | Run git bisect bad, record in log |
| Change NOT in code | Run git bisect good, record in log |
| Skip | Run git bisect skip, note why in log |
| Show details | Display requested info, ask again |
| Abort | Confirm, then run git bisect reset |
After each decision, update the internal log with:
When in manual mode, after each user decision:
Analyze correlations:
Update confidence based on how well patterns predict user decisions
When confidence reaches ≥70%:
Git bisect outputs "X is the first bad commit" when complete. Watch for this phrase.
When bisect completes, present:
═══════════════════════════════════════════════════════════
BISECT COMPLETE - CULPRIT FOUND
═══════════════════════════════════════════════════════════
THE COMMIT THAT INTRODUCED THE CHANGE
─────────────────────────────────────
Commit: [full hash]
Author: [author name] <[email]>
Date: [full date]
Message:
[full commit message]
Files Changed:
[git show --stat --format="" <hash>]
CHANGE SUMMARY
─────────────────────────────────────
Based on your search criterion: "[user's original description]"
This commit appears to have introduced the change by:
[Analysis of what changed in this commit that matches the criterion]
EVALUATION HISTORY
─────────────────────────────────────
| Step | Commit | Verdict | Key Files |
|------|---------|----------------------|------------------|
| 1 | abc1234 | Change present | src/main.rs |
| 2 | def5678 | Change NOT present | tests/test.rs |
| ... | ... | ... | ... |
SUGGESTED NEXT STEPS
─────────────────────────────────────
1. View full diff: git show [hash]
2. Compare with parent: git diff [hash]^..[hash]
3. Revert this commit: git revert [hash]
4. Blame specific file: git blame [file] | grep [hash]
═══════════════════════════════════════════════════════════
Ask:
"The bisect session is complete. Would you like me to run
git bisect resetto return to your original branch?"
If yes, run git bisect reset and confirm the branch returned to.
| Error | Solution |
|---|---|
| "You need to start by 'git bisect start'" | Bisect was interrupted; restart the process |
| "Bad rev input: X" | Invalid commit reference; ask for correction and show recent commits |
| "Some good revs are not ancestors of the bad rev" | Commits are in wrong order; explain and offer to swap |
| Merge conflict during checkout | Suggest git bisect skip for this commit |
| "Cannot bisect on a detached HEAD" | This shouldn't happen normally; offer to reset |
If user requests abort at any point:
git bisect resetgit bisect log > bisect-log-$(date +%Y%m%d-%H%M%S).txtFully interactive - no arguments:
/git:bisect
Will show recent history and ask you to select commits.
With commit references:
/git:bisect v1.28.0 HEAD
Uses tag v1.28.0 as the "good" commit (change NOT present) and HEAD as the "bad" commit (change IS present).
With commit hashes:
/git:bisect abc1234 def5678
Mixed references:
/git:bisect v1.0.0 main
Final Report: A comprehensive report showing:
Session cleanup: Offers to run git bisect reset to return to original branch
[good-commit] (optional): A commit reference (hash, tag, branch) where the change is NOT present. This is the older, "known good" state.[bad-commit] (optional): A commit reference where the change IS present. This is the newer state that contains the change you're looking for.Notes: