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
25 changes: 25 additions & 0 deletions apps/cli/test/eval.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,31 @@ describe('agentv eval CLI', () => {
}
}, 30_000);

it('keeps --workspace-path as a static workspace override for existing workspaces', async () => {
const fixture = await createFixture();
try {
const workspacePath = path.join(fixture.baseDir, 'prepared-workspace');
await mkdir(workspacePath, { recursive: true });

const result = await runCli(fixture, [
'eval',
fixture.testFilePath,
'--workspace-path',
workspacePath,
]);

expect(result.exitCode).toBe(0);
const diagnostics = await readDiagnostics(fixture);
expect(diagnostics).toMatchObject({
workspaceMode: 'static',
workspacePath,
resultCount: 2,
});
} finally {
await rm(fixture.baseDir, { recursive: true, force: true });
}
}, 30_000);

it('passes run-level budget tracking through to the evaluator', async () => {
const fixture = await createFixture();
try {
Expand Down
4 changes: 4 additions & 0 deletions apps/cli/test/fixtures/mock-run-evaluation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ interface RunEvaluationOptionsLike {
readonly evalCases?: ReadonlyArray<unknown>;
readonly verbose?: boolean;
readonly maxConcurrency?: number;
readonly workspaceMode?: string;
readonly workspacePath?: string;
readonly trials?: {
readonly count: number;
readonly strategy: string;
Expand Down Expand Up @@ -181,6 +183,8 @@ async function maybeWriteDiagnostics(
envLocalOnly: process.env.CLI_ENV_LOCAL_ONLY ?? null,
budgetUsd: options.budgetUsd ?? null,
maxConcurrency: options.maxConcurrency ?? null,
workspaceMode: options.workspaceMode ?? null,
workspacePath: options.workspacePath ?? null,
trials: options.trials ?? null,
threshold: options.threshold ?? null,
hasRunBudgetTracker: options.runBudgetTracker !== undefined,
Expand Down
36 changes: 36 additions & 0 deletions packages/core/test/evaluation/workspace/setup.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,40 @@ describe('prepareSharedWorkspaceSetup', () => {
expect(readFileSync(path.join(repoDir, 'tracked.txt'), 'utf8')).toBe('clean\n');
expect(existsSync(path.join(repoDir, 'stale.txt'))).toBe(false);
}, 30_000);

it('uses CLI workspacePath as an existing static workspace without materializing repos', async () => {
const existingWorkspace = path.join(tmpDir, 'existing-workspace');
mkdirSync(existingWorkspace, { recursive: true });
writeFileSync(path.join(existingWorkspace, 'marker.txt'), 'already prepared\n', 'utf8');

const evalCase: EvalTest = {
id: 'case-1',
question: 'test',
criteria: 'ok',
workspace: {
repos: [
{
path: './repo-a',
repo: 'https://example.com/repo-a.git',
commit: 'main',
},
],
},
};

setup = await prepareSharedWorkspaceSetup({
evalRunId: 'test-cli-workspace-path',
evalCases: [evalCase],
evalDir: tmpDir,
workspacePath: existingWorkspace,
workers: 1,
});

expect(setup.sharedWorkspacePath).toBe(existingWorkspace);
expect(setup.repoManager).toBeUndefined();
expect(readFileSync(path.join(existingWorkspace, 'marker.txt'), 'utf8')).toBe(
'already prepared\n',
);
expect(existsSync(path.join(existingWorkspace, 'repo-a'))).toBe(false);
});
});
Loading