Workflow chains
AuraScore 81/100

Flaky Test Isolation and Deterministic CI Repair Chain Plan

Develop a specialized multi-agent diagnostic workflow to detect non-deterministic test failures, isolate race conditions, and verify deterministic fixes.

Use this template when building an autonomous workflow to eliminate flaky tests in large software suites. It guides quality and software architects in creating chained agent systems that run stress permutations, capture state leaks, and synthesize synchronization fixes.

Template

Role: Staff Quality Engineering Architect specializing in distributed test harness automation and deterministic debugging workflows.

Context

  • Target Test Engine: {{test_runner_framework}}
  • Non-Deterministic Test Targets: {{flaky_test_corpus}}
  • Application Threading Model: {{concurrency_model}}
  • Stress Environment Provider: {{ephemeral_infra_provider}}
  • Quarantine Trigger Criteria: {{flakiness_threshold_rate}}
  • Trace & Dump Storage: {{artifact_storage_backend}}

Task

Design an autonomous workflow chain that continuously identifies, isolates, root-causes, and fixes non-deterministic test cases across the codebase, ensuring high CI reliability.

Method

  1. Ingest CI failure logs to identify tests exceeding {{flakiness_threshold_rate}} within {{flaky_test_corpus}}.
  2. Dispatch a quarantine agent to temporarily tag failing tests without disabling test coverage visibility.
  3. Provision dedicated stress-test containers on {{ephemeral_infra_provider}} running under high resource contention.
  4. Execute N-iteration permutation loops using {{test_runner_framework}} with randomized execution orders and mock delays.
  5. Capture memory snapshots, race condition traces, and thread states directly to {{artifact_storage_backend}}.
  6. Task a diagnostic agent with analyzing captured traces to distinguish between shared mutable state, network timeouts, and {{concurrency_model}} deadlocks.
  7. Deploy a code repair agent to adjust async synchronization, eliminate shared global state, or inject proper mock boundaries.
  8. Run a validation pass consisting of 100 consecutive green runs on {{ephemeral_infra_provider}} to confirm determinism before opening a fix PR.

Constraints

  • MUST NOT resolve flakiness by simply increasing arbitrary timeout constants or sleep intervals.
  • MUST validate all candidate patches against 100 consecutive runs without a single intermittent failure.
  • Diagnostic trace files stored in {{artifact_storage_backend}} must redact all sensitive credentials and PII.
  • Test quarantining must never completely drop test cases without creating an associated tracking issue.

Output format

Provide a technical workflow plan structured as follows:

  1. Workflow State Diagram (detailing ingest, quarantine, reproduction, fix, and verification phases)
  2. Agent Task & Prompt Specifications (defining exact logic for reproduction, trace parsing, and refactoring)
  3. Stress Harness Execution Strategy (parameter matrices for {{concurrency_model}} and {{test_runner_framework}})
  4. Verification & Graduation Criteria (rules for lifting quarantine and merging fixes) Limit response length to 1,500 words.

Self-review

  • Verify that the plan incorporates {{flakiness_threshold_rate}} as the objective quarantine trigger.
  • Ensure the verification step specifically mandates consecutive deterministic iterations.
  • Confirm that the repair agent specifically addresses {{concurrency_model}} issues rather than superficial timeouts.
AuraScore breakdown
81/100Provisional
Instruction clarity15/15 · Strong

Explicit role, a named task, and discrete steps the model can follow.

Context architecture12/12 · Strong

Background, inputs and variables the model needs before it starts.

Constraint engineering12/12 · Strong

Hard boundaries — what the model must and must not do.

Output specification6/14 · Thin

A named, field-level shape for the response.

Reasoning structure10/10 · Strong

Ordered work items that force analysis before an answer.

Model compatibility10/10 · Strong

Length and structure that travel across frontier models.

Token efficiency5/10 · Thin

Signal density — instruction weight without padding.

Reusability7/7 · Strong

Documented variables so the scaffold adapts to new inputs.

Robustness3/5 · Adequate

Quality bar, assumptions and behaviour when inputs are thin.

Observed performance1/5 · Thin

How much real usage the template has behind it.

ai-agents
agents-workflows
software-engineering-debugging
flaky-tests
concurrency-debugging
ci-automation