LLM API error (status 400): context_length_exceeded
CI job fails, no review posted.
Expected Behavior
review-bot should:
Detect context overflow (either pre-calculate or catch the 400)
Progressively trim context: patterns first, then conventions summary, then chunk the diff
Retry with reduced context
If still too large, post a comment explaining the PR is too large for automated review
Acceptance Criteria
No crash on context overflow
Graceful degradation: try with less context before giving up
Informative output when review cannot be completed
Tests cover the overflow path
## Problem
When the prompt (diff + conventions + patterns) exceeds the model's context window, review-bot crashes with a non-actionable error.
Example: gargoyle PR #508 with `patterns/` directory fetched from 2 repos + CLAUDE.md + diff = 134K tokens, exceeding GPT-4.1's 128K limit.
## Current Behavior
```
LLM API error (status 400): context_length_exceeded
```
CI job fails, no review posted.
## Expected Behavior
review-bot should:
1. Detect context overflow (either pre-calculate or catch the 400)
2. Progressively trim context: patterns first, then conventions summary, then chunk the diff
3. Retry with reduced context
4. If still too large, post a comment explaining the PR is too large for automated review
## Acceptance Criteria
- [ ] No crash on context overflow
- [ ] Graceful degradation: try with less context before giving up
- [ ] Informative output when review cannot be completed
- [ ] Tests cover the overflow path
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Problem
When the prompt (diff + conventions + patterns) exceeds the model's context window, review-bot crashes with a non-actionable error.
Example: gargoyle PR #508 with
patterns/directory fetched from 2 repos + CLAUDE.md + diff = 134K tokens, exceeding GPT-4.1's 128K limit.Current Behavior
CI job fails, no review posted.
Expected Behavior
review-bot should:
Acceptance Criteria