Skip to content

Refactored preliminary testing agent - #410

Merged
TomasTomecek merged 3 commits into
packit:mainfrom
TomasKorbar:preliminary-testing-agent
Apr 15, 2026
Merged

TomasTomecek merged 3 commits into
packit:mainfrom
TomasKorbar:preliminary-testing-agent

Conversation

@TomasKorbar

Copy link
Copy Markdown
Collaborator

This PR moves the agent created by mkyral beside other agents and modifies its implementation so it conforms to other agents that already exist.

Implement a new `preliminary-testing` supervisor workflow that automates
the evaluation of preliminary testing (gating and CI checks) for RHEL
Jira issues. Previously, QE engineers had to manually verify test results
and set the Preliminary Testing field — this agent handles it automatically.

The workflow uses an AI agent (BeeAI ToolCallingAgent) to analyze test
results from two sources:

1. GreenWave gating status — fetches and interprets the HTML page from
   gating-status.osci.redhat.com for the build NVR when available.

2. OSCI results in MR comments — discovers linked merge requests via the
   Jira dev-status API, then fetches MR notes from GitLab to find OSCI
   "Results for pipeline ..." comments.

The workflow gracefully degrades when only one source is available (e.g.
no build NVR set yet, or no linked MRs).

Entry conditions: issue must be In Progress, Preliminary Testing not
already Pass, and at least one of Fixed in Build NVR or linked PRs.

Outcomes:
- Tests passed + Test Coverage set → sets Preliminary Testing = Pass
- Tests passed + Test Coverage missing → flags for human attention
- Tests failed/not running/error → flags for human attention
- Tests running/pending → reschedules for later

New files:
- supervisor/preliminary_testing_handler.py — main workflow handler
- supervisor/preliminary_testing_analyst.py — AI agent for analysis
- supervisor/tools/fetch_greenwave.py — BeeAI tool for GreenWave HTML
- supervisor/tools/fetch_gitlab_mr_notes.py — BeeAI tool for MR notes

Modified files:
- supervisor/jira_utils.py — add set_preliminary_testing() and
  get_issue_pull_requests() (Jira dev-status API)
- supervisor/main.py — add preliminary-testing CLI command
- Makefile — add preliminary-testing make target
- README-supervisor.md — document the new workflow

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request introduces the PreliminaryTestingAnalyst agent, which automates the analysis of RHEL JIRA issues to determine if preliminary testing and gating checks have passed. The implementation includes a new workflow-based agent, a standalone execution target in the Makefile, and several new tools for fetching GreenWave gating status, GitLab merge request notes, and JIRA development status. Feedback focuses on improving the robustness of the new tools by adding network timeouts to aiohttp sessions, implementing pagination for GitLab notes, and ensuring safer dictionary access. Additionally, there are suggestions to refine error messaging for JIRA component validation and to remove an unused parameter in the attention-flagging logic.

Comment thread ymir/agents/preliminary_testing_agent.py Outdated
Comment thread ymir/agents/preliminary_testing_agent.py Outdated
Comment thread ymir/tools/privileged/gitlab_tools.py Outdated
Comment thread ymir/tools/privileged/gitlab_tools.py Outdated
Comment thread ymir/tools/privileged/gitlab_tools.py Outdated
Comment thread ymir/tools/unprivileged/greenwave.py Outdated
Comment thread ymir/tools/privileged/jira_tools.py Outdated
Comment thread ymir/tools/privileged/jira_tools.py Outdated
@TomasKorbar
TomasKorbar force-pushed the preliminary-testing-agent branch from 47dcc3e to 719e4d7 Compare April 15, 2026 12:29
nforro
nforro previously approved these changes Apr 15, 2026

@nforro nforro 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, just a note, ToolCallingAgent is deprecated and we should avoid using it in new code.

Comment thread ymir/agents/preliminary_testing_agent.py Outdated
Comment thread ymir/tools/privileged/jira_tools.py Outdated

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

Very nice work, Tome would you have time please to refactor the new tool into the existing one?

issue_key: str = Field(description="Jira issue key (e.g. RHEL-12345)")


class GetJiraPullRequestsTool(Tool[GetJiraPullRequestsToolInput, ToolRunOptions, JSONToolOutput[list[dict[str, Any]]]]):

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.

we already have a tool for this, at line 658

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.

here's Claude's analysis:

The overlap is substantial — they're essentially the same pattern.

Identical steps

  1. Resolve issue key → numeric ID via rest/api/3/issue/{issue_key}?fields=
  2. Fetch dev-status summary via rest/dev-status/1.0/issue/summary?issueId={issue_id}
  3. Loop over application types and fetch detail via rest/dev-status/1.0/issue/detail?issueId={issue_id}&applicationType={app_type}&dataType=...

Key differences

Existing (get_jira_dev_status) New PR (GetJiraPullRequestsTool)
dataType repository pullrequest
Summary key summary.repository.byInstanceType summary.pullrequest.byInstanceType
Data extracted commits (repositories[].commits[]) pull requests (pullRequests[])
Output shape {url, message, repository_url} full PR dict (id, name, status, url, source, destination, ...)
Error on detail fail warns + continues warns + continues
Session timeout no explicit timeout uses AIOHTTP_TIMEOUT

Recommendation

The ID resolution + summary fetch is ~30 lines of logic duplicated verbatim. It would make sense to extract shared helpers — e.g. _resolve_issue_id() and _get_dev_status_summary() — to avoid maintaining two copies of the same HTTP calls.

The agent now conforms to practises used in the other agents
and is located beside them in the agents subpackage.
@TomasKorbar
TomasKorbar force-pushed the preliminary-testing-agent branch from 1f38fd6 to 57fad7b Compare April 15, 2026 14:46

@TomasTomecek TomasTomecek 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, thank you for addressing the refactor

@TomasTomecek
TomasTomecek merged commit 21158d2 into packit:main Apr 15, 2026
7 checks passed
@martinky82 martinky82 mentioned this pull request Apr 15, 2026
4 tasks
@qodo-for-packit qodo-for-packit Bot mentioned this pull request Aug 5, 2026
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