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
2 changes: 1 addition & 1 deletion .github/workflows/add-models-to-runs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
description: 'Comma-separated config IDs whose latest run gets the models'
required: true
rebuild_summaries:
description: 'Rebuild homepage, leaderboards and model summaries at the end'
description: 'Rebuild homepage, leaderboards and model summaries at the end (even if nothing changed)'
type: boolean
default: true
rejudge:
Expand Down
12 changes: 11 additions & 1 deletion src/app/api/internal/add-models-to-runs/__tests__/route.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('POST /api/internal/add-models-to-runs', () => {
expect(vi.mocked(addModelsToLatestRun).mock.calls[0][3]).toEqual({ rejudge: true, retryFailed: true });
});

it('keeps going after a blueprint throws, and skips the rebuild when nothing was added', async () => {
it('keeps going after a blueprint throws, and rebuilds when asked even if nothing was added', async () => {
vi.mocked(addModelsToLatestRun)
.mockRejectedValueOnce(new Error('boom'))
.mockResolvedValueOnce({ configId: 'b', status: 'skipped' });
Expand All @@ -57,6 +57,16 @@ describe('POST /api/internal/add-models-to-runs', () => {
await flush();

expect(addModelsToLatestRun).toHaveBeenCalledTimes(2);
expect(actionBackfillSummary).toHaveBeenCalledTimes(1);
});

it('does not rebuild unless asked', async () => {
vi.mocked(addModelsToLatestRun).mockImplementation(async (configId) => ({ configId, status: 'added' }));

const res = await POST(request({ models: [APERTUS], configIds: ['a'] }));
expect(res.status).toBe(202);
await flush();

expect(actionBackfillSummary).not.toHaveBeenCalled();
});

Expand Down
5 changes: 3 additions & 2 deletions src/app/api/internal/add-models-to-runs/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ const MAX_CONFIGS = 300;
*
* Returns 202 immediately and works through the blueprints one at a time in
* the background, logging under "add-models:". With rebuildSummaries, it
* rebuilds the homepage, leaderboards and model summaries once at the end.
* rebuilds the homepage, leaderboards and model summaries once at the end,
* even when no blueprint changed (so the box doubles as a plain rebuild).
* With rejudge, listed models a run already has are judged again from their
* saved responses instead of being skipped. With retryFailed, they are asked
* again on the prompts where their answer failed.
Expand Down Expand Up @@ -91,7 +92,7 @@ async function runJob(
logger.info(`[AddModels] Done: ${count('added')} added, ${count('skipped')} skipped, ${count('failed')} failed.`);
for (const r of results.filter(r => r.status === 'failed')) logger.warn(`[AddModels] Failed: ${r.configId}: ${r.reason}`);

if (rebuildSummaries && count('added') > 0) {
if (rebuildSummaries) {
try {
logger.info('[AddModels] Rebuilding homepage, leaderboards and model summaries...');
await actionBackfillSummary({ verbose: false, dryRun: false });
Expand Down
Loading