Skip to content

feat: trigger CodeRabbit plan after issue assignment - #2577

Draft
ParasSalonia wants to merge 3 commits into
hiero-ledger:mainfrom
ParasSalonia:fix/coderabbit-assignment-integration
Draft

feat: trigger CodeRabbit plan after issue assignment#2577
ParasSalonia wants to merge 3 commits into
hiero-ledger:mainfrom
ParasSalonia:fix/coderabbit-assignment-integration

Conversation

@ParasSalonia

@ParasSalonia ParasSalonia commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Linked Issue

Changes

  • Added CodeRabbit plan triggering after successful issue assignment.
  • Skip triggering when a CodeRabbit plan already exists for the issue.
  • Added tests covering the new CodeRabbit assignment flow.
  • Updated Jest configuration to include the required tests.

Testing

  • ✅ 243 Jest tests passed
  • ✅ 35 Python tests passed
  • git diff --check passed

Testing done on Fork:

  1. CodeRabbit plan trigger after successful assignment

    ◦ Issue: Test: CodeRabbit plan trigger
    ◦ Log: https://github.com/ParasSalonia/hiero-sdk-python/actions/runs/33009564342/job/98312006540

  2. Already assigned : CodeRabbit plan is not triggered when the assignment is rejected.

    ◦ Issue: testing more than one issue assign #10
    ◦ Log: https://github.com/ParasSalonia/hiero-sdk-python/actions/runs/33159976369/job/98811797995

Summary

Integrates CodeRabbit plan generation into the issue assignment flow while avoiding duplicate plans and keeping the existing assignment behavior unchanged.

Signed-off-by: ParasSalonia <parassalonia22@gmail.com>
@ParasSalonia
ParasSalonia force-pushed the fix/coderabbit-assignment-integration branch from 43be2dc to b00731f Compare August 22, 2026 20:06
@github-actions

Copy link
Copy Markdown

Hello, this is the OfficeHourBot.

This is a reminder that the Hiero Python SDK Office Hours will begin in approximately 3 hours and 49 minutes (14:00 UTC).

This session provides an opportunity to ask questions regarding this Pull Request.

Details:

Disclaimer: This is an automated reminder. Please verify the schedule here for any changes.

From,
The Python SDK Team

@ParasSalonia
ParasSalonia marked this pull request as ready for review August 28, 2026 09:47
@ParasSalonia
ParasSalonia requested review from a team as code owners August 28, 2026 09:47
@github-actions github-actions Bot added open to community review PR is open for community review and feedback queue:junior-committer PR awaiting initial quality review labels Aug 28, 2026
@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The issue assignment flow now integrates CodeRabbit plan detection and triggering after successful assignments. Jest coverage validates duplicate suppression, trigger failures, assignment failures, and updated test discovery.

Changes

CodeRabbit assignment integration

Layer / File(s) Summary
Post-assignment CodeRabbit integration
.github/scripts/shared/core/issue-assign.js
The flow checks for an existing CodeRabbit plan after successful assignment. It triggers a plan only when none exists and logs trigger errors without failing the assignment.
Assignment flow test coverage
.github/scripts/__tests__/jest/issue-assign.test.js, .github/scripts/jest.config.js
Tests mock the CodeRabbit helpers and cover triggering, existing-plan suppression, trigger failures, and assignment failures. Jest discovery now matches any __tests__/jest/ directory.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: 🔵 Low · up to 7dd1c

Issue assignment can create duplicate CodeRabbit plans when an existing plan cannot be verified, or skip plan creation based on untrusted comment text. The PR is otherwise mergeable with explicit owner awareness and follow-up on verified plan-state handling.

Sequence Diagram(s)

sequenceDiagram
  participant issue_assign_js
  participant hasExistingCodeRabbitPlan
  participant triggerCodeRabbitPlan
  issue_assign_js->>hasExistingCodeRabbitPlan: Check assigned issue for an existing plan
  hasExistingCodeRabbitPlan-->>issue_assign_js: Return plan existence
  issue_assign_js->>triggerCodeRabbitPlan: Trigger plan when none exists
  triggerCodeRabbitPlan-->>issue_assign_js: Return success or error
Loading
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR implements post-assignment triggering, duplicate-plan suppression, failure isolation, and related tests. The provided changes do not show removal of obsolete automatic mentor assignment or its … Remove the obsolete automatic mentor-assignment behavior and all related unused code, configuration, workflow steps, imports, and tests. Add tests that verify the mentor-assignment behavior was removed.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the primary change: triggering a CodeRabbit plan after successful issue assignment.
Description check ✅ Passed The description directly explains the CodeRabbit plan integration, duplicate prevention, tests, configuration change, and validation results.
Out of Scope Changes check ✅ Passed The changed issue-assignment logic, tests, and Jest configuration directly support the CodeRabbit integration objectives. No unrelated code changes are identified.
Full details: Linked Issues check

Explanation

The PR implements post-assignment triggering, duplicate-plan suppression, failure isolation, and related tests. The provided changes do not show removal of obsolete automatic mentor assignment or its related code, configuration, workflow steps, imports, and tests, which is an explicit requirement of issue #2548.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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 info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 9397f04a-3941-4d60-8bb0-1087eaacfdc5

📥 Commits

Reviewing files that changed from the base of the PR and between dfbbf4e and 7dd1cf6.

📒 Files selected for processing (3)
  • .github/scripts/__tests__/jest/issue-assign.test.js
  • .github/scripts/jest.config.js
  • .github/scripts/shared/core/issue-assign.js

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.

Comment on lines +297 to +304
const planExists = await hasExistingCodeRabbitPlan(
github,
owner,
repoName,
issueNumber
);

if (!planExists) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Use a verified plan state before triggering.

hasExistingCodeRabbitPlan returns false when comment lookup fails. This flow then creates a duplicate plan when an existing plan cannot be checked. The helper also accepts untrusted comment text containing @coderabbitai plan as an existing plan, so a contributor can suppress the trigger without a verified plan marker.

Return distinct existing, missing, and unknown states. Trigger only for confirmed missing state. Accept only the controlled marker, or another trusted CodeRabbit-produced signal, as existing.

As per path instructions, “Do not trust free-form text from issues, PRs, or comments” and “Use marker-based patterns to prevent duplicate actions.”

Source: Path instructions

@MonaaEid MonaaEid left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi @ParasSalonia thanks for this PR! Have you tested it in your fork? If not, I recommend testing it by merging these changes into your fork and giving it a try.. I’m happy to help if needed

@parvninama parvninama left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM overall! Just a couple of structural changes I think should be addressed before moving forward:

Comment on lines +43 to +47
const {
triggerCodeRabbitPlan,
hasExistingCodeRabbitPlan,
} = require('../../coderabbit_plan_trigger.js');

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could we move the CodeRabbit functionality into the shared helpers layer as part of this migration?

runAssignmentFlow is currently importing/mocking triggerCodeRabbitPlan and hasExistingCodeRabbitPlan from the legacy coderabbit_plan_trigger.js location. Since this issue is migrating the existing CodeRabbit behaviour into the new assignment architecture, it would be cleaner to have the reusable CodeRabbit operations under .github/scripts/shared/ (consistent with the other shared helpers) and have the assignment flow consume that implementation.

@parvninama parvninama Aug 31, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If coderabbit_plan_trigger.js and the old CodeRabbit workflow/files are no longer referenced after the migration, could we remove those obsolete files/workflows as well?

module.exports = {
testEnvironment: 'node',
testMatch: ['<rootDir>/__tests__/jest/**/*.test.js'],
testMatch: ['**/__tests__/jest/**/*.test.js'],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Out of scope? Could we remove this from the PR unless there’s a specific test-discovery issue that this change is intended to fix?

@ParasSalonia

ParasSalonia commented Aug 31, 2026

Copy link
Copy Markdown
Contributor Author
  • Hi @MonaaEid I had already tested this in my fork. I had attached the test that I had performed on my fork with the PR description already.

@ParasSalonia
ParasSalonia marked this pull request as draft September 1, 2026 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

open to community review PR is open for community review and feedback queue:junior-committer PR awaiting initial quality review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Integrate CodeRabbit planning into the assignment flow

4 participants