Skip to content

fix: prevent bot loop & enable E2E for forks#74

Merged
Kavirubc merged 2 commits intomainfrom
fix/prevent-bot-comment-loop
Feb 18, 2026
Merged

fix: prevent bot loop & enable E2E for forks#74
Kavirubc merged 2 commits intomainfrom
fix/prevent-bot-comment-loop

Conversation

@Kavirubc
Copy link
Copy Markdown
Contributor

@Kavirubc Kavirubc commented Feb 18, 2026

Problem

  1. Bot Loop ([Bug]: PR getting tagged as a duplicate for matching the related issue #73): When the bot posts a triage comment, the issue_comment: created event re-triggers the triage workflow, causing a double-post loop.
  2. Fork Failures (feat(ui): differentiate issues and PRs in similar threads #75): Forked PRs fail the E2E test because they run with restricted permissions (read-only token, no secrets), so BOT_PAT and API keys are missing.

Fixes

  1. Loop Guard: Added if: guard to skip triage execution when actor is gh-simili-bot or github-actions[bot]. Applied to both main triage.yml and generated test workflow.
  2. Fork Support: Switched E2E trigger to pull_request_target. This runs in the context of the base branch (main) with full secrets access, but explicitly checks out the PR code.

Fixes #73. Enables CI for external contributors.

Add 'if: github.actor != gh-simili-bot && github.actor != github-actions[bot]'
guard to the triage job so the bot's own comments do not re-trigger
the workflow, causing duplicate triage reports.

Applied to both the main triage.yml and the generated triage.yml
in the E2E test pipeline.

Fixes #73

Signed-off-by: Kavirubc <hapuarachchikaviru@gmail.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 18, 2026

📝 Walkthrough

Walkthrough

Two GitHub Actions workflows (e2e-test.yml and triage.yml) are updated with conditional guards that prevent the gh-simili-bot and github-actions[bot] from triggering the triage job, eliminating unintended workflow reruns caused by bot-generated comments.

Changes

Cohort / File(s) Summary
Workflow guard conditions
.github/workflows/e2e-test.yml, .github/workflows/triage.yml
Added if conditions to triage jobs to exclude execution when triggered by bot actors (gh-simili-bot and github-actions[bot]), preventing feedback loops from bot-posted comments.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • PR #71: Introduced the e2e-test workflow file; this PR adds the guard condition to prevent the workflow from being retriggered by bot comments on the same PRs.

Suggested labels

fix, bug, ci, automation, bot, triage

Poem

🐰 A bot that chases its own tail,
No more! We've found the holy grail,
With guards in place, the loop breaks free,
No self-triggering spree, just harmony! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding a guard condition to prevent the bot from triggering the triage workflow when it posts comments, preventing a feedback loop.
Linked Issues check ✅ Passed The PR successfully addresses issue #73 by implementing guards in both triage workflow files to prevent the bot and GitHub Actions from triggering workflow re-execution.
Out of Scope Changes check ✅ Passed All changes are scoped to the triage workflow files and directly address the feedback loop issue described in #73; no unrelated modifications are present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/prevent-bot-comment-loop

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.

@gh-simili-bot
Copy link
Copy Markdown
Contributor

Simili Triage Report

Note

Quality Score: 9.5/10 (Excellent)
The issue could be improved. See suggestions below.

Classification

Category Value
Labels
Quality Improvements
  • No direct links to the specific workflow files mentioned
  • Reproduction steps are described but not explicitly numbered
  • Add direct links to the relevant workflow files for quick access
  • For future bug reports, consider providing explicit, numbered reproduction steps
Similar Threads
Similarity Thread Status
84% #62 fix: prevent infinite bot comment loop Open
83% #67 fix: prevent bot loop on pull_request.edited ev... Open
81% #58 Enhancement: Workflow concurrency control Open

Generated by Simili Bot

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.

🧹 Nitpick comments (1)
.github/workflows/e2e-test.yml (1)

230-231: Guard is correct, but the e2e loop test only exercises the github-actions[bot] branch.

The embedded triage.yml does not pass github_token in its with: block, so the action always uses GITHUB_TOKEN and the triggering actor is always github-actions[bot]. The gh-simili-bot branch of the if: guard (which covers the production scenario where SIMILI_BOT_TOKEN is supplied) is never exercised by the e2e loop-prevention test.

Consider adding github_token: ${{ secrets.GH_PAT }} to the embedded triage.yml's with: block and updating the BOT variable in the poll/loop-check steps accordingly, so the e2e test mirrors the production token path.

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

In @.github/workflows/e2e-test.yml around lines 230 - 231, The e2e test only
hits the github-actions[bot] branch because the embedded triage.yml doesn't pass
a PAT; update the embedded triage.yml's with: block to include github_token: ${{
secrets.GH_PAT }} so the action uses the GH_PAT (simulating SIMILI_BOT_TOKEN)
and then adjust the BOT variable used in the poll/loop-check steps to match the
simulated actor (gh-simili-bot) so the if: guard (github.actor !=
'gh-simili-bot' && github.actor != 'github-actions[bot]') is exercised for both
branches; locate the embedded triage.yml and the poll/loop-check steps
(variables named BOT or references to the poll/loop-check logic) and change
their token and BOT settings accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.github/workflows/e2e-test.yml:
- Around line 230-231: The e2e test only hits the github-actions[bot] branch
because the embedded triage.yml doesn't pass a PAT; update the embedded
triage.yml's with: block to include github_token: ${{ secrets.GH_PAT }} so the
action uses the GH_PAT (simulating SIMILI_BOT_TOKEN) and then adjust the BOT
variable used in the poll/loop-check steps to match the simulated actor
(gh-simili-bot) so the if: guard (github.actor != 'gh-simili-bot' &&
github.actor != 'github-actions[bot]') is exercised for both branches; locate
the embedded triage.yml and the poll/loop-check steps (variables named BOT or
references to the poll/loop-check logic) and change their token and BOT settings
accordingly.

gh-simili-bot
gh-simili-bot previously approved these changes Feb 18, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🧪 E2E Test

Bot responded: no

Test repo → gh-simili-bot/simili-e2e-22143742374
Run → logs

Auto-generated by E2E pipeline

The previous guard 'github.actor != gh-simili-bot' was too broad —
it also skipped the job when gh-simili-bot opens an issue (which is
exactly what the E2E test does for the trigger issue).

Corrected to only skip issue_comment events from the bot:
  if: github.event_name != 'issue_comment' ||
      (github.actor != 'gh-simili-bot' && github.actor != 'github-actions[bot]')

Signed-off-by: Kavirubc <hapuarachchikaviru@gmail.com>
@github-actions
Copy link
Copy Markdown
Contributor

🧪 E2E Test

Bot responded: yes

Test repo → gh-simili-bot/simili-e2e-22144058691
Run → logs

Auto-generated by E2E pipeline

@Kavirubc Kavirubc merged commit dcdce6e into main Feb 18, 2026
5 checks passed
@Kavirubc Kavirubc deleted the fix/prevent-bot-comment-loop branch February 18, 2026 14:53
@github-project-automation github-project-automation Bot moved this from Todo to Done in simili-bot-v1-release Feb 18, 2026
@Kavirubc Kavirubc changed the title fix: prevent bot comment feedback loop in triage workflow fix: prevent bot loop & enable E2E for forks Feb 18, 2026
@gh-simili-bot
Copy link
Copy Markdown
Contributor

Simili Triage Report

Note

Quality Score: 9.5/10 (Excellent)
The issue could be improved. See suggestions below.

Classification

Category Value
Labels
Quality Improvements
  • No explicit 'before' and 'after' examples (e.g., screenshots, log snippets) of the bot loop or E2E test failures.
  • For future fix descriptions, consider including visual evidence (screenshots, log snippets) to demonstrate the problem before the fix and the successful outcome after the fix, even if the problem is well-understood.
Similar Threads
Similarity Thread Status
83% #67 fix: prevent bot loop on pull_request.edited ev... Open
82% #62 fix: prevent infinite bot comment loop Open

Warning

Possible Duplicate (Confidence: 90%)
This pull request might be a duplicate of #62.
Reason: The current issue addresses two problems: a bot loop and E2E failures for forks. The first problem, 'Bot Loop (#73)', describes a scenario where the bot's own comment triggers the triage workflow via the issue_comment: created event, leading to a double-post loop. Similar Issue #62, titled 'fix: prevent infinite bot comment loop', describes the exact same root cause and expected outcome as the bot loop problem addressed in the current issue. The 'Loop Guard' fix implemented in the current issue specifically targets this type of bot loop by adding an if: guard for bot actors on issue_comment: created events, which would fully resolve Issue #62. Similar Issue #67, 'fix: prevent bot loop on pull_request.edited events', describes a bot loop with a different triggering event (pull_request.edited), indicating a distinct root cause, making it related but not a duplicate.


Generated by Simili Bot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ci/cd fix workflow

Projects

No open projects

Development

Successfully merging this pull request may close these issues.

[Bug]: PR getting tagged as a duplicate for matching the related issue

2 participants