Skip to main content

Overview

The fix-flaky-test tool retrieves insights and historical failure analysis about a flaky test. This tool allows AI assistants to access investigation results and apply fixes directly in your development environment. For more information, see Autofix Flaky Tests. Return Type: Structured analysis data with fix recommendations. Structure: metadata, summary, facts

Parameters

Required Parameters

ParameterTypeDescription
repoNamestringRepository name in owner/repo format (e.g., trunk-io/trunk)
You must also provide either investigationId or testCaseId.

Optional Parameters

ParameterTypeDescription
orgSlugstringThe name of your organization in the Trunk app
investigationIdstringSpecific fix identifier from a previous investigation query. Provide this or testCaseId.
testCaseIdstringUUID of the test case to retrieve investigations for. Provide this or investigationId.
createNewInvestigationbooleanWhether or not to trigger a new investigation (may take up to 1 minute)

Getting Parameter Values

If your AI assistant doesn’t have direct access to Git information, use these commands: Get repository name:
git remote -v
Look for the repository name in the output (e.g., trunk-io/trunk from git@github.com:trunk-io/trunk.git)

Usage Examples

With Test ID

Fix the flaky test with ID <testCaseId>

Create New Investigation

Run a new analysis to help me fix flaky test with ID <testCaseId>

With Existing Investigation

Retrieve the investigation for test <testCaseId> with investigationId <investigationId>

Error Handling

ErrorCauseResolution
Investigation {investigationId} not foundInvalid or non-existent fix IDVerify the investigationId from the previous query
Please provide either \investigationId` or `testCaseId`.`Neither investigationId nor testCaseId was providedProvide one of investigationId or testCaseId
This investigation was skipped before producing a completed summary.Investigation was skippedThe setting may be disabled, revisit prerequisites in Autofix Flaky Tests
This investigation failed before producing a completed summary. Please contact Trunk support.Investigation errorThis feature is still in Beta, please contact support
Repository authorization errorInsufficient permissions or invalid repo nameVerify repository name format and your access permissions