Replace per-issue/MR note polling with single project events API call#94
Merged
Replace per-issue/MR note polling with single project events API call#94
Conversation
Instead of calling get_issue_notes() for each updated issue and get_merge_request_notes() for each updated MR (O(N+M) API calls per poll cycle), use the GitLab project events API (GET /projects/:id/events?action=commented) to fetch all note events since the last check in a single request. Introduces GitlabEventNote and GitlabProjectEvent models, adds get_project_note_events() to the GitLab client, and replaces process_issues_for_mentions() + poll_merge_requests() with a unified process_note_events() method that handles both issue and MR mentions from the single events batch. https://claude.ai/code/session_01QKGjDY8ggdijJhAxSEGBSU
The extract_context_for_mr function was calling get_file_commits() for every changed file in a merge request, resulting in O(N) API calls where N is the number of changed files. The commit history rarely changed the quality of the LLM response meaningfully. Removes the entire get_file_commits loop and the context_for_comment commit-history table. Also updates format_final_reply_body to omit the collapsible commit history block when it is empty. https://claude.ai/code/session_01QKGjDY8ggdijJhAxSEGBSU
extract_issue_details_and_handle_stale was calling get_issue twice: once for the stale-label check and again to return the issue to the caller. build_issue_prompt_with_context then called get_issue a third time even though the issue was already available via the context struct. Fetch the issue once in extract_issue_details_and_handle_stale, reuse it for the stale check, and use context.issue directly in build_issue_prompt_with_context instead of re-fetching. https://claude.ai/code/session_01QKGjDY8ggdijJhAxSEGBSU
get_project_by_path was called multiple times per poll cycle and per request: from poll_repository on every poll interval, and from repo_context.rs (get_agents_md_content, get_combined_source_files, find_relevant_files_for_issue) during context extraction. Adds a project_cache DashMap<String, (GitlabProject, Instant)> to GitlabApiClient with a 1-hour TTL, deduplicating repeated lookups for the same repo path across all call sites automatically. https://claude.ai/code/session_01QKGjDY8ggdijJhAxSEGBSU
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Instead of calling get_issue_notes() for each updated issue and
get_merge_request_notes() for each updated MR (O(N+M) API calls per
poll cycle), use the GitLab project events API
(GET /projects/:id/events?action=commented) to fetch all note events
since the last check in a single request.
Introduces GitlabEventNote and GitlabProjectEvent models, adds
get_project_note_events() to the GitLab client, and replaces
process_issues_for_mentions() + poll_merge_requests() with a unified
process_note_events() method that handles both issue and MR mentions
from the single events batch.
https://claude.ai/code/session_01QKGjDY8ggdijJhAxSEGBSU