Skip to content

feat: Add /reprocess command for full PR workflow reprocessing#894

Merged
myakove merged 2 commits intomainfrom
feature/add-reprocess-command
Nov 10, 2025
Merged

feat: Add /reprocess command for full PR workflow reprocessing#894
myakove merged 2 commits intomainfrom
feature/add-reprocess-command

Conversation

@myakove
Copy link
Copy Markdown
Collaborator

@myakove myakove commented Nov 10, 2025

Implement new user command /reprocess that triggers complete PR workflow reprocessing from scratch. This is useful when webhooks fail, processing is interrupted, or configuration changes require re-evaluation.

Changes:

  • Add COMMAND_REPROCESS_STR constant
  • Implement process_command_reprocess() with merged PR check
  • Add helper methods for duplicate prevention:
    • _welcome_comment_exists() - check for existing welcome message
    • _tracking_issue_exists() - check for existing tracking issue
  • Extract reusable process_new_or_reprocess_pull_request() method
  • Add command handler in issue_comment_handler with OWNERS permission check
  • Update welcome message documentation
  • Add comprehensive tests (24 test cases, 90.22% coverage)
  • Update README with full command documentation

Features:

  • Permission-gated (requires user in OWNERS file)
  • Skips merged PRs with clear message
  • Prevents duplicate welcome messages and tracking issues
  • Re-runs full workflow: reviewers, labels, checks, CI/CD
  • Comprehensive logging with logger.step() tracking

Summary by CodeRabbit

  • New Features

    • Introduced a /reprocess command to re-run PR initialization and workflows for open PRs (available to OWNERS); welcome message now references /reprocess.
    • Initialization workflow now avoids creating duplicate welcome messages and tracking issues.
  • Documentation

    • Added Workflow Management section and updated command table with /reprocess, examples, permissions, behavior, and onboarding notes.
  • Tests

    • Added extensive tests covering /reprocess, duplicate detection, parallel execution, error handling, and related PR initialization paths.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Nov 10, 2025

Walkthrough

Adds a /reprocess PR command: docs, a new constant, issue-comment routing, PR handler orchestration to re-run initialization with duplicate detection, and comprehensive tests for command and workflow behaviors.

Changes

Cohort / File(s) Summary
Documentation
README.md
Added Workflow Management / PR Reprocessing section, example usage, and updated Pull Request Commands table to include /reprocess.
Constants
webhook_server/utils/constants.py
Added COMMAND_REPROCESS_STR = "reprocess".
Issue comment routing
webhook_server/libs/handlers/issue_comment_handler.py
Registered reprocess in available commands, validate user via is_user_valid_to_run_commands, call process_command_reprocess, and add reaction handling.
PR workflow orchestration
webhook_server/libs/handlers/pull_request_handler.py
Added _welcome_comment_exists, _tracking_issue_exists, process_new_or_reprocess_pull_request, and process_command_reprocess; updated welcome text to mention /reprocess; centralized initialization, duplicate skipping, concurrent tasks, and automerge setup.
Tests
webhook_server/tests/test_issue_comment_handler.py, webhook_server/tests/test_pull_request_handler.py
Added unit/async tests covering command registration, authorized/unauthorized flows, argument handling, reactions, merged vs open PR behavior, welcome/tracking existence checks, full orchestration, duplicate-skipping, parallel execution, and exception handling.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

  • Focus review on concurrency and error handling in process_new_or_reprocess_pull_request.
  • Verify duplicate-detection helpers (_welcome_comment_exists, _tracking_issue_exists) and their test coverage.
  • Check permission validation and reaction behavior in issue_comment_handler.py.

Possibly related issues

Possibly related PRs

  • fix: add-allowed-user #806 — Adds new user commands and updates constants/issue comment routing; strongly related to command registration and handling changes here.

Suggested labels

size/L, commented-coderabbitai[bot], commented-myakove

Suggested reviewers

  • rnetser

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding a new /reprocess command for PR workflow reprocessing, which matches the primary objective and all key changes in the changeset.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/add-reprocess-command

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bfec32d and 69b5284.

📒 Files selected for processing (1)
  • webhook_server/libs/handlers/pull_request_handler.py (2 hunks)
🧰 Additional context used
🧠 Learnings (6)
📚 Learning: 2024-10-08T09:19:56.185Z
Learnt from: myakove
Repo: myk-org/github-webhook-server PR: 586
File: webhook_server_container/libs/github_api.py:1947-1956
Timestamp: 2024-10-08T09:19:56.185Z
Learning: In `webhook_server_container/libs/github_api.py`, the indentation style used in the `set_pull_request_automerge` method is acceptable as per the project's coding standards.

Applied to files:

  • webhook_server/libs/handlers/pull_request_handler.py
📚 Learning: 2024-10-29T10:42:50.163Z
Learnt from: myakove
Repo: myk-org/github-webhook-server PR: 612
File: webhook_server_container/libs/github_api.py:925-926
Timestamp: 2024-10-29T10:42:50.163Z
Learning: In `webhook_server_container/libs/github_api.py`, the method `self._keep_approved_by_approvers_after_rebase()` must be called after removing labels when synchronizing a pull request. Therefore, it should be placed outside the `ThreadPoolExecutor` to ensure it runs sequentially after label removal.

Applied to files:

  • webhook_server/libs/handlers/pull_request_handler.py
📚 Learning: 2024-10-29T08:09:57.157Z
Learnt from: myakove
Repo: myk-org/github-webhook-server PR: 612
File: webhook_server_container/libs/github_api.py:2089-2100
Timestamp: 2024-10-29T08:09:57.157Z
Learning: In `webhook_server_container/libs/github_api.py`, when the function `_keep_approved_by_approvers_after_rebase` is called, existing approval labels have already been cleared after pushing new changes, so there's no need to check for existing approvals within this function.

Applied to files:

  • webhook_server/libs/handlers/pull_request_handler.py
📚 Learning: 2025-05-13T12:06:27.297Z
Learnt from: myakove
Repo: myk-org/github-webhook-server PR: 778
File: webhook_server/libs/pull_request_handler.py:327-330
Timestamp: 2025-05-13T12:06:27.297Z
Learning: In the GitHub webhook server, synchronous GitHub API calls (like create_issue_comment, add_to_assignees, etc.) in async methods should be awaited using asyncio.to_thread or loop.run_in_executor to prevent blocking the event loop.

Applied to files:

  • webhook_server/libs/handlers/pull_request_handler.py
📚 Learning: 2024-10-14T14:13:21.316Z
Learnt from: myakove
Repo: myk-org/github-webhook-server PR: 588
File: webhook_server_container/libs/github_api.py:1632-1637
Timestamp: 2024-10-14T14:13:21.316Z
Learning: In the `ProcessGithubWehook` class in `webhook_server_container/libs/github_api.py`, avoid using environment variables to pass tokens because multiple commands with multiple tokens can run at the same time.

Applied to files:

  • webhook_server/libs/handlers/pull_request_handler.py
📚 Learning: 2025-10-28T16:09:08.689Z
Learnt from: myakove
Repo: myk-org/github-webhook-server PR: 0
File: :0-0
Timestamp: 2025-10-28T16:09:08.689Z
Learning: For this repository, prioritize speed and minimizing API calls in reviews and suggestions: reuse webhook payload data, batch GraphQL queries, cache IDs (labels/users), and avoid N+1 patterns.

Applied to files:

  • webhook_server/libs/handlers/pull_request_handler.py
🧬 Code graph analysis (1)
webhook_server/libs/handlers/pull_request_handler.py (2)
webhook_server/tests/conftest.py (3)
  • pull_request (115-116)
  • PullRequest (99-111)
  • create_issue_comment (107-107)
webhook_server/utils/helpers.py (1)
  • format_task_fields (113-132)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
  • GitHub Check: can-be-merged
  • GitHub Check: can-be-merged
  • GitHub Check: can-be-merged
  • GitHub Check: can-be-merged
  • GitHub Check: can-be-merged
  • GitHub Check: build-container
  • GitHub Check: conventional-title
  • GitHub Check: python-module-install
  • GitHub Check: pre-commit
  • GitHub Check: tox
🔇 Additional comments (4)
webhook_server/libs/handlers/pull_request_handler.py (4)

312-312: LGTM! Clear documentation for the new command.

The /reprocess command is well-documented in the welcome message, clearly explaining its purpose and use case.


1120-1138: Excellent fix! Past review concern fully addressed.

The previous review flagged that PaginatedList iteration was happening on the event loop. The current implementation correctly wraps the entire fetch-and-filter operation inside asyncio.to_thread using inner functions, ensuring all synchronous GitHub HTTP calls run off the event loop. This pattern is cleaner and more maintainable than the lambda approach.


1140-1191: Well-designed extraction of initialization logic.

This method successfully centralizes PR initialization workflow with proper duplicate prevention, error handling, and task sequencing. The duplicate checks for welcome messages and tracking issues prevent redundant operations when /reprocess is invoked. Error handling with return_exceptions=True ensures failures in individual tasks don't break the entire workflow. The comprehensive logging with format_task_fields provides excellent observability.


1193-1217: Clean command handler implementation.

The /reprocess command handler is well-implemented with appropriate safeguards. It correctly short-circuits for merged PRs (preventing unnecessary work), delegates to the extracted initialization workflow, and provides comprehensive logging at all stages. The single-responsibility design makes this easy to test and maintain.


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

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

@myakove-bot myakove-bot requested a review from rnetser November 10, 2025 11:06
@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
    "
    f"* Issue Creation: A tracking issue is created for this PR and will be closed when the PR is merged or closed
    "
    "* 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

📋 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)

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, or conflict labels
  5. Verified: PR must be marked as verified (if verification is enabled)

📊 Review Process

Approvers and Reviewers

Approvers:

  • myakove
  • rnetser

Reviewers:

  • myakove
  • rnetser
Available Labels
  • hold
  • verified
  • wip
  • lgtm
  • approve
  • automerge

💡 Tips

  • WIP Status: Use /wip when your PR is not ready for review
  • Verification: The verified label is automatically removed on each new commit
  • 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.

@myakove
Copy link
Copy Markdown
Collaborator Author

myakove commented Nov 10, 2025

/reprocess

@myakove-bot
Copy link
Copy Markdown
Collaborator

Starting full PR reprocessing workflow...

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
webhook_server/tests/test_pull_request_handler.py (1)

1207-1246: Consider more specific assertion for welcome message verification.

The test is well-structured and comprehensive. However, the assertion on line 1237 checks for the generic word "Welcome" in the message body. Consider verifying the presence of issue_url_for_welcome_msg instead, which is the actual marker used by the implementation to detect welcome comments.

Apply this refinement:

-            assert "Welcome" in mock_comment.call_args[1]["body"]
+            # Verify welcome message was created with the expected URL marker
+            assert pull_request_handler.github_webhook.issue_url_for_welcome_msg in mock_comment.call_args[1]["body"]

This makes the test more robust and aligns with the actual implementation logic.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ab1e28d and bea95e1.

📒 Files selected for processing (6)
  • README.md (1 hunks)
  • webhook_server/libs/handlers/issue_comment_handler.py (3 hunks)
  • webhook_server/libs/handlers/pull_request_handler.py (2 hunks)
  • webhook_server/tests/test_issue_comment_handler.py (2 hunks)
  • webhook_server/tests/test_pull_request_handler.py (1 hunks)
  • webhook_server/utils/constants.py (1 hunks)
🧰 Additional context used
🧠 Learnings (4)
📚 Learning: 2024-10-08T09:19:56.185Z
Learnt from: myakove
Repo: myk-org/github-webhook-server PR: 586
File: webhook_server_container/libs/github_api.py:1947-1956
Timestamp: 2024-10-08T09:19:56.185Z
Learning: In `webhook_server_container/libs/github_api.py`, the indentation style used in the `set_pull_request_automerge` method is acceptable as per the project's coding standards.

Applied to files:

  • webhook_server/libs/handlers/pull_request_handler.py
📚 Learning: 2024-10-29T08:09:57.157Z
Learnt from: myakove
Repo: myk-org/github-webhook-server PR: 612
File: webhook_server_container/libs/github_api.py:2089-2100
Timestamp: 2024-10-29T08:09:57.157Z
Learning: In `webhook_server_container/libs/github_api.py`, when the function `_keep_approved_by_approvers_after_rebase` is called, existing approval labels have already been cleared after pushing new changes, so there's no need to check for existing approvals within this function.

Applied to files:

  • webhook_server/libs/handlers/pull_request_handler.py
📚 Learning: 2024-10-29T10:42:50.163Z
Learnt from: myakove
Repo: myk-org/github-webhook-server PR: 612
File: webhook_server_container/libs/github_api.py:925-926
Timestamp: 2024-10-29T10:42:50.163Z
Learning: In `webhook_server_container/libs/github_api.py`, the method `self._keep_approved_by_approvers_after_rebase()` must be called after removing labels when synchronizing a pull request. Therefore, it should be placed outside the `ThreadPoolExecutor` to ensure it runs sequentially after label removal.

Applied to files:

  • webhook_server/libs/handlers/pull_request_handler.py
📚 Learning: 2024-10-15T10:37:45.791Z
Learnt from: myakove
Repo: myk-org/github-webhook-server PR: 598
File: webhook_server_container/libs/github_api.py:1860-1874
Timestamp: 2024-10-15T10:37:45.791Z
Learning: In the `process_retest_command` method in `webhook_server_container/libs/github_api.py`, `_target_tests` is defined before use.

Applied to files:

  • webhook_server/tests/test_issue_comment_handler.py
🧬 Code graph analysis (4)
webhook_server/libs/handlers/pull_request_handler.py (2)
webhook_server/tests/conftest.py (4)
  • pull_request (115-116)
  • PullRequest (99-111)
  • github_webhook (120-140)
  • create_issue_comment (107-107)
webhook_server/utils/helpers.py (1)
  • format_task_fields (113-132)
webhook_server/libs/handlers/issue_comment_handler.py (2)
webhook_server/libs/handlers/owners_files_handler.py (1)
  • is_user_valid_to_run_commands (330-362)
webhook_server/libs/handlers/pull_request_handler.py (1)
  • process_command_reprocess (1188-1220)
webhook_server/tests/test_issue_comment_handler.py (3)
webhook_server/libs/handlers/issue_comment_handler.py (2)
  • IssueCommentHandler (44-442)
  • user_commands (159-308)
webhook_server/libs/handlers/owners_files_handler.py (1)
  • is_user_valid_to_run_commands (330-362)
webhook_server/utils/constants.py (1)
  • REACTIONS (79-87)
webhook_server/tests/test_pull_request_handler.py (1)
webhook_server/libs/handlers/pull_request_handler.py (4)
  • _welcome_comment_exists (1120-1127)
  • _generate_issue_body (786-787)
  • _tracking_issue_exists (1129-1133)
  • process_new_or_reprocess_pull_request (1135-1186)
🪛 markdownlint-cli2 (0.18.1)
README.md

1164-1164: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)

🔇 Additional comments (10)
webhook_server/libs/handlers/pull_request_handler.py (1)

1195-1219: Merged PR guard looks solid

Skipping /reprocess once a PR is merged avoids wasting API calls and keeps the workflow side-effect free. Nice touch.

webhook_server/tests/test_pull_request_handler.py (9)

1091-1114: LGTM! Comprehensive test for merged PR rejection.

The test correctly verifies that /reprocess on a merged PR posts a rejection message and skips the workflow execution. The mocking strategy and assertions are appropriate.


1116-1136: LGTM! Proper test for successful reprocess workflow.

The test correctly verifies that /reprocess on an open PR posts a starting message and triggers the full workflow. Good use of mocks and assertions.


1138-1169: LGTM! Thorough coverage of welcome comment existence checks.

The three test cases comprehensively cover the _welcome_comment_exists helper method: when the welcome message exists, when it doesn't, and when there are no comments. Good test design.


1171-1205: LGTM! Complete coverage of tracking issue existence checks.

The three test cases thoroughly cover the _tracking_issue_exists helper method with all relevant scenarios. Proper use of _generate_issue_body ensures consistency with the actual implementation.


1248-1271: LGTM! Proper test for welcome message duplicate prevention.

The test correctly verifies that the workflow skips creating a welcome message when one already exists, demonstrating the duplicate prevention logic works as expected.


1273-1298: LGTM! Proper test for tracking issue duplicate prevention.

The test correctly verifies that the workflow skips creating a tracking issue when one already exists, demonstrating the duplicate prevention logic works as expected.


1300-1327: LGTM! Important edge case for dual duplicate prevention.

The test correctly verifies that when both welcome message and tracking issue already exist, they are both skipped while the core workflow tasks still execute. This is an important edge case for the /reprocess command.


1329-1348: LGTM! Verifies parallel execution pattern.

The test confirms that asyncio.gather is used for parallel task execution. While this doesn't test actual concurrency behavior, it appropriately verifies the implementation pattern at the unit test level.


1350-1376: LGTM! Excellent test for workflow resilience.

The test correctly verifies that when one task fails with an exception, the error is logged and the workflow continues (including automerge). This demonstrates the robustness of the error handling implementation using asyncio.gather with return_exceptions=True.

Comment thread README.md
Implement new user command `/reprocess` that triggers complete PR
workflow reprocessing from scratch. This is useful when webhooks fail,
processing is interrupted, or configuration changes require re-evaluation.

Changes:
- Add COMMAND_REPROCESS_STR constant
- Implement process_command_reprocess() with merged PR check
- Add helper methods for duplicate prevention:
  - _welcome_comment_exists() - check for existing welcome message
  - _tracking_issue_exists() - check for existing tracking issue
- Extract reusable process_new_or_reprocess_pull_request() method
- Add command handler in issue_comment_handler with OWNERS permission check
- Update welcome message documentation
- Add comprehensive tests (24 test cases, 90.22% coverage)
- Update README with full command documentation

Features:
- Permission-gated (requires user in OWNERS file)
- Skips merged PRs with clear message
- Prevents duplicate welcome messages and tracking issues
- Re-runs full workflow: reviewers, labels, checks, CI/CD
- Comprehensive logging with logger.step() tracking
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bea95e1 and bfec32d.

📒 Files selected for processing (6)
  • README.md (1 hunks)
  • webhook_server/libs/handlers/issue_comment_handler.py (3 hunks)
  • webhook_server/libs/handlers/pull_request_handler.py (2 hunks)
  • webhook_server/tests/test_issue_comment_handler.py (2 hunks)
  • webhook_server/tests/test_pull_request_handler.py (1 hunks)
  • webhook_server/utils/constants.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • webhook_server/utils/constants.py
  • webhook_server/libs/handlers/issue_comment_handler.py
  • README.md
🧰 Additional context used
🧠 Learnings (4)
📚 Learning: 2024-10-15T10:37:45.791Z
Learnt from: myakove
Repo: myk-org/github-webhook-server PR: 598
File: webhook_server_container/libs/github_api.py:1860-1874
Timestamp: 2024-10-15T10:37:45.791Z
Learning: In the `process_retest_command` method in `webhook_server_container/libs/github_api.py`, `_target_tests` is defined before use.

Applied to files:

  • webhook_server/tests/test_issue_comment_handler.py
📚 Learning: 2024-10-08T09:19:56.185Z
Learnt from: myakove
Repo: myk-org/github-webhook-server PR: 586
File: webhook_server_container/libs/github_api.py:1947-1956
Timestamp: 2024-10-08T09:19:56.185Z
Learning: In `webhook_server_container/libs/github_api.py`, the indentation style used in the `set_pull_request_automerge` method is acceptable as per the project's coding standards.

Applied to files:

  • webhook_server/libs/handlers/pull_request_handler.py
📚 Learning: 2024-10-29T08:09:57.157Z
Learnt from: myakove
Repo: myk-org/github-webhook-server PR: 612
File: webhook_server_container/libs/github_api.py:2089-2100
Timestamp: 2024-10-29T08:09:57.157Z
Learning: In `webhook_server_container/libs/github_api.py`, when the function `_keep_approved_by_approvers_after_rebase` is called, existing approval labels have already been cleared after pushing new changes, so there's no need to check for existing approvals within this function.

Applied to files:

  • webhook_server/libs/handlers/pull_request_handler.py
📚 Learning: 2024-10-29T10:42:50.163Z
Learnt from: myakove
Repo: myk-org/github-webhook-server PR: 612
File: webhook_server_container/libs/github_api.py:925-926
Timestamp: 2024-10-29T10:42:50.163Z
Learning: In `webhook_server_container/libs/github_api.py`, the method `self._keep_approved_by_approvers_after_rebase()` must be called after removing labels when synchronizing a pull request. Therefore, it should be placed outside the `ThreadPoolExecutor` to ensure it runs sequentially after label removal.

Applied to files:

  • webhook_server/libs/handlers/pull_request_handler.py
🧬 Code graph analysis (3)
webhook_server/tests/test_issue_comment_handler.py (3)
webhook_server/libs/handlers/issue_comment_handler.py (2)
  • IssueCommentHandler (44-442)
  • user_commands (159-308)
webhook_server/libs/handlers/owners_files_handler.py (1)
  • is_user_valid_to_run_commands (330-362)
webhook_server/utils/constants.py (1)
  • REACTIONS (79-87)
webhook_server/libs/handlers/pull_request_handler.py (2)
webhook_server/tests/conftest.py (3)
  • pull_request (115-116)
  • PullRequest (99-111)
  • create_issue_comment (107-107)
webhook_server/utils/helpers.py (1)
  • format_task_fields (113-132)
webhook_server/tests/test_pull_request_handler.py (1)
webhook_server/libs/handlers/pull_request_handler.py (6)
  • PullRequestHandler (45-1212)
  • process_command_reprocess (1188-1212)
  • _welcome_comment_exists (1120-1127)
  • _generate_issue_body (786-787)
  • _tracking_issue_exists (1129-1133)
  • process_new_or_reprocess_pull_request (1135-1186)

Comment thread webhook_server/libs/handlers/pull_request_handler.py
…locking

Fixed blocking GitHub API calls in _welcome_comment_exists and _tracking_issue_exists methods by moving the entire fetch-and-filter operation inside background threads:

- _welcome_comment_exists: Moved comment iteration inside nested function
- _tracking_issue_exists: Moved issue iteration inside nested function

This prevents synchronous HTTP calls from blocking the event loop when iterating over PaginatedList objects.

Addresses CodeRabbit review comment about keeping GitHub API calls off the event loop.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@myakove
Copy link
Copy Markdown
Collaborator Author

myakove commented Nov 10, 2025

/reprocess

@rnetser
Copy link
Copy Markdown
Collaborator

rnetser commented Nov 10, 2025

/lgtm

@myakove
Copy link
Copy Markdown
Collaborator Author

myakove commented Nov 10, 2025

/verified
/approve

@myakove myakove merged commit bf6052d into main Nov 10, 2025
9 checks passed
@myakove myakove deleted the feature/add-reprocess-command branch November 10, 2025 12:19
@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.

3 participants