-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Description
The AI conventional title suggestion fails to produce a valid title when the cloned repository shows no visible diff from the base branch (e.g., after force-push/amend where the worktree looks identical to main from the AI's perspective).
The AI returns a descriptive sentence like "The PR branch is identical to main with no code changes" instead of a proper conventional title.
Root Cause
The current prompt tells the AI to "look at the recent commits and changes" but doesn't provide the actual PR diff or context directly. When the clone state doesn't clearly show PR changes, the AI has nothing to work with.
Proposed Fix
Include the PR diff directly in the prompt text instead of relying on the AI to discover it from the repo. The webhook server already has access to the PR diff (via PyGithub or git diff against the base branch). Embedding the diff in the prompt ensures the AI always has the context it needs, regardless of the clone's checkout state.
Options:
- Fetch PR diff via PyGithub (
pull_request.get_diff()or compare API) and include in prompt - Run
git diff origin/{base_ref}...HEADin the clone and include the output in prompt - Pass the PR title + list of changed files as minimum context if diff is too large
Observed Behavior
### AI Auto-Fix Skipped
AI suggested: `The PR branch is identical to main with no code changes. This appears to be a test PR with no actual modifications.`
Suggestion was invalid or unchanged.
Expected Behavior
AI should receive enough context to always suggest a valid conventional title based on the actual PR changes.
Deliverables
- Code changes
- Add/update tests
- Update CLAUDE.md (if codebase structure changes)