Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions apps/cli/src/commands/pipeline/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,13 @@ export const evalInputCommand = command({
process.exit(1);
}

// Try to resolve target for CLI invocation info
// Try to resolve target for CLI invocation info.
// Non-CLI providers default to agent mode (executor subagents) unless
// subagent_mode_allowed: false is set in targets.yaml.
let targetInfo: { kind: 'cli'; command: string; cwd: string; timeoutMs: number } | null = null;
let targetName = 'agent';
let targetKind = 'agent';
let subagentModeAllowed = true;

try {
const selection = await selectTarget({
Expand All @@ -83,16 +86,21 @@ export const evalInputCommand = command({
});

targetName = selection.targetName;
const resolved = selection.resolvedTarget;
subagentModeAllowed = resolved.subagentModeAllowed !== false;

if (selection.resolvedTarget.kind === 'cli') {
if (resolved.kind === 'cli') {
targetKind = 'cli';
const config = selection.resolvedTarget.config;
subagentModeAllowed = false;
const config = resolved.config;
targetInfo = {
kind: 'cli',
command: config.command,
cwd: config.cwd ?? evalDir,
timeoutMs: config.timeoutMs ?? 30000,
};
} else {
targetKind = resolved.kind;
}
} catch {
// No targets file found — subagent-as-target mode
Expand Down Expand Up @@ -122,7 +130,8 @@ export const evalInputCommand = command({
metadata: test.metadata ?? {},
});

// invoke.json
// invoke.json — CLI targets get command info; non-CLI targets get agent
// mode unless subagent_mode_allowed: false forces CLI-based evaluation.
if (targetInfo) {
await writeJson(join(testDir, 'invoke.json'), {
kind: 'cli',
Expand All @@ -131,11 +140,20 @@ export const evalInputCommand = command({
timeout_ms: targetInfo.timeoutMs,
env: {},
});
} else {
} else if (subagentModeAllowed) {
await writeJson(join(testDir, 'invoke.json'), {
kind: 'agent',
instructions: 'Execute this task in the current workspace. The agent IS the target.',
});
} else {
// Non-CLI provider with subagent_mode_allowed: false — use agentv eval
// CLI runner instead of executor subagents.
await writeJson(join(testDir, 'invoke.json'), {
kind: targetKind,
subagent_mode_allowed: false,
instructions:
'This target has subagent_mode_allowed: false. Use `agentv eval` CLI to run this target.',
});
}

// criteria.md
Expand Down Expand Up @@ -165,6 +183,7 @@ export const evalInputCommand = command({
target: {
name: targetName,
kind: targetKind,
subagent_mode_allowed: subagentModeAllowed,
},
test_ids: testIds,
});
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/evaluation/providers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { PiCliProvider } from './pi-cli.js';
import { PiCodingAgentProvider } from './pi-coding-agent.js';
import { ProviderRegistry } from './provider-registry.js';
import type { ResolvedTarget } from './targets.js';
import { resolveTargetDefinition } from './targets.js';
import { COMMON_TARGET_SETTINGS, resolveTargetDefinition } from './targets.js';
import type { EnvLookup, Provider, TargetDefinition } from './types.js';
import { VSCodeProvider } from './vscode-provider.js';

Expand Down Expand Up @@ -56,7 +56,7 @@ export type {
VSCodeResolvedConfig,
} from './targets.js';

export { resolveTargetDefinition };
export { COMMON_TARGET_SETTINGS, resolveTargetDefinition };
export { readTargetDefinitions, listTargetNames } from './targets-file.js';
export {
ensureVSCodeSubagents,
Expand Down
Loading
Loading