Skip to content

fix: include base branch in AI title suggestion prompt#1080

Merged
myakove merged 1 commit into
mainfrom
fix/issue-1019-ai-title-diff
Apr 30, 2026
Merged

fix: include base branch in AI title suggestion prompt#1080
myakove merged 1 commit into
mainfrom
fix/issue-1019-ai-title-diff

Conversation

@myakove

@myakove myakove commented Apr 30, 2026

Copy link
Copy Markdown
Collaborator

Problem

The AI prompt for conventional title suggestions told the AI to "look at the recent commits and changes" without specifying the base branch. When the worktree state didn't clearly show PR changes (e.g., after force-push/amend), the AI had no context and returned invalid suggestions like "The PR branch is identical to main with no code changes."

Fix

Updated the prompt to include explicit git commands with the base branch name:

  • git diff origin/{base_ref} — shows the actual PR diff
  • git log origin/{base_ref}..HEAD --oneline — shows commit messages

The prompt is now constructed inside the worktree block (after base_ref is fetched via github_api_call), ensuring the AI always has concrete instructions for finding the diff.

Changes

  • webhook_server/libs/handlers/runner_handler.py — moved prompt inside worktree block, added base_ref fetch, updated prompt with explicit git commands

Testing

  • All 164 runner handler tests pass
  • All 83 conventional title tests pass
  • ruff check/format clean
  • mypy clean

Closes #1019

@coderabbitai

coderabbitai Bot commented Apr 30, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@myakove has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 43 minutes and 22 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 72ddd2d1-cdb6-426a-9672-7b10e784eb3d

📥 Commits

Reviewing files that changed from the base of the PR and between b367d71 and b12c1ba.

📒 Files selected for processing (1)
  • webhook_server/libs/handlers/runner_handler.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/issue-1019-ai-title-diff

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
Review rate limit: 0/1 reviews remaining, refill in 43 minutes and 22 seconds.

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

@myakove-bot

Copy link
Copy Markdown
Collaborator

Report bugs in Issues

Welcome! 🎉

This pull request will be automatically processed with the following features:

🔄 Automatic Actions

  • Reviewer Assignment: Reviewers are automatically assigned based on the OWNERS file in the repository root
  • Size Labeling: PR size labels (XS, S, M, L, XL, XXL) are automatically applied based on changes
  • Issue Creation: Disabled for this repository
  • Pre-commit Checks: pre-commit runs automatically if .pre-commit-config.yaml exists
  • Branch Labeling: Branch-specific labels are applied to track the target branch
  • Auto-verification: Auto-verified users have their PRs automatically marked as verified
  • Labels: All label categories are enabled (default configuration)

📋 Available Commands

PR Status Management

  • /wip - Mark PR as work in progress (adds WIP: prefix to title)
  • /wip cancel - Remove work in progress status
  • /hold - Block PR merging (approvers only)
  • /hold cancel - Unblock PR merging
  • /verified - Mark PR as verified
  • /verified cancel - Remove verification status
  • /reprocess - Trigger complete PR workflow reprocessing (useful if webhook failed or configuration changed)
  • /regenerate-welcome - Regenerate this welcome message

Review & Approval

  • /lgtm - Approve changes (looks good to me)
  • /approve - Approve PR (approvers only)
  • /automerge - Enable automatic merging when all requirements are met (maintainers and approvers only)
  • /assign-reviewers - Assign reviewers based on OWNERS file
  • /assign-reviewer @username - Assign specific reviewer
  • /check-can-merge - Check if PR meets merge requirements

Testing & Validation

  • /retest tox - Run Python test suite with tox
  • /retest build-container - Rebuild and test container image
  • /retest python-module-install - Test Python package installation
  • /retest pre-commit - Run pre-commit hooks and checks
  • /retest conventional-title - Validate commit message format
  • /retest all - Run all available tests

Container Operations

  • /build-and-push-container - Build and push container image (tagged with PR number)
    • Supports additional build arguments: /build-and-push-container --build-arg KEY=value

Cherry-pick Operations

  • /cherry-pick <branch> - Schedule cherry-pick to target branch when PR is merged
    • Multiple branches: /cherry-pick branch1 branch2 branch3

Label Management

  • /<label-name> - Add a label to the PR
  • /<label-name> cancel - Remove a label from the PR

✅ Merge Requirements

This PR will be automatically approved when the following conditions are met:

  1. Approval: /approve from at least one approver
  2. LGTM Count: Minimum 1 /lgtm from reviewers
  3. Status Checks: All required status checks must pass
  4. No Blockers: No wip, hold, has-conflicts labels and PR must be mergeable (no conflicts)
  5. Verified: PR must be marked as verified

📊 Review Process

Approvers and Reviewers

Approvers:

  • myakove
  • rnetser

Reviewers:

  • myakove
  • rnetser
Available Labels
  • hold
  • verified
  • wip
  • lgtm
  • approve
  • automerge
AI Features
  • Conventional Title: Mode: fix (claude/claude-opus-4-6[1m])
  • Cherry-Pick Conflict Resolution: Enabled (claude/claude-opus-4-6[1m])
  • Test Oracle: Triggers: approved (claude/claude-opus-4-6[1m]); /test-oracle can be used anytime

💡 Tips

  • WIP Status: Use /wip when your PR is not ready for review
  • Verification: The verified label is removed on new commits unless the push is detected as a clean rebase
  • Cherry-picking: Cherry-pick labels are processed when the PR is merged
  • Container Builds: Container images are automatically tagged with the PR number
  • Permission Levels: Some commands require approver permissions
  • Auto-verified Users: Certain users have automatic verification and merge privileges

For more information, please refer to the project documentation or contact the maintainers.

The AI prompt for conventional title suggestions told the AI to "look at
the recent commits and changes" without specifying the base branch. When
the worktree state didn't clearly show PR changes, the AI had no context
and returned invalid suggestions.

Now the prompt includes explicit git commands with the base branch:
- `git diff origin/{base_ref}`
- `git log origin/{base_ref}..HEAD --oneline`

This ensures the AI always knows how to find the diff, regardless of the
worktree checkout state.

Closes #1019
@myakove myakove force-pushed the fix/issue-1019-ai-title-diff branch from fa9deed to b12c1ba Compare April 30, 2026 07:59
@myakove myakove merged commit 13b4936 into main Apr 30, 2026
7 of 9 checks passed
@myakove myakove deleted the fix/issue-1019-ai-title-diff branch April 30, 2026 08:02
@myakove-bot

Copy link
Copy Markdown
Collaborator

New container for ghcr.io/myk-org/github-webhook-server:latest published

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: AI title suggestion fails when clone has no visible diff from base branch

2 participants