Skip to content

fix(llm): enable AI analysis for successful pipeline runs#2810

Open
BoseKarthikeyan wants to merge 1 commit into
tektoncd:mainfrom
BoseKarthikeyan:main
Open

fix(llm): enable AI analysis for successful pipeline runs#2810
BoseKarthikeyan wants to merge 1 commit into
tektoncd:mainfrom
BoseKarthikeyan:main

Conversation

@BoseKarthikeyan

Copy link
Copy Markdown

📝 Description of the Change

Fix AI/LLM role triggering so roles without an on_cel expression run for completed PipelineRuns regardless of success or failure.

Previously, the default trigger path only executed analysis for failed runs, which meant success-oriented roles such as a pipeline success summary would be skipped unless they had an explicit CEL expression.

This change:

  • updates the default role trigger behavior in the LLM analyzer
  • preserves explicit on_cel behavior for success-only or failure-only roles
  • adds/updates unit test coverage for both succeeded and failed PipelineRuns

🔗 Linked GitHub Issue

Fixes #

🧪 Testing Strategy

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

Details:

  • Ran go test ./pkg/llm
  • Verified tests cover both failed and succeeded PipelineRuns for the no-on_cel case
  • Broader repo tests passed in the test runner during validation

🤖 AI Assistance

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

AI assistance was used to help review the existing LLM trigger flow, propose the minimal code change, and update unit tests. The final code and behavior were manually reviewed and validated with package-level tests.

✅ 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

@linux-foundation-easycla

linux-foundation-easycla Bot commented Jun 29, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: BoseKarthikeyan / name: BoseKarthikeyan (0910541)

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

Copy link
Copy Markdown

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 modifies the shouldTriggerRole function to trigger LLM analysis for any completed PipelineRun when no CEL expression is provided, rather than only for failed ones. However, the current implementation unconditionally returns true when role.OnCEL is empty, which would trigger the analysis on every reconcile of an active or running PipelineRun. The reviewer recommends verifying that the PipelineRun is actually completed (either succeeded or failed) before triggering, and restoring the removed corev1 and apis imports to implement this check.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread pkg/llm/analyzer.go
Comment thread pkg/llm/analyzer.go Outdated

@theakshaypant theakshaypant 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 @BoseKarthikeyan for opening this PR!
Some thoughts:

  1. The fix title is misleading. PaC intentionally runs only for failed pipelines.
  2. Since we are changing LLM analysis to run on non-failed pipelineruns by default, we should update the docs to reflect the same. [multiple occurences in docs which mention this]
  3. We use a single commit for a change convention in the repo so I would request you to squash the changes into a single commit and use rebase instead of a merge to update the branch.
  4. Request you to sign the CLA.

Comment thread pkg/llm/analyzer_test.go Outdated
Comment thread pkg/llm/analyzer.go
Comment thread pkg/llm/analyzer_test.go
@BoseKarthikeyan

Copy link
Copy Markdown
Author

@theakshaypant, Thanks for the review. Addressed all points in this update.

✅ What I changed

  • Squashed the branch to a single commit
  • Rebased on latest upstream/main (no merge commit)
  • Updated default trigger behavior:
    • roles without on_cel now run only for completed PipelineRuns
    • completed = Succeeded=True or Succeeded=False
    • non-completed runs are skipped by default
  • Added helper comment for isCompletedPipelineRun
  • Updated tests:
    • fixed contradictory test naming
    • added guard cases for:
      • pr == nil
      • PipelineRun with no completion status
  • Updated docs to match behavior:
    • docs/content/docs/guides/llm-analysis/_index.md
    • docs/content/docs/guides/llm-analysis/model-and-triggers.md

🧪 Validation

go test ./pkg/llm -run 'TestShouldTriggerRole|TestShouldTriggerRoleEvaluations'

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

Code review: found 1 issue.

Comment thread docs/content/docs/guides/llm-analysis/model-and-triggers.md Outdated
Comment thread pkg/llm/analyzer.go
@BoseKarthikeyan BoseKarthikeyan force-pushed the main branch 2 times, most recently from 0034e32 to 2df3ae7 Compare June 29, 2026 11:35
@theakshaypant

Copy link
Copy Markdown
Member

@BoseKarthikeyan Please address the CLA notice #2810 (comment)

@BoseKarthikeyan

Copy link
Copy Markdown
Author

@theakshaypant, I did multiple time and not sure why it is showing Missing CLA Authorization

@theakshaypant

Copy link
Copy Markdown
Member

@theakshaypant, I did multiple time and not sure why it is showing Missing CLA Authorization

You can refer the Help Article and other links in the original comment.

@BoseKarthikeyan

Copy link
Copy Markdown
Author

@theakshaypant, It is done and EasyCLA check has been passed..

@chmouel

chmouel commented Jun 29, 2026

Copy link
Copy Markdown
Member

/ok-to-test

@chmouel

chmouel commented Jun 29, 2026

Copy link
Copy Markdown
Member

(nit, no action: in general it is better practice to create a pull request out of named branch instead of your main branch)

@codecov

codecov Bot commented Jun 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.12%. Comparing base (8284302) to head (0910541).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2810   +/-   ##
=======================================
  Coverage   60.11%   60.12%           
=======================================
  Files         210      210           
  Lines       21145    21150    +5     
=======================================
+ Hits        12711    12716    +5     
  Misses       7641     7641           
  Partials      793      793           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants