Skip to content

Use the TestRail action directly in test-plan-generator - #6657

Merged
suhaibmujahid merged 5 commits into
mozilla:masterfrom
jpangas:testrail-action-direct
Aug 20, 2026
Merged

Use the TestRail action directly in test-plan-generator#6657
suhaibmujahid merged 5 commits into
mozilla:masterfrom
jpangas:testrail-action-direct

Conversation

@jpangas

@jpangas jpangas commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

Fixes #6508

What changed

testrail.submit_test_plan is now exposed to the agent as a recordable action, and the result module is gone: the action schema is the only definition of a generated test plan.

  • The per-case context label goes with it. It was guidance for tool selection, so it moves into the prompt where that judgment belongs, rather than being carried as data nothing consumed.
  • The case-count bound and the sequential-id check move from TestPlanResult onto SubmitTestPlanInput, so they are enforced for every caller instead of only the ones going through the old result model.
  • Recording twice would create two TestRail suites on apply, so a second submit_test_plan call is rejected.
  • The agent's findings become its closing prose, so the UI reads the plan from the recorded action's params, falling back to findings.result for runs recorded before this change.

Note

Between this PR and the next one in the chain, the action does not yet carry execution results, so the UI renders test cases without pass/fail badges. That is restored by #6658, which nests the result inside each case. Merging the two together avoids exposing the gap on master.

Stack

Please merge in this order each builds on the one before:

  1. This PRThe test-paln-generator agent should use the TestRail action directly #6508
  2. Report each TestRail case result with the case itself #6658The test-plan-generator agent should better utilize actions in reporting the results #6511, nest each case's execution result
  3. Submit the agent's execution results to TestRail #6659Include test-plan-generator agent's execution results in TestRail #6436, submit execution results to TestRail

The agent submitted its plan through a private submit_result MCP tool, and
__main__ then copied that structured result into the TestRail action. The
action existed but was never the thing the agent called.

Expose testrail.submit_test_plan to the agent as a recordable action instead,
and drop the result module: the action schema is now the only definition of a
generated test plan. The per-case `context` label goes with it, and the case
count and sequential-id checks move from TestPlanResult onto
SubmitTestPlanInput, where they are enforced for every caller. Recording twice
would create two TestRail suites, so a second call is now rejected.

The agent's own findings become its closing prose, so the UI reads the plan
from the recorded action's params, falling back to findings.result for runs
recorded before this change.

Fixes mozilla#6508
Copilot AI lite review requested due to automatic review settings August 19, 2026 08:59
@jpangas
jpangas requested a review from a team as a code owner August 19, 2026 08:59

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

Pull request overview

This PR updates the test-plan-generator agent to record the testrail.submit_test_plan action directly (instead of submitting a separate structured “result” and then copying it into an action), making the action schema the single source of truth for generated test plans and aligning the UI to read plans from recorded actions.

Changes:

  • Expose and enforce testrail.submit_test_plan as the agent’s direct, recordable output (including single-submission protection and schema-level validation like max case count and sequential IDs).
  • Remove the agent-local result model/server and update the agent prompt/config/runtime wiring to use the actions server/tooling.
  • Update the UI to parse/render test plans from recorded actions (with fallback for legacy runs) and adjust runtime tests to match the new schema (removal of per-case context).

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
services/hackbot-ui/components/TestPlanView.tsx Parse test plan from recorded testrail.submit_test_plan action params with legacy fallback.
services/hackbot-ui/components/RunDetail.tsx Render Findings/TestPlan UI even when findings are empty but the plan action exists.
services/hackbot-ui/components/FindingsView.tsx Thread actions into test-plan parsing for test-plan-generator runs.
libs/hackbot-runtime/hackbot_runtime/actions/testrail.py Enforce plan constraints in action schema; reject multiple submissions; remove deprecated helper.
libs/hackbot-runtime/tests/test_testrail_action.py Update/extend tests for new validation (sequential IDs, max cases, single submission) and removed context.
libs/hackbot-runtime/tests/test_testrail_handler.py Update fixture data to remove per-case context.
agents/test-plan-generator/hackbot_agents/test_plan_generator/prompts/system.md Update agent workflow instructions to record the TestRail action and move “context” guidance into prompt text.
agents/test-plan-generator/hackbot_agents/test_plan_generator/config.py Restrict agent to the testrail.submit_test_plan action type.
agents/test-plan-generator/hackbot_agents/test_plan_generator/agent.py Replace submit-result MCP server usage with actions server; require TestRail plan action to be recorded.
agents/test-plan-generator/hackbot_agents/test_plan_generator/main.py Stop copying structured results into an action; rely on the agent-recorded action.
agents/test-plan-generator/hackbot_agents/test_plan_generator/result.py Deleted (structured result server/model removed).

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread services/hackbot-ui/components/TestPlanView.tsx

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

Thank you! We need some minor changes.

Comment thread libs/hackbot-runtime/hackbot_runtime/actions/testrail.py
Comment thread libs/hackbot-runtime/hackbot_runtime/actions/testrail.py Outdated
Comment thread libs/hackbot-runtime/hackbot_runtime/actions/testrail.py
Comment thread services/hackbot-ui/components/RunDetail.tsx
@jpangas
jpangas requested a review from suhaibmujahid August 19, 2026 23:54

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

Thank you! LGTM!

Comment thread services/hackbot-ui/components/RunDetail.tsx
@suhaibmujahid
suhaibmujahid enabled auto-merge (squash) August 20, 2026 23:52
@suhaibmujahid
suhaibmujahid merged commit ee6331d into mozilla:master Aug 20, 2026
8 checks passed
@jpangas
jpangas deleted the testrail-action-direct branch August 20, 2026 23:54
jpangas added a commit to jpangas/bugbug that referenced this pull request Aug 21, 2026
The step-level `StepResult` model went away with result.py in mozilla#6657, so
`TestRailStepInput` now holds only an action and an expectation. The
execution rules still told the agent to mark a failing step, which it has
no field to do. Point that failure at the case result instead, and have
the agent name the offending step in the summary so the attribution the
step status used to carry is not lost.
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.

The test-paln-generator agent should use the TestRail action directly

3 participants