Skip to content

fix: show helpful message when /retest has nothing to retest#2399

Merged
chmouel merged 2 commits intotektoncd:mainfrom
mathur07:SRVKP-10373
Mar 5, 2026
Merged

fix: show helpful message when /retest has nothing to retest#2399
chmouel merged 2 commits intotektoncd:mainfrom
mathur07:SRVKP-10373

Conversation

@mathur07
Copy link
Contributor

@mathur07 mathur07 commented Jan 15, 2026

📝 Description of the Change

When using /retest or /ok-to-test and all pipelines have already succeeded, the command now shows a helpful message instead of the misleading "could not find any PipelineRun in your .tekton/ directory" error.

New message:

"all PipelineRuns for this commit have already succeeded. Use /retest <pipeline-name> to re-run a specific pipeline or /test to re-run all"

This guides users to:

  • Use /retest <pipeline-name> to re-run a specific pipeline
  • Use /test to re-run all pipelines

👨🏻‍ Linked Jira

Fixes: SRVKP-10373

🔗 Linked GitHub Issue

Fixes #

🚀 Type of Change

  • 🐛 Bug fix (fix:)
  • ✨ New feature (feat:)
  • 💥 Breaking change (feat!:, fix!:)
  • 📚 Documentation update (docs:)
  • ⚙️ Chore (chore:)
  • 💅 Refactor (refactor:)
  • 🔧 Enhancement (enhance:)
  • 📦 Dependency update (deps:)

🧪 Testing Strategy

  • Unit tests
  • Integration tests
  • End-to-end tests
  • Manual testing
  • Not Applicable

🤖 AI Assistance

  • I have not used any AI assistance for this PR.
  • I have used AI assistance for this PR.

If you have used AI assistance, please provide the following details:

Which LLM was used?

  • GitHub Copilot
  • ChatGPT (OpenAI)
  • Claude (Anthropic)
  • Cursor
  • Gemini (Google)
  • Other: ____________

Extent of AI Assistance:

  • Documentation and research only
  • Unit tests or E2E tests only
  • Code generation (parts of the code)
  • Full code generation (most of the PR)
  • PR description and comments
  • Commit message(s)

Important

If the majority of the code in this PR was generated by an AI, please add a Co-authored-by trailer to your commit message.
For example:

Co-authored-by: Gemini gemini@google.com
Co-authored-by: ChatGPT noreply@chatgpt.com
Co-authored-by: Claude noreply@anthropic.com
Co-authored-by: Cursor noreply@cursor.com
Co-authored-by: Copilot Copilot@users.noreply.github.com

**💡You can use the script ./hack/add-llm-coauthor.sh to automatically add
these co-author trailers to your commits.

✅ Submitter Checklist

  • 📝 My commit messages are clear, informative, and follow the project's How to write a git commit message guide. The Gitlint linter ensures in CI it's properly validated
  • ✨ I have ensured my commit message prefix (e.g., fix:, feat:) matches the "Type of Change" I selected above.
  • ♽ I have run make test and make lint locally to check for and fix any
    issues. For an efficient workflow, I have considered installing
    pre-commit and running pre-commit install to
    automate these checks.
  • 📖 I have added or updated documentation for any user-facing changes.
  • 🧪 I have added sufficient unit tests for my code changes.
  • 🎁 I have added end-to-end tests where feasible. See README for more details.
  • 🔎 I have addressed any CI test flakiness or provided a clear reason to bypass it.
  • If adding a provider feature, I have filled in the following and updated the provider documentation:
    • GitHub App
    • GitHub Webhook
    • Gitea/Forgejo
    • GitLab
    • Bitbucket Cloud
    • Bitbucket Data Center

@gemini-code-assist
Copy link

Summary of Changes

Hello @mathur07, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request improves the functionality of the /retest and /ok-to-test commands. Previously, these commands would not initiate a new pipeline run if all existing pipelines had already passed. With this change, users can now force a complete re-execution of all associated pipelines, providing greater control and flexibility for triggering builds, even in the absence of failures.

Highlights

  • Enhanced /retest Command Behavior: The /retest and /ok-to-test commands now trigger a full re-run of all pipelines even if all previous pipeline runs have already succeeded, providing a way to force a re-run.
  • Test Case Clarification: A clarifying comment was added to pkg/matcher/annotation_matcher_test.go to explain the interaction between the filterSuccessfulTemplates function and the new re-run logic.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a useful fix to allow /retest to re-run all pipelines even if they have all succeeded. The implementation also extends this behavior to /ok-to-test. My main feedback is to add a unit test to cover this new logic and to update the pull request description to reflect the full scope of the change, including /ok-to-test.

@mathur07
Copy link
Contributor Author

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly implements the desired behavior for /retest and /ok-to-test commands. When all pipelines have already succeeded, these commands will now trigger a re-run of all pipelines instead of doing nothing. The logic is sound, and the addition of an integration test (TestRetestRerunsAllWhenAllSucceeded) is a great way to ensure this new functionality is well-tested. I have one suggestion to make the new test even more robust by asserting on the log output.

@zakisk
Copy link
Member

zakisk commented Jan 16, 2026

@mathur07 this is expected behavior, if someone really needs to re-run all the PipelineRuns then they should use /test command. (docs link)

@infernus01
Copy link
Member

infernus01 commented Jan 16, 2026

@mathur07 The comment that we're getting when doing /retest (after every check is succeeded) is misleading, I think we need to just modify the comment to something like "all PipelineRuns for this commit have already succeeded. Use /retest <pipeline-name> to re-run a specific pipeline or /test to re-run all".

@pipelines-as-code
Copy link

pipelines-as-code bot commented Jan 26, 2026

🔍 PR Lint Feedback

Note: This automated check helps ensure your PR follows our contribution guidelines.

⚠️ Items that need attention:

🤖 AI attribution

The following commits lack an explicit AI attribution footer:

  • 7e13f63 fix: improve message when /retest has nothing to retest
  • 52922c4 fix: improve message when /retest has nothing to retest

If no AI assistance was used for a commit, you can ignore this warning.
Otherwise add an Assisted-by: or Co-authored-by: footer referencing the AI used.


ℹ️ Next Steps

  • Review and address the items above
  • Push new commits to update this PR
  • This comment will be automatically updated when issues are resolved
🔧 Admin Tools (click to expand)

Automated Issue/Ticket Creation:

  • /issue-create - Generate a GitHub issue from this PR content using AI
  • /jira-create - Create a SRVKP Jira ticket from this PR content using AI

⚠️ Important: Always review and edit generated content before finalizing tickets/issues.
The AI-generated content should be used as a starting point and may need adjustments.

These commands are available to maintainers and will post the generated content as PR comments for review.

🤖 This feedback was generated automatically by the PR CI system

@mathur07
Copy link
Contributor Author

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request aims to change the behavior of the /retest command when all pipelines have already succeeded. I've found a critical discrepancy between the described behavior in the pull request and the actual implementation in the code. My review includes a comment with a suggested fix to align the code with the PR's stated goal.

@mathur07 mathur07 changed the title fix: make /retest re-run all pipelines when all have succeeded fix: show helpful message when /retest has nothing to retest Jan 26, 2026
@mathur07 mathur07 requested a review from chmouel January 26, 2026 06:59
@mathur07 mathur07 force-pushed the SRVKP-10373 branch 2 times, most recently from 0aa799e to 07d7cc4 Compare February 12, 2026 04:16
if matchedPRs, err = matcher.MatchPipelinerunByAnnotation(ctx, p.logger, pipelineRuns, p.run, p.event, p.vcx, p.eventEmitter, repo, true); err != nil {
// Check if all pipelines have already succeeded - just log, don't create neutral status
if errors.Is(err, matcher.ErrAllPipelinesSucceeded) {
p.eventEmitter.EmitMessage(nil, zap.InfoLevel, "RepositoryAllPipelinesSucceeded", err.Error())
Copy link
Member

Choose a reason for hiding this comment

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

IMO this should create a comment on the pull request. Since we're not creating a neutral check, if we don't post a comment, from the users perspective PaC just didn't do anything.

Suggested change
p.eventEmitter.EmitMessage(nil, zap.InfoLevel, "RepositoryAllPipelinesSucceeded", err.Error())
p.eventEmitter.EmitMessage(nil, zap.InfoLevel, "RepositoryAllPipelinesSucceeded", err.Error())
if err := p.vcx.CreateComment(ctx, p.event, err.Error(), ""); err != nil {
return nil, fmt.Errorf("Error adding no pipelineruns to rerun comment: %v", err)
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you!

Copy link
Member

Choose a reason for hiding this comment

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

@aThorp96 if we create comment then it would be just last on MR/PR even after there are PipelineRuns to be run from that PR and also we have settings for comment whether user wants no comment at all or wants to update the comments.

Copy link
Member

Choose a reason for hiding this comment

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

@mathur07 we have func createNeutralStatus in the same file match.go for this. you can create neutral status on PR saying that there is no PipelineRun to trigger and it also checks for comment update and other settings.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the review @zakisk

On comment strategy: The Repository CR docs say that comment_strategy (update / disable_all) applies only to comments about a PipelineRun’s status (e.g. “started,” “succeeded”). It also says: “Comments may still appear if there are errors validating PipelineRuns in the .tekton directory.” The message we post for “all pipelines already succeeded” is in that same category: it’s informational/guidance (like validation errors), not a PipelineRun status update, so it’s intended to be outside the scope of comment_strategy and can still be posted when the user would otherwise have no comment or only updated status comments.

On using createNeutralStatus instead of a comment: A neutral status makes sense when we’re reporting that no PipelineRun was triggered (e.g. “no match for this event”). Here we’re not reporting a check result; we’re explaining that there’s nothing to retest and how to use /retest <pipeline-name> or /test. That’s user guidance, not a CI “check,” so a PR comment is a better fit than a neutral status. Keeping it as a comment also keeps the behavior consistent with other informational messages (e.g. validation errors) that are not gated by the comment strategy.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let me know what you think.

Copy link
Member

Choose a reason for hiding this comment

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

if you see here, neutral check is used to indicate that no matching pipeline run found. posting a comment for this would create confusion on next iteration (e.g. new commit push, or /test comment etc) that comment wouldn't be deleted and will be there on PR forever but if we create check-run it would disappear on next new commit push or /test command. so IMO I still want neutral check there

Copy link
Member

Choose a reason for hiding this comment

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

@zakisk I agree more with your previous comment asking to remove the neutral check. Consider the case where all pipelineruns have succeeded and there is a comment reflecting the status. If I run /retest and no tests are run it should not update the successful-status comment. This comment does not reflect any pipelinerun status and is a direct response to a comment; I would argue it is more confusing for users to for there to be a neutral status.

For a similar UX, consider Tide. When a PR's approval status changes a comment is updated, but when someone interacts with tide incorrectly, a separate, permanent comment is made informing the user that their comment has no effect and no change is made to the status comment nor check-run status.

Copy link
Member

@zakisk zakisk Feb 26, 2026

Choose a reason for hiding this comment

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

@zakisk I agree more with your #2399 (comment) asking to remove the neutral check

I changed my perspective after full understanding the issue 😄

but when someone interacts with tide incorrectly

but I don't think that making /retest comment on a PR which doesn't have any failed pipeline run would be an "incorrect interaction"? and we create neutral status check when there is no matching pipeline run in .tekton directory as well so IMO when there is no failed pipeline run on /retest comment then it should be fine to create a neutral status check because in this PR changes it logs message (I am not stubborn on this 😄)

cc: @chmouel

@aThorp96
Copy link
Member

Please add unit tests and ideally E2E tests as well. Screenshot and/or link to an example of the new behavior would also be helpful. Thanks!

@mathur07 mathur07 force-pushed the SRVKP-10373 branch 2 times, most recently from 33b45b0 to b8d5730 Compare February 17, 2026 02:45
@mathur07
Copy link
Contributor Author

mathur07 commented Feb 17, 2026

Updated Log SS:
image

@mathur07
Copy link
Contributor Author

mathur07 commented Feb 17, 2026

Updated Comment SS:
image

@mathur07 mathur07 requested review from aThorp96 and zakisk February 17, 2026 03:14
@mathur07 mathur07 requested a review from chmouel February 17, 2026 03:14
Copy link
Member

@aThorp96 aThorp96 left a comment

Choose a reason for hiding this comment

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

Looks generally good to me. Two requests regarding the tests. One suggestion regarding the message itself.

I notice in the screenshot the comment reads All PipelineRuns for this commit have already succeeded. Use /retest to re-run a specific pipeline or /test to re-run all pipelines., it doesn't include the <pipelinerun-name> string. Was this screenshot taken before that was included in the string, or is it possibly being treated as an unknown html tag and being hidden? If the latter, I think including the backticks should ensure it's rendered correctly

@chmouel
Copy link
Member

chmouel commented Feb 26, 2026

/retest seems broken on gitea/forgejo and we need to test this there as well https://issues.redhat.com/browse/SRVKP-10913

mathur07 added 2 commits March 3, 2026 15:15
When using /retest and all pipelines have already succeeded, show:
"all PipelineRuns for this commit have already succeeded. Use /retest
<pipeline-name> to re-run a specific pipeline or /test to re-run all"

instead of the misleading "could not find any PipelineRun" message.

Fixes: SRVKP-10373
Signed-off-by: Shubham Mathur <shumathu@redhat.com>
When using /retest and all pipelines have already succeeded, show:
"all PipelineRuns for this commit have already succeeded. Use /retest
<pipeline-name> to re-run a specific pipeline or /test to re-run all"

instead of the misleading "could not find any PipelineRun" message.

Fixes: SRVKP-10373
Signed-off-by: Shubham Mathur <shumathu@redhat.com>
@mathur07
Copy link
Contributor Author

mathur07 commented Mar 3, 2026

@chmouel I tested the changes on gitea/forgejo, and it looks good:

image

@chmouel chmouel merged commit ccefffa into tektoncd:main Mar 5, 2026
10 checks passed
@chmouel
Copy link
Member

chmouel commented Mar 5, 2026

thanks, this will be useful

@chmouel chmouel mentioned this pull request Mar 5, 2026
33 tasks
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.

5 participants