@@ -2,9 +2,18 @@ import {BuildResult, BuildResultStatus} from '../workers/builder/builder-types.j
22import { Environment } from '../configuration/environment.js' ;
33import { ProgressLogger } from '../progress/progress-logger.js' ;
44import { RootPromptDefinition } from '../shared-interfaces.js' ;
5- import { EvalID , Executor } from './executors/executor.js' ;
5+ import { EvalID } from './executors/executor.js' ;
66import 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. */
918export 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}
0 commit comments