Skip to content

Commit 87201d7

Browse files
committed
feat: better messaging for build progress logging
This is currently confusing and better logging would avoid confusion.
1 parent f9301c8 commit 87201d7

File tree

3 files changed

+38
-7
lines changed

3 files changed

+38
-7
lines changed

runner/orchestration/build-serve-test-loop.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
RootPromptDefinition,
1010
} from '../shared-interfaces.js';
1111
import {ProgressLogger} from '../progress/progress-logger.js';
12-
import {runBuild} from './build-worker.js';
12+
import {BuildType, runBuild} from './build-worker.js';
1313
import {EvalID} from './executors/executor.js';
1414
import {serveAndTestApp} from './serve-testing-worker.js';
1515
import {runTest} from './test-worker.js';
@@ -62,6 +62,7 @@ export async function attemptBuildAndTest(
6262
abortSignal,
6363
workerConcurrencyQueue,
6464
progress,
65+
BuildType.INITIAL_BUILD,
6566
);
6667
let repairAttempts = 0;
6768
let maxRepairAttempts: number;

runner/orchestration/build-worker.ts

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,18 @@ import {BuildResult, BuildResultStatus} from '../workers/builder/builder-types.j
22
import {Environment} from '../configuration/environment.js';
33
import {ProgressLogger} from '../progress/progress-logger.js';
44
import {RootPromptDefinition} from '../shared-interfaces.js';
5-
import {EvalID, Executor} from './executors/executor.js';
5+
import {EvalID} from './executors/executor.js';
66
import PQueue from 'p-queue';
77

8+
export enum BuildType {
9+
/** Initial build of an eval */
10+
INITIAL_BUILD,
11+
/** A build attempt as part of a repair. */
12+
REPAIR_ATTEMPT_BUILD,
13+
/** A build attempt as part of a repair */
14+
TEST_ATTEMPT_REPAIR,
15+
}
16+
817
/** Attempts to build the code. */
918
export async function runBuild(
1019
evalID: EvalID,
@@ -14,8 +23,26 @@ export async function runBuild(
1423
abortSignal: AbortSignal,
1524
workerConcurrencyQueue: PQueue,
1625
progress: ProgressLogger,
26+
type: BuildType,
1727
): Promise<BuildResult> {
18-
progress.log(rootPromptDef, 'build', `Building the app`);
28+
let suffix: string;
29+
let label: string;
30+
switch (type) {
31+
case BuildType.INITIAL_BUILD:
32+
suffix = '';
33+
label = 'Initial build';
34+
break;
35+
case BuildType.REPAIR_ATTEMPT_BUILD:
36+
suffix = ' (for a repair attempt)';
37+
label = 'Repair build';
38+
break;
39+
case BuildType.TEST_ATTEMPT_REPAIR:
40+
suffix = ' (for a test repair attempt)';
41+
label = 'Test repair build';
42+
break;
43+
}
44+
45+
progress.log(rootPromptDef, 'build', `Building the app${suffix}`);
1946

2047
try {
2148
const result = await env.executor.performBuild(
@@ -27,13 +54,13 @@ export async function runBuild(
2754
progress,
2855
);
2956
if (result.status === BuildResultStatus.SUCCESS) {
30-
progress.log(rootPromptDef, 'success', 'Build is successful');
57+
progress.log(rootPromptDef, 'success', `${label} is successful`);
3158
} else {
32-
progress.log(rootPromptDef, 'error', 'Build has failed', result.message);
59+
progress.log(rootPromptDef, 'error', `${label} has failed`, result.message);
3360
}
3461
return result;
3562
} catch (err) {
36-
progress.log(rootPromptDef, 'error', `Error during build process`, err + '');
63+
progress.log(rootPromptDef, 'error', `Error during ${label}`, err + '');
3764
throw err;
3865
}
3966
}

runner/orchestration/repair.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
LlmResponseFile,
88
RootPromptDefinition,
99
} from '../shared-interfaces.js';
10-
import {runBuild} from './build-worker.js';
10+
import {BuildType, runBuild} from './build-worker.js';
1111
import {ProgressLogger} from '../progress/progress-logger.js';
1212
import {EvalID} from './executors/executor.js';
1313
import {repairCodeWithAI} from './codegen.js';
@@ -69,6 +69,7 @@ export async function repairAndBuild(
6969
abortSignal,
7070
attempts,
7171
progress,
72+
repairType,
7273
);
7374
}
7475

@@ -108,6 +109,7 @@ async function handleRepairResponse(
108109
abortSignal: AbortSignal,
109110
attempts: number,
110111
progress: ProgressLogger,
112+
repairType: 'build' | 'test',
111113
): Promise<AttemptDetails> {
112114
if (!repairResponse.success) {
113115
progress.log(
@@ -134,6 +136,7 @@ async function handleRepairResponse(
134136
abortSignal,
135137
workerConcurrencyQueue,
136138
progress,
139+
repairType === 'build' ? BuildType.REPAIR_ATTEMPT_BUILD : BuildType.TEST_ATTEMPT_REPAIR,
137140
);
138141

139142
return {

0 commit comments

Comments
 (0)