Patch 1#6
Conversation
…ma/GitHub, and default analysis handling
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
WalkthroughThe PR hardens GitHub fetching, updates CodeRabbit text extraction, isolates per-PR fetch failures, adds Ollama retry handling and group analysis, prepopulates conflict-group analysis data, and adds a dependency plus an ignored artifact path. ChangesPull request analysis pipeline
Sequence Diagram(s)sequenceDiagram
participant main_py as main.py
participant github_py as github.py
participant gh_cli as gh
participant ollama_py as ollama.py
participant ollama_api as Ollama
main_py->>github_py: fetch PRs, files, and CodeRabbit sections
github_py->>gh_cli: run GitHub CLI commands with retries
gh_cli-->>github_py: return PR data or failures
github_py-->>main_py: files plus Walkthrough/Changes text
main_py->>ollama_py: analyze PR groups and single PRs
ollama_py->>ollama_api: _call(prompt) with retry/backoff
ollama_api-->>ollama_py: grouping or analysis result
ollama_py-->>main_py: cleaned PR numbers or analysis payload
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
There was a problem hiding this comment.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
ollama.py (1)
142-155: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winRebuild a complete, unique PR partition after hallucination cleanup.
After stripping fake numbers, the function can still return missing or duplicated PRs, which breaks the “exactly once” grouping contract and can misroute downstream analysis.
Proposed fix
cleaned = [] hallucinated = [] + assigned = set() for g in result["groups"]: - real = [n for n in g.get("pr_numbers", []) if n in valid_nums] + real = [n for n in g.get("pr_numbers", []) if n in valid_nums and n not in assigned] fake = [n for n in g.get("pr_numbers", []) if n not in valid_nums] if fake: hallucinated.extend(fake) if real: + assigned.update(real) cleaned.append({**g, "pr_numbers": real}) + + missing = [n for n in valid_nums if n not in assigned] + for n in missing: + cleaned.append({ + "problem": f"PR #{n} (fallback)", + "problem_category": "other", + "pr_numbers": [n], + "is_conflict": False, + })🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@ollama.py` around lines 142 - 155, The hallucination cleanup logic only filters invalid PR numbers per group, so the returned grouping can still miss valid PRs or include duplicates. After building cleaned from result["groups"], rebuild a complete partition over valid_nums by collecting each PR exactly once and reassigning them into unique groups, preserving the original grouping metadata where possible while ensuring no valid PR is omitted or duplicated. Keep the hallucinated warning, but make the final return value a fully de-duplicated, complete set of groups.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@github.py`:
- Around line 24-33: In the gh retry loop in github.py, handle the case where
every attempt fails before result is assigned, since returning
result.returncode/stdout/stderr can raise UnboundLocalError. Initialize a safe
default for result before the loop or return a failure tuple based on the last
captured error when retries are exhausted. Use the retry logic around subprocess
execution and the last_err handling to locate the fix.
In `@main.py`:
- Around line 58-80: The `failed` counter in `_build_pr_data()` is only
incremented on hard exceptions, so partial fetches tracked by `files_error` and
`cr_error` are not counted. Update the logic around `_build_pr_data`,
`fetch_pr_files`, and `fetch_coderabbit_sections` so PRs with partial data are
treated as failed/incomplete for the summary counters, not just for the warning
print. Make the counting happen based on the same error flags used for the
partial-data warning, and ensure the `failed` tally reflects those cases
consistently.
In `@ollama.py`:
- Line 13: The OLLAMA_MODEL constant is pinned to a mutable `latest` tag, which
makes outputs non-deterministic. Update `OLLAMA_MODEL` in `ollama.py` to use a
fixed model digest instead of `llama3.2:latest`, so the model version is stable
and reproducible across runs. Keep the change localized to the `OLLAMA_MODEL`
assignment and preserve the existing constant name for callers.
In `@requirements.txt`:
- Line 1: The dependency in requirements.txt is unpinned, which can cause
non-deterministic installs and unexpected breakages. Update the
sentence-transformers entry to an explicit version pin so builds are
reproducible and upgrades are controlled; use the package name in
requirements.txt and choose a version compatible with the current grouping.py
usage and any renamed parameters or module changes.
---
Outside diff comments:
In `@ollama.py`:
- Around line 142-155: The hallucination cleanup logic only filters invalid PR
numbers per group, so the returned grouping can still miss valid PRs or include
duplicates. After building cleaned from result["groups"], rebuild a complete
partition over valid_nums by collecting each PR exactly once and reassigning
them into unique groups, preserving the original grouping metadata where
possible while ensuring no valid PR is omitted or duplicated. Keep the
hallucinated warning, but make the final return value a fully de-duplicated,
complete set of groups.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: bcc60145-93b3-4f63-9c4e-f745dc304b19
📒 Files selected for processing (6)
.gitignoregithub.pygrouping.pymain.pyollama.pyrequirements.txt
…ata in dashboard results
Addressed Issues:
Fixes #(issue number)
Screenshots/Recordings:
Additional Notes:
Checklist
We encourage contributors to use AI tools responsibly when creating Pull Requests. While AI can be a valuable aid, it is essential to ensure that your contributions meet the task requirements, build successfully, include relevant tests, and pass all linters. Submissions that do not meet these standards may be closed without warning to maintain the quality and integrity of the project. Please take the time to understand the changes you are proposing and their impact.
Summary by CodeRabbit
New Features
Bug Fixes
Chores