Skip to content
Merged
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
19 changes: 19 additions & 0 deletions apps/cli/src/commands/results/serve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
* variants. They share handler functions via DataContext, differing only in
* how searchDir is resolved.
*
* Before starting the server, the command enforces `required_version` from
* the cwd's `.agentv/config.yaml` (single-project scope) via
* `enforceRequiredVersion()`, matching the behavior of `agentv eval`.
*
* Exported functions (for testing):
* - resolveSourceFile(source, cwd) — resolves a run manifest path
* - loadResults(content) — parses JSONL into EvaluationResult[]
Expand All @@ -37,14 +41,17 @@ import {
discoverBenchmarks,
getBenchmark,
loadBenchmarkRegistry,
loadConfig,
removeBenchmark,
} from '@agentv/core';
import type { Context } from 'hono';
import { Hono } from 'hono';

import { enforceRequiredVersion } from '../../version-check.js';
import { parseJsonlResults } from '../eval/artifact-writer.js';
import { resolveRunManifestPath } from '../eval/result-layout.js';
import { loadRunCache, resolveRunCacheFile } from '../eval/run-cache.js';
import { findRepoRoot } from '../eval/shared.js';
import { listResultFiles } from '../inspect/utils.js';
import { registerEvalRoutes } from './eval-runner.js';
import {
Expand Down Expand Up @@ -1449,6 +1456,18 @@ export const resultsServeCommand = command({
return;
}

// ── Version check ────────────────────────────────────────────────
// Enforce `required_version` from .agentv/config.yaml so Studio/serve
// match `agentv eval` behavior. Same prompt in TTY, warn+continue
// otherwise. Single-project scope only — when one agentv instance
// serves multiple repos with differing version requirements, a
// per-project local install is required instead.
const repoRoot = await findRepoRoot(cwd);
const yamlConfig = await loadConfig(path.join(cwd, '_'), repoRoot);
if (yamlConfig?.required_version) {
await enforceRequiredVersion(yamlConfig.required_version);
}

// ── Determine multi-project mode ────────────────────────────────
const registry = loadBenchmarkRegistry();
const { isMultiProject, showMultiWarning } = resolveDashboardMode(registry.benchmarks.length, {
Expand Down
Loading