@@ -303,7 +303,7 @@ interface NormalizedOptions {
303303 /** Removed: the run directory always uses index.jsonl */
304304 readonly outputFormat ?: string ;
305305 readonly graderTarget ?: string ;
306- /** Config-level fallback grader target name, from `.agentv/config.yaml`'s `defaults.grader`. */
306+ /** Config-level fallback grader provider name, from `.agentv/config.yaml`'s `defaults.grader`. */
307307 readonly defaultGraderTarget ?: string ;
308308 readonly model ?: string ;
309309 readonly outputMessages : number | 'all' ;
@@ -1405,7 +1405,12 @@ async function prepareFileMetadata(params: {
14051405 : suite . tests ;
14061406 const testIds = testCases . map ( ( value ) => value . id ) ;
14071407 const suiteTargetSpec = suite . targetSpec ;
1408+ const suiteDefaults = suite . defaults ;
14081409 const suiteTargets = suiteTargetSpec ? [ suiteTargetSpec . name ] : suite . targets ;
1410+ const fileOptions =
1411+ suiteDefaults ?. grader && ! effectiveOptions . graderTarget
1412+ ? { ...effectiveOptions , defaultGraderTarget : suiteDefaults . grader }
1413+ : effectiveOptions ;
14091414 const defaultBudgetUsd =
14101415 effectiveOptions . cliBudgetUsd === undefined
14111416 ? ( effectiveOptions . budgetUsd ?? suite . budgetUsd )
@@ -1414,11 +1419,11 @@ async function prepareFileMetadata(params: {
14141419
14151420 if ( testCases . length === 0 ) {
14161421 return {
1417- options : effectiveOptions ,
1422+ options : fileOptions ,
14181423 testIds,
14191424 testCases,
14201425 selections : [ ] ,
1421- trialsConfig : effectiveOptions . experimentTrialsConfig ,
1426+ trialsConfig : fileOptions . experimentTrialsConfig ,
14221427 suiteTargets,
14231428 yamlCache : suite . cacheConfig ?. enabled ,
14241429 yamlCachePath : suite . cacheConfig ?. cachePath ,
@@ -1432,7 +1437,7 @@ async function prepareFileMetadata(params: {
14321437
14331438 let selections : { selection : TargetSelection ; inlineTargetLabel : string } [ ] ;
14341439
1435- if ( effectiveOptions . transcript ) {
1440+ if ( fileOptions . transcript ) {
14361441 // --transcript mode: bypass target resolution entirely.
14371442 // Create a synthetic TargetSelection for the transcript provider.
14381443 const transcriptSelection : TargetSelection = {
@@ -1444,15 +1449,15 @@ async function prepareFileMetadata(params: {
14441449 } ,
14451450 targetName : 'transcript' ,
14461451 targetSource : 'cli' ,
1447- targetsFilePath : effectiveOptions . transcript ,
1452+ targetsFilePath : fileOptions . transcript ,
14481453 } ;
14491454 selections = [
14501455 {
14511456 selection : transcriptSelection ,
1452- inlineTargetLabel : `transcript (${ path . basename ( effectiveOptions . transcript ) } )` ,
1457+ inlineTargetLabel : `transcript (${ path . basename ( fileOptions . transcript ) } )` ,
14531458 } ,
14541459 ] ;
1455- } else if ( suite . inlineTarget && effectiveOptions . cliTargets . length === 0 ) {
1460+ } else if ( suite . inlineTarget && fileOptions . cliTargets . length === 0 ) {
14561461 const targetDefinition = suite . inlineTarget ;
14571462 const resolvedTarget = resolveProviderDefinition ( targetDefinition , process . env , testFilePath , {
14581463 emitDeprecationWarnings : false ,
@@ -1469,7 +1474,7 @@ async function prepareFileMetadata(params: {
14691474 inlineTargetLabel : resolveTargetLabel ( targetDefinition . name , resolvedTarget . name ) ,
14701475 } ,
14711476 ] ;
1472- } else if ( suite . providerFactory && effectiveOptions . cliTargets . length === 0 ) {
1477+ } else if ( suite . providerFactory && fileOptions . cliTargets . length === 0 ) {
14731478 const taskTarget : ResolvedProviderBackend = {
14741479 kind : 'mock' ,
14751480 name : 'custom-task' ,
@@ -1490,12 +1495,12 @@ async function prepareFileMetadata(params: {
14901495 ] ;
14911496 } else {
14921497 // Determine provider labels: CLI --provider flags override YAML
1493- const cliTargets = effectiveOptions . cliTargets ;
1494- const experimentTargets = effectiveOptions . experimentTargets ?? [ ] ;
1498+ const cliTargets = fileOptions . cliTargets ;
1499+ const experimentTargets = fileOptions . experimentTargets ?? [ ] ;
14951500 const suiteTargetSpec = suite . targetSpec ;
14961501 const suiteTargets = suiteTargetSpec ? [ suiteTargetSpec . name ] : suite . targets ;
14971502 const suiteTargetRefs = suite . targetRefs ;
1498- const experimentTargetRefs = effectiveOptions . experimentTargetRefs ;
1503+ const experimentTargetRefs = fileOptions . experimentTargetRefs ;
14991504
15001505 // Resolve which target names to use (precedence: CLI/experiment > suite YAML targets > default)
15011506 let targetNames : readonly string [ ] ;
@@ -1511,6 +1516,9 @@ async function prepareFileMetadata(params: {
15111516 } else if ( suiteTargets && suiteTargets . length > 0 ) {
15121517 targetNames = suiteTargets ;
15131518 targetRefs = suiteTargetRefs ;
1519+ } else if ( suiteDefaults ?. provider ) {
1520+ targetNames = [ suiteDefaults . provider ] ;
1521+ targetRefs = undefined ;
15141522 } else {
15151523 targetNames = [ ] ;
15161524 targetRefs = undefined ;
@@ -1526,12 +1534,12 @@ async function prepareFileMetadata(params: {
15261534 providerDefinitions,
15271535 providerDefinitionsSource,
15281536 requireExplicitProviderCatalog : true ,
1529- allowLegacyTargetFiles : effectiveOptions . allowLegacyTargetFiles ,
1537+ allowLegacyTargetFiles : fileOptions . allowLegacyTargetFiles ,
15301538 env : process . env ,
15311539 targetNames,
15321540 targetRefs,
15331541 targetSource,
1534- modelOverride : effectiveOptions . targetModelOverride ,
1542+ modelOverride : fileOptions . targetModelOverride ,
15351543 } ) ;
15361544
15371545 selections = multiSelections . map ( ( sel ) => ( {
@@ -1549,18 +1557,18 @@ async function prepareFileMetadata(params: {
15491557 providerDefinitions,
15501558 providerDefinitionsSource,
15511559 requireExplicitProviderCatalog : true ,
1552- allowLegacyTargetFiles : effectiveOptions . allowLegacyTargetFiles ,
1560+ allowLegacyTargetFiles : fileOptions . allowLegacyTargetFiles ,
15531561 cliTargetName :
15541562 targetSource === 'cli'
15551563 ? targetNames . length === 1
15561564 ? targetNames [ 0 ]
1557- : effectiveOptions . target
1558- : effectiveOptions . target ,
1565+ : fileOptions . target
1566+ : fileOptions . target ,
15591567 fileTargetName :
15601568 targetSource === 'test-file' && targetNames . length === 1 ? targetNames [ 0 ] : undefined ,
15611569 fileTargetSpec :
15621570 targetSource === 'test-file' && targetNames . length === 1 ? suiteTargetSpec : undefined ,
1563- modelOverride : effectiveOptions . targetModelOverride ,
1571+ modelOverride : fileOptions . targetModelOverride ,
15641572 env : process . env ,
15651573 } ) ;
15661574
@@ -1587,11 +1595,11 @@ async function prepareFileMetadata(params: {
15871595 }
15881596
15891597 return {
1590- options : effectiveOptions ,
1598+ options : fileOptions ,
15911599 testIds,
15921600 testCases,
15931601 selections,
1594- trialsConfig : effectiveOptions . experimentTrialsConfig ,
1602+ trialsConfig : fileOptions . experimentTrialsConfig ,
15951603 suiteTargets,
15961604 yamlCache : suite . cacheConfig ?. enabled ,
15971605 yamlCachePath : suite . cacheConfig ?. cachePath ,
@@ -1951,9 +1959,9 @@ export async function runEvalCommand(
19511959 process . env . AGENTV_EXPERIMENT = normalizedExperiment ;
19521960 }
19531961
1954- // Validate --grader-target / --model combinations
1962+ // Validate --grader-provider / --model combinations
19551963 if ( options . graderTarget === 'agentv' && ! options . model ) {
1956- throw new Error ( '--grader-target agentv requires --model (e.g., --model openai:gpt-5-mini)' ) ;
1964+ throw new Error ( '--grader-provider agentv requires --model (e.g., --model openai:gpt-5-mini)' ) ;
19571965 }
19581966
19591967 if ( options . removedOut ) {
0 commit comments