Skip to content

fix: re-evaluate can-be-merged when review threads are resolved (#1038)#1039

Merged
myakove merged 7 commits intomainfrom
fix/issue-1038-resolved-threads-can-be-merged
Mar 17, 2026
Merged

fix: re-evaluate can-be-merged when review threads are resolved (#1038)#1039
myakove merged 7 commits intomainfrom
fix/issue-1038-resolved-threads-can-be-merged

Conversation

@myakove
Copy link
Copy Markdown
Collaborator

@myakove myakove commented Mar 17, 2026

Summary

  • Add pull_request_review_thread event handler in github_api.py
  • Re-evaluate can-be-merged on resolved and unresolved actions (always runs full check)
  • Skip non-actionable events (created) before API bootstrap to save rate limit
  • Skip when required_conversation_resolution is disabled
  • Clone repo and initialize OwnersFileHandler — check_if_can_be_merged evaluates ALL conditions (approvals, OWNERS, labels, checks, conversations) on every call
  • Add status event: clone + initialize for full merge check, hoist pending skip before bootstrap
  • Extract _recheck_merge_eligibility() shared helper for status + review_thread handlers
  • Update webhook if configured events differ from existing (smart event reconciliation)
  • Add pull_request_review_thread and status to example configs

Problem

When review threads are resolved, can-be-merged was not re-evaluated. PRs stayed in stale "unresolved conversations" state until another event triggered re-evaluation.

Changes

File Change
webhook_server/libs/github_api.py Add pull_request_review_thread + status handlers with clone + full merge check, hoist early skips before bootstrap, extract _recheck_merge_eligibility()
webhook_server/utils/webhook.py Smart webhook event reconciliation — update existing hooks when events change, dedupe with set()
webhook_server/tests/test_github_api.py Parameterized tests for status states, review thread actions, bootstrap skip assertions
webhook_server/tests/test_webhook.py Parameterized webhook event-update tests
examples/config.yaml Add pull_request_review_thread and status events
examples/.github-webhook-server.yaml Add pull_request_review_thread and status events
webhook_server/tests/manifests/config.yaml Add pull_request_review_thread and status events

Test plan

  • All 1434 tests pass, 90.37% coverage
  • Deployed and verified: resolved review threads trigger can-be-merged re-evaluation
  • Webhook events updated on GitHub repos automatically

Closes #1038

Add pull_request_review_thread event handler so resolved/unresolved
thread actions trigger can-be-merged re-evaluation via GraphQL API.
@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
  • Issue Creation: Disabled for this repository
  • 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
  • Labels: All label categories are enabled (default configuration)

📋 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)
  • /regenerate-welcome - Regenerate this welcome message

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, has-conflicts labels and PR must be mergeable (no conflicts)
  5. Verified: PR must be marked as verified

📊 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.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 17, 2026

Warning

Rate limit exceeded

@myakove has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 4 minutes and 55 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: f9479e2f-2d4e-45a8-8f51-c8a4ce7833a5

📥 Commits

Reviewing files that changed from the base of the PR and between 414f268 and 349e26b.

📒 Files selected for processing (2)
  • webhook_server/libs/github_api.py
  • webhook_server/tests/test_github_api.py

Walkthrough

Adds handling for pull_request_review_thread events and defers repository cloning for several event types. Introduces async def _recheck_merge_eligibility(self, pull_request: PullRequest) to (when needed) clone the repo, initialize OWNERS handling, and re-evaluate can-be-merged. Tests and example configs updated; webhook event synchronization improved.

Changes

Cohort / File(s) Summary
Webhook processing
webhook_server/libs/github_api.py
Add pull_request_review_thread handling and early-exit gates for non-terminal thread actions and pending status. Defer cloning for push/pull_request/check_run/status/pull_request_review_thread to per-handler clone. Add async _recheck_merge_eligibility(pull_request) that clones (if required), initializes OwnersFileHandler, and calls PullRequestHandler.check_if_can_be_merged(). Add logging and token-metric capture around rechecks.
Tests: review-thread & status
webhook_server/tests/test_github_api.py
Extend and add tests for pull_request_review_thread (resolved/unresolved/created) and updated status flows; mock cloning and owners init; assert recheck behavior and early-exit paths.
Config / examples
examples/.github-webhook-server.yaml, examples/config.yaml, webhook_server/tests/manifests/config.yaml
Add pull_request_review_thread and include status in example/test manifests; reorder related events accordingly.
Webhook utils
webhook_server/utils/webhook.py
Synchronize existing webhook events by editing the webhook when current events differ from desired events (instead of treating as unchanged).
Tests: webhook management
webhook_server/tests/test_webhook.py
Add parameterized tests for webhook event-list synchronization (missing-event, wildcard↔specific, ordering) and ensure no-op when events already match.

Sequence Diagram

sequenceDiagram
    participant GitHub as GitHub (Webhook)
    participant Server as Webhook Server
    participant Repo as Repository (local/git)
    participant Owners as OwnersFileHandler
    participant PRH as PullRequestHandler
    participant API as GitHub API

    GitHub->>Server: deliver event (pull_request_review_thread / status / other)
    Server->>Server: parse event, evaluate early-exit (action/state, config)
    alt re-evaluation required
        Server->>Repo: clone repository (deferred inside recheck)
        Repo-->>Server: clone complete
        Server->>Owners: OwnersFileHandler.initialize()
        Owners-->>Server: owners loaded
        Server->>PRH: _recheck_merge_eligibility(pr) -> check_if_can_be_merged(pr)
        PRH->>API: GraphQL/REST (threads, checks, commit statuses, owners)
        API-->>PRH: current mergeability state
        PRH-->>Server: mergeability result
        Server->>Server: log token metrics
    end
    Server-->>GitHub: 200 OK
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

Possibly related PRs

Suggested labels

size/L, commented-coderabbitai[bot]

Suggested reviewers

  • rnetser
  • dbasunag
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Out of Scope Changes check ❓ Inconclusive Changes include some scope expansion beyond #1038: status event handling and webhook event synchronization were added, potentially addressing broader concerns not explicitly listed in the linked issue. Clarify whether status event handling and webhook sync updates are intentional enhancements or should be split into separate PRs aligned with specific issues.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: re-evaluating can-be-merged when review threads are resolved, which is the primary objective.
Linked Issues check ✅ Passed All coding requirements from issue #1038 are met: pull_request_review_thread handler added, re-evaluation on resolved/unresolved actions implemented, lightweight GraphQL-based approach used, and comprehensive tests added.
Docstring Coverage ✅ Passed Docstring coverage is 91.67% which is sufficient. The required threshold is 80.00%.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/issue-1038-resolved-threads-can-be-merged
📝 Coding Plan
  • Generate coding plan for human review comments

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.

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: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@webhook_server/libs/github_api.py`:
- Around line 653-656: The OwnersFileHandler is constructed but not initialized
before being passed into PullRequestHandler.check_if_can_be_merged, so call
await OwnersFileHandler.initialize(pull_request=pull_request) (or await
owners_file_handler.initialize(pull_request=pull_request)) after creating
owners_file_handler and before invoking
PullRequestHandler(...).check_if_can_be_merged to ensure the
approver/reviewer/OWNERS state is loaded for the
PullRequestHandler.check_if_can_be_merged logic.
- Around line 640-649: The action check for pull_request_review_thread must be
moved earlier to avoid performing GitHub I/O for ignored actions: in the handler
that reads self.hook_data["action"] (the pull_request_review_thread webhook
handler), hoist the guard that checks if action not in ("resolved","unresolved")
to run before any PR fetching or pull_request.get_commits() calls; keep the
existing token_metrics logging and the await self._update_context_metrics() and
return None in that early branch so skipped actions perform only lightweight
local work and no GitHub API calls.

In `@webhook_server/tests/test_github_api.py`:
- Around line 2263-2272: The test currently fully mocks PullRequestHandler so it
only verifies check_if_can_be_merged was awaited and misses whether
OwnersFileHandler.initialize() was called; update the test to also assert
OwnersFileHandler.initialize() is awaited (or replace the full
PullRequestHandler mock with a stricter fake that calls through to
OwnersFileHandler initialization) by patching or spying on
OwnersFileHandler.initialize and adding an assert (e.g.,
OwnersFileHandler.initialize.assert_awaited_once() when should_recheck is true
and assert_not_awaited() when false) while keeping the existing
PullRequestHandler and GithubWebhook.process usage.
🪄 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: 287f47d3-291a-4537-8655-c73d2d55617e

📥 Commits

Reviewing files that changed from the base of the PR and between d07a720 and 6f5aaf2.

📒 Files selected for processing (2)
  • webhook_server/libs/github_api.py
  • webhook_server/tests/test_github_api.py

Comment thread webhook_server/libs/github_api.py Outdated
Comment thread webhook_server/libs/github_api.py Outdated
Comment thread webhook_server/tests/test_github_api.py Outdated
coderabbitai[bot]
coderabbitai Bot previously approved these changes Mar 17, 2026
- Early return for non-actionable thread events before PR fetch
- Clone repo and initialize OwnersFileHandler for OWNERS data
- Test asserts initialize() and clone called for resolved/unresolved
- Add clone + OwnersFileHandler.initialize for status event handler
- Update webhook if configured events differ from existing
- Add inline comments explaining why clone is needed
- Add pull_request_review_thread and status to example configs
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: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
webhook_server/libs/github_api.py (1)

640-680: 🧹 Nitpick | 🔵 Trivial

LOW: Consider extracting a shared mergeability recheck helper to remove duplication.

Line 640–Line 680 duplicates the same recheck workflow across status and pull_request_review_thread. A small helper would reduce maintenance drift risk.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@webhook_server/libs/github_api.py` around lines 640 - 680, Extract the
duplicated recheck workflow into a private helper (e.g., _recheck_mergeability
or similar) and call it from both the "status" and "pull_request_review_thread"
branches; the helper should perform the sequence currently duplicated: await
self._clone_repository(pull_request), instantiate and initialize
OwnersFileHandler (OwnersFileHandler.initialize(pull_request)), call
PullRequestHandler(...).check_if_can_be_merged(pull_request), fetch
token_metrics via await self._get_token_metrics(), log the completion message,
and await self._update_context_metrics(); replace the duplicated blocks with a
single call to that helper to centralize behavior and keep existing
logging/context intact.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@webhook_server/tests/test_github_api.py`:
- Around line 2232-2300: The test doesn't assert that skipped review-thread
actions avoid fetching the PR; after calling GithubWebhook(review_thread_data,
headers, logger).process(), add assertions on the mocked repo PR fetch
(mock_repo.get_pull) to ensure it's not called when should_recheck is False and
is called exactly once when should_recheck is True; place these assertions
alongside the existing checks for mock_pr_handler.check_if_can_be_merged,
mock_owners_instance.initialize, and mock_clone within
test_process_review_thread_event so any regression that still calls get_pull is
caught.

In `@webhook_server/tests/test_webhook.py`:
- Around line 454-457: Add an explicit non-destructive assertion to the “no
update needed” test by asserting that no delete call occurred: after the
existing assertions for existing_hook.edit.assert_not_called() and
mock_repo.create_hook.assert_not_called(), add an assertion such as
mock_repo.delete_hook.assert_not_called() (and if the hook object exposes a
delete method, also existing_hook.delete.assert_not_called()) so the test
verifies no deletion happens in the no-op path.
- Around line 318-457: Several almost-identical tests
(test_process_github_webhook_existing_hook_different_events,
test_process_github_webhook_existing_hook_wildcard_vs_specific_events,
test_process_github_webhook_existing_hook_specific_vs_wildcard_events,
test_process_github_webhook_existing_hook_events_same_order_differs) only vary
the existing hook events, incoming data events and expected outcomes;
consolidate them into a single parameterized pytest function using
pytest.mark.parametrize. Create one test (e.g.,
test_process_github_webhook_event_update_matrix) parameterized over tuples of
(existing_events, data_events, expected_edit_events, expected_message_substring,
expect_edit_call_bool) and inside the test reuse the same mock setup
(existing_hook = Mock(), existing_hook.config, mock_repo.get_hooks.return_value,
mock_get_repo_api.return_value), call process_github_webhook with
repository_name/data/webhook_ip/apis_dict, then assert success and that
expected_message_substring is in message and assert existing_hook.edit called
(or not) with name="web", config={"url":
"http://example.com","content_type":"json"}, events=expected_edit_events,
active=True and that mock_repo.create_hook.assert_not_called(); include cases
for wildcard "*" and reversed-order events to ensure order-insensitivity.

In `@webhook_server/utils/webhook.py`:
- Around line 59-67: The comparison currently uses sorted lists (hook_events and
config_events) which can still differ when config contains duplicate events
causing unnecessary edits; before comparing and before calling _hook.edit,
normalize both event lists by deduplicating (e.g., convert to set) and then sort
to produce canonical hook_events and config_events, and pass the
deduplicated/sorted events into _hook.edit (reference variables: _hook.events,
events, hook_events, config_events and method _hook.edit); update the LOGGER
message to show the normalized lists so logs reflect the actual change.

---

Outside diff comments:
In `@webhook_server/libs/github_api.py`:
- Around line 640-680: Extract the duplicated recheck workflow into a private
helper (e.g., _recheck_mergeability or similar) and call it from both the
"status" and "pull_request_review_thread" branches; the helper should perform
the sequence currently duplicated: await self._clone_repository(pull_request),
instantiate and initialize OwnersFileHandler
(OwnersFileHandler.initialize(pull_request)), call
PullRequestHandler(...).check_if_can_be_merged(pull_request), fetch
token_metrics via await self._get_token_metrics(), log the completion message,
and await self._update_context_metrics(); replace the duplicated blocks with a
single call to that helper to centralize behavior and keep existing
logging/context intact.
🪄 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: 653b4c9f-c2a8-47ff-b088-78012a457e24

📥 Commits

Reviewing files that changed from the base of the PR and between 6f5aaf2 and d6feff3.

📒 Files selected for processing (7)
  • examples/.github-webhook-server.yaml
  • examples/config.yaml
  • webhook_server/libs/github_api.py
  • webhook_server/tests/manifests/config.yaml
  • webhook_server/tests/test_github_api.py
  • webhook_server/tests/test_webhook.py
  • webhook_server/utils/webhook.py

Comment thread webhook_server/tests/test_github_api.py Outdated
Comment thread webhook_server/tests/test_webhook.py
Comment thread webhook_server/tests/test_webhook.py Outdated
Comment thread webhook_server/utils/webhook.py Outdated
coderabbitai[bot]
coderabbitai Bot previously approved these changes Mar 17, 2026
Comment thread webhook_server/libs/github_api.py
coderabbitai[bot]
coderabbitai Bot previously approved these changes Mar 17, 2026
- Track webhook_routing step and metrics for early-exit branches
- Assert add_api_users and get_pull_request not called on pending skip
coderabbitai[bot]
coderabbitai Bot previously approved these changes Mar 17, 2026
@myakove
Copy link
Copy Markdown
Collaborator Author

myakove commented Mar 17, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 17, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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.

♻️ Duplicate comments (1)
webhook_server/tests/test_github_api.py (1)

879-915: 🧹 Nitpick | 🔵 Trivial

MEDIUM: The shared recheck tests still don’t prove which owners handler reaches PullRequestHandler.

Line 887 returns None from OwnersFileHandler.initialize(), and Lines 2319-2324 only prove that check_if_can_be_merged() was awaited. Because PullRequestHandler is fully mocked, both tests would stay green if _recheck_merge_eligibility() awaited initialize() and then instantiated PullRequestHandler with the wrong handler. These tests are covering the shared helper now, so they should assert the constructor input directly.

Suggested hardening
-                                    with patch.object(
-                                        GithubWebhook,
-                                        "_clone_repository",
-                                        new=AsyncMock(return_value=None),
-                                    ) as mock_clone:
-                                        with patch.object(
-                                            OwnersFileHandler,
-                                            "initialize",
-                                            new=AsyncMock(return_value=None),
-                                        ) as mock_owners_init:
+                                    with (
+                                        patch.object(
+                                            GithubWebhook,
+                                            "_clone_repository",
+                                            new=AsyncMock(return_value=None),
+                                        ) as mock_clone,
+                                        patch("webhook_server.libs.github_api.OwnersFileHandler") as mock_owners_handler,
+                                    ):
+                                        mock_owners_instance = Mock()
+                                        mock_owners_instance.initialize = AsyncMock(return_value=mock_owners_instance)
+                                        mock_owners_handler.return_value = mock_owners_instance
                                         webhook = GithubWebhook(status_data, headers, logger)
@@
-                                                        mock_pr_handler.return_value.check_if_can_be_merged.assert_awaited_once()
-                                                        mock_owners_init.assert_awaited_once()
+                                                        mock_pr_handler.assert_called_once_with(
+                                                            github_webhook=webhook,
+                                                            owners_file_handler=mock_owners_instance,
+                                                        )
+                                                        mock_pr_handler.return_value.check_if_can_be_merged.assert_awaited_once()
+                                                        mock_owners_instance.initialize.assert_awaited_once()
                                                         mock_clone.assert_awaited_once()
@@
-                                                        mock_pr_handler.return_value.check_if_can_be_merged.assert_not_awaited()
-                                                        mock_owners_init.assert_not_awaited()
+                                                        mock_pr_handler.assert_not_called()
+                                                        mock_pr_handler.return_value.check_if_can_be_merged.assert_not_awaited()
+                                                        mock_owners_instance.initialize.assert_not_awaited()
                                                         mock_clone.assert_not_awaited()

Apply the same mock_pr_handler.assert_called_once_with(github_webhook=webhook, owners_file_handler=mock_owners_instance) assertion in the review-thread test as well.

Also applies to: 2293-2324

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@webhook_server/tests/test_github_api.py` around lines 879 - 915, The shared
recheck tests only assert that PullRequestHandler.check_if_can_be_merged() was
awaited, not that PullRequestHandler was constructed with the correct
OwnersFileHandler instance; update the tests around the GithubWebhook.process()
calls (where OwnersFileHandler.initialize is patched and mock_pr_handler is
used) to also assert that
mock_pr_handler.assert_called_once_with(github_webhook=webhook,
owners_file_handler=mock_owners_instance) (or equivalent) after awaiting
webhook.process(), ensuring PullRequestHandler was instantiated with the actual
OwnersFileHandler instance returned by OwnersFileHandler.initialize; apply the
same assertion in both the shared recheck test and the review-thread test that
cover _recheck_merge_eligibility().
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@webhook_server/tests/test_github_api.py`:
- Around line 879-915: The shared recheck tests only assert that
PullRequestHandler.check_if_can_be_merged() was awaited, not that
PullRequestHandler was constructed with the correct OwnersFileHandler instance;
update the tests around the GithubWebhook.process() calls (where
OwnersFileHandler.initialize is patched and mock_pr_handler is used) to also
assert that mock_pr_handler.assert_called_once_with(github_webhook=webhook,
owners_file_handler=mock_owners_instance) (or equivalent) after awaiting
webhook.process(), ensuring PullRequestHandler was instantiated with the actual
OwnersFileHandler instance returned by OwnersFileHandler.initialize; apply the
same assertion in both the shared recheck test and the review-thread test that
cover _recheck_merge_eligibility().

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3bdc78b8-efe2-47b5-adcc-cdb4b3389700

📥 Commits

Reviewing files that changed from the base of the PR and between 414f268 and 94438f2.

📒 Files selected for processing (2)
  • webhook_server/libs/github_api.py
  • webhook_server/tests/test_github_api.py

@myakove myakove merged commit 38422af into main Mar 17, 2026
7 of 9 checks passed
@myakove myakove deleted the fix/issue-1038-resolved-threads-can-be-merged branch March 17, 2026 20:03
@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.

fix: resolved review threads don't trigger can-be-merged re-evaluation

3 participants