Skip to content

refactor: PR lifecycle bots#2363

Merged
exploreriii merged 15 commits into
hiero-ledger:mainfrom
exploreriii:pr-lifecycle
Jul 10, 2026
Merged

refactor: PR lifecycle bots#2363
exploreriii merged 15 commits into
hiero-ledger:mainfrom
exploreriii:pr-lifecycle

Conversation

@exploreriii

Copy link
Copy Markdown
Contributor

Description:
Replaces three scheduling bots tackling contributor lifecycle with one github action.

Ensures configuration options are easy to change.

Changes auto close PR logic so it only auto closes after a review, and the stale time is met. It doesn't close on unreviewed PRs.
It also doesn't auto close on certain labels, which are now easier to handle (the label was changed previiously which is why it broke)

Bug fixes relating to pr linkage detection, jq over parsing and multiple assignees.

Keeps the new file as an isolated module, for now

Related issue(s):

Fixes #2362

Checklist

  • [ X] Documented (Code comments, README, etc.)
  • [ X] Tested (unit, integration, etc.)

@exploreriii exploreriii changed the title Pr lifecycle refactor: PR lifecycle bots Jun 17, 2026
@github-actions github-actions Bot added approved Issue has been approved by team member skill: advanced requires knowledge of multiple areas in the codebase without defined steps to implement or examples labels Jun 17, 2026
@exploreriii
exploreriii marked this pull request as ready for review June 17, 2026 16:13
@exploreriii
exploreriii requested a review from a team as a code owner June 17, 2026 16:13
Copilot AI review requested due to automatic review settings June 17, 2026 16:13
@exploreriii
exploreriii requested review from a team as code owners June 17, 2026 16:13
@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 Jun 17, 2026

Copilot AI 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.

Pull request overview

This PR consolidates multiple contributor/PR lifecycle scheduling bots into a single GitHub Actions workflow + Node script, aiming to reduce drift/bugs and make thresholds/skip-labels easier to configure while ensuring PRs are only auto-closed after human review.

Changes:

  • Replaces three scheduled workflows and their scripts with a unified bot-contributor-lifecycle workflow + bot-contributor-lifecycle.js.
  • Adds Jest unit tests and a dedicated workflow to run them on PRs/pushes touching the bot code.
  • Updates fork-testing documentation to describe configuring thresholds via workflow inputs instead of editing scripts.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
docs/sdk_developers/training/testing_forks.md Updates guidance for testing the new unified lifecycle bot via workflow inputs.
.github/workflows/test-bot-contributor-lifecycle.yml Adds CI workflow to run Jest unit tests for the lifecycle bot.
.github/workflows/cron-reminder-pr-inactive.yml Removes legacy PR inactivity reminder workflow.
.github/workflows/cron-reminder-issue-no-pr.yml Removes legacy “issue assigned but no PR” reminder workflow.
.github/workflows/bot-inactivity-unassign.yml Removes legacy inactivity unassign/close workflow.
.github/workflows/bot-contributor-lifecycle.yml Adds unified scheduled + manually-triggerable lifecycle bot workflow.
.github/scripts/test-bot-inactivity-unassign.sh Removes legacy bash test harness for the old bot.
.github/scripts/cron-reminder-pr-inactive.js Removes legacy PR inactivity reminder script.
.github/scripts/cron-reminder-issue-no-pr.sh Removes legacy issue reminder script.
.github/scripts/bot-inactivity-unassign.sh Removes legacy inactivity unassign/close bash bot implementation.
.github/scripts/bot-contributor-lifecycle.js Adds the consolidated lifecycle bot implementation (issues + linked PR logic).
.github/scripts/tests/bot-contributor-lifecycle.test.js Adds unit tests validating reminder/unassign/close behavior and edge cases.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/test-bot-contributor-lifecycle.yml Outdated
Comment thread .github/workflows/test-bot-contributor-lifecycle.yml Outdated
Comment thread .github/scripts/bot-contributor-lifecycle.js Outdated
Comment thread docs/sdk_developers/training/testing_forks.md Outdated
Comment thread docs/sdk_developers/training/testing_forks.md Outdated
@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

This PR replaces three contributor automation scripts/workflows with a single JavaScript lifecycle bot, adds a scheduled/manual workflow and a matching test workflow, and updates the training docs for manual runs.

Changes

Contributor Lifecycle Bot Consolidation

Layer / File(s) Summary
Shared helpers and message builders
\.github/scripts/bot-contributor-lifecycle.js``
Defines strict env parsing, skip-label normalization, bot marker detection, assignment and /working extraction, linked PR checks, paginated API lookups, and message builders for issue and PR notices.
No-linked-PR escalation
\.github/scripts/bot-contributor-lifecycle.js``
Implements the no-linked-PR path with dry-run-aware comment and unassign helpers, per-assignee age baselines, reminder and unassign partitioning, and per-assignee error isolation.
Linked-PR escalation
\.github/scripts/bot-contributor-lifecycle.js``
Implements the linked-open-PR path with dry-run-aware PR comment and close helpers, PR classification from labels, reviews, commits, and /working timestamps, and conditional issue-wide unassignment.
Entrypoint and workflow wiring
\.github/scripts/bot-contributor-lifecycle.js`, .github/workflows/bot-contributor-lifecycle.yml`, .github/workflows/test-bot-contributor-lifecycle.yml`, docs/sdk_developers/training/testing_forks.md`
Adds the exported entrypoint that routes issues through the stage handlers, the daily/manual workflow, the targeted test workflow, and the training docs update for running the bot from Actions.
Jest coverage
\.github/scripts/tests/jest/bot-contributor-lifecycle.test.js``
Builds in-memory fixtures and a Jest suite that exercises reminder, unassign, close, skip, dry-run, marker, multi-assignee, and fallback scenarios across the lifecycle bot.

Sequence Diagram(s)

sequenceDiagram
  participant bot_contributor_lifecycle_yml
  participant actions_github_script
  participant bot_contributor_lifecycle_js
  participant github_rest_graphql_apis

  bot_contributor_lifecycle_yml->>actions_github_script: pass thresholds, skip_pr_labels, DRY_RUN
  actions_github_script->>bot_contributor_lifecycle_js: require(...) and invoke({ github, context })
  bot_contributor_lifecycle_js->>github_rest_graphql_apis: list issues, comments, reviews, commits, and linkage
  github_rest_graphql_apis-->>bot_contributor_lifecycle_js: issue and PR data
  bot_contributor_lifecycle_js-->>actions_github_script: logs, counters, and failures
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 59.46% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately reflects the main change: consolidating PR lifecycle bots.
Description check ✅ Passed The description matches the PR by describing the consolidation, lifecycle behavior changes, bug fixes, docs, and tests.
Linked Issues check ✅ Passed The changes satisfy #2362 by consolidating the bots and improving review-aware auto-close and lifecycle handling.
Out of Scope Changes check ✅ Passed The deleted scripts, workflows, docs, and tests are all tied to the lifecycle-bot consolidation and behavior changes.

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

📋 Issue Planner

Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).

View plan for ticket: #2362

✨ 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: 8


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: d240c32c-8ec1-4332-8fe0-0b698f5986c9

📥 Commits

Reviewing files that changed from the base of the PR and between 5df93b7 and baed3f5.

📒 Files selected for processing (12)
  • .github/scripts/__tests__/bot-contributor-lifecycle.test.js
  • .github/scripts/bot-contributor-lifecycle.js
  • .github/scripts/bot-inactivity-unassign.sh
  • .github/scripts/cron-reminder-issue-no-pr.sh
  • .github/scripts/cron-reminder-pr-inactive.js
  • .github/scripts/test-bot-inactivity-unassign.sh
  • .github/workflows/bot-contributor-lifecycle.yml
  • .github/workflows/bot-inactivity-unassign.yml
  • .github/workflows/cron-reminder-issue-no-pr.yml
  • .github/workflows/cron-reminder-pr-inactive.yml
  • .github/workflows/test-bot-contributor-lifecycle.yml
  • docs/sdk_developers/training/testing_forks.md
💤 Files with no reviewable changes (7)
  • .github/workflows/bot-inactivity-unassign.yml
  • .github/workflows/cron-reminder-pr-inactive.yml
  • .github/scripts/bot-inactivity-unassign.sh
  • .github/workflows/cron-reminder-issue-no-pr.yml
  • .github/scripts/test-bot-inactivity-unassign.sh
  • .github/scripts/cron-reminder-pr-inactive.js
  • .github/scripts/cron-reminder-issue-no-pr.sh

Comment thread .github/scripts/__tests__/bot-contributor-lifecycle.test.js Outdated
Comment thread .github/scripts/bot-contributor-lifecycle.js
Comment thread .github/scripts/bot-contributor-lifecycle.js Outdated
Comment thread .github/scripts/bot-contributor-lifecycle.js
Comment thread .github/scripts/bot-contributor-lifecycle.js
Comment thread .github/workflows/bot-contributor-lifecycle.yml Outdated
Comment thread docs/sdk_developers/training/testing_forks.md Outdated
Comment thread .github/scripts/bot-contributor-lifecycle.js
Comment thread .github/scripts/bot-contributor-lifecycle.js Outdated
@aceppaluni aceppaluni added reviewer: maintainer PR needs a review from the maintainer team reviewer: committer request review help from a committer status: Needs Developer Revision Author needs to apply suggested changes/improvements labels Jun 17, 2026
@exploreriii exploreriii removed the status: Needs Developer Revision Author needs to apply suggested changes/improvements label Jun 17, 2026
manishdait
manishdait previously approved these changes Jun 18, 2026
@github-actions github-actions Bot added queue:committers PR awaiting committer technical review and removed queue:junior-committer PR awaiting initial quality review labels Jun 18, 2026

@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: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: aa9ea07b-0f4f-499e-8ca4-7686260f8240

📥 Commits

Reviewing files that changed from the base of the PR and between d49373c and a109278.

📒 Files selected for processing (12)
  • .github/scripts/__tests__/bot-contributor-lifecycle.test.js
  • .github/scripts/bot-contributor-lifecycle.js
  • .github/scripts/bot-inactivity-unassign.sh
  • .github/scripts/cron-reminder-issue-no-pr.sh
  • .github/scripts/cron-reminder-pr-inactive.js
  • .github/scripts/test-bot-inactivity-unassign.sh
  • .github/workflows/bot-contributor-lifecycle.yml
  • .github/workflows/bot-inactivity-unassign.yml
  • .github/workflows/cron-reminder-issue-no-pr.yml
  • .github/workflows/cron-reminder-pr-inactive.yml
  • .github/workflows/test-bot-contributor-lifecycle.yml
  • docs/sdk_developers/training/testing_forks.md
💤 Files with no reviewable changes (7)
  • .github/workflows/cron-reminder-pr-inactive.yml
  • .github/workflows/cron-reminder-issue-no-pr.yml
  • .github/scripts/cron-reminder-issue-no-pr.sh
  • .github/workflows/bot-inactivity-unassign.yml
  • .github/scripts/cron-reminder-pr-inactive.js
  • .github/scripts/test-bot-inactivity-unassign.sh
  • .github/scripts/bot-inactivity-unassign.sh

Comment thread .github/workflows/bot-contributor-lifecycle.yml
Comment thread .github/workflows/test-bot-contributor-lifecycle.yml Outdated
@github-actions github-actions Bot added the queue:junior-committer PR awaiting initial quality review label Jun 21, 2026
@github-actions github-actions Bot added queue:committers PR awaiting committer technical review and removed queue:junior-committer PR awaiting initial quality review labels Jul 10, 2026

@danielmarv danielmarv 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.

Thanks @exploreriii

One thing before merge i would like us to look into: handleNoPRStage and handlePRStage don't handle failures the same way.

In handleNoPRStage, users are unassigned before the reminder comment is posted, so even if commenting fails, the important action still happens.

In handlePRStage, it's the opposite: comments/PR closes happen first, and unassignment runs last. If a comment or close call throws, the function exits before anyone gets unassigned even if the comment already said they would be.

It'll recover on the next scheduled run, so it's not critical, but it weakens the main reliability guarantee of the bot on the PR path.

Left a note on the specific loop. Otherwise, the rest looks good.

Comment thread .github/scripts/bot-contributor-lifecycle.js

@danielmarv danielmarv 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.

Thanks @exploreriii

One thing before merge i would like us to look into: handleNoPRStage and handlePRStage don't handle failures the same way.

In handleNoPRStage, users are unassigned before the reminder comment is posted, so even if commenting fails, the important action still happens.

In handlePRStage, it's the opposite: comments/PR closes happen first, and unassignment runs last. If a comment or close call throws, the function exits before anyone gets unassigned even if the comment already said they would be.

It'll recover on the next scheduled run, so it's not critical, but it weakens the main reliability guarantee of the bot on the PR path.

Left a note on the specific loop. Otherwise, the rest looks good.

@AntonioCeppellini AntonioCeppellini 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.

looking good to me, @danielmarv is a good point

@Mounil2005 Mounil2005 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.

Thanks for letting me take a look at this! The consolidation looks good, and the test coverage is quite thorough.

+1 on what @danielmarv pointed out.

One small suggestion, unrelated to the above: right now the bot's === Summary === block only shows up in the raw Actions log, so you'd have to open the run and scroll through the console output to see what it did on a given day. We already have a precedent for surfacing this more visibly, pr-check-test-files.js writes to $GITHUB_STEP_SUMMARY (guarded behind if (process.env.GITHUB_STEP_SUMMARY), so it's a safe no-op outside CI). Might be worth doing the same here at the end of module.exports, turning the existing stats object into a small markdown table instead of just console output. Not blocking, just thought it'd be a nice quality-of-life improvement for visibility since this runs unattended every day.

MonaaEid
MonaaEid previously approved these changes Jul 10, 2026
@github-actions github-actions Bot added status: ready-to-merge PR has 1+ maintainer and 2+ total approvals, ready to merge and removed queue:committers PR awaiting committer technical review labels Jul 10, 2026
Signed-off-by: exploreriii <133720349+exploreriii@users.noreply.github.com>
Signed-off-by: exploreriii <133720349+exploreriii@users.noreply.github.com>
@exploreriii
exploreriii dismissed stale reviews from MonaaEid and manishdait via eb6b944 July 10, 2026 18:44
@github-actions github-actions Bot added queue:junior-committer PR awaiting initial quality review and removed status: ready-to-merge PR has 1+ maintainer and 2+ total approvals, ready to merge labels Jul 10, 2026

@danielmarv danielmarv 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!

@MonaaEid
MonaaEid enabled auto-merge (squash) July 10, 2026 20:24
@github-actions github-actions Bot added status: ready-to-merge PR has 1+ maintainer and 2+ total approvals, ready to merge and removed queue:junior-committer PR awaiting initial quality review labels Jul 10, 2026
@MonaaEid
MonaaEid disabled auto-merge July 10, 2026 20:37
@exploreriii
exploreriii merged commit 92e7bcd into hiero-ledger:main Jul 10, 2026
14 of 15 checks passed
@github-actions

Copy link
Copy Markdown

👋 Hi @exploreriii! Great work completing a Advanced issue! 🎉

Thanks for your contribution! 🚀

Here are some issues you might want to explore next:

🌟 Stay connected:

Happy coding! 🚀
— Hiero Python SDK Team

@MonaaEid MonaaEid added this to the v0.2.9 milestone Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Issue has been approved by team member open to community review PR is open for community review and feedback reviewer: committer request review help from a committer reviewer: maintainer PR needs a review from the maintainer team skill: advanced requires knowledge of multiple areas in the codebase without defined steps to implement or examples status: ready-to-merge PR has 1+ maintainer and 2+ total approvals, ready to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Edit the auto close bots