@@ -162,3 +162,65 @@ describe('autobrin daytona transport: webapp modality (superagent-ai/benchpress#
162162 expect ( launcherMocks . runDaytonaEngagement ) . not . toHaveBeenCalled ( ) ;
163163 } ) ;
164164} ) ;
165+
166+ // Regression (superagent-ai/benchpress#40): AutobrinContenderConfig had no way to request more
167+ // than the Daytona platform default sandbox resources, so a full `npm install` of AutoBrin-flue's
168+ // dependency tree could get OOM-killed. runDaytonaEngagement's own resources handling (only applied
169+ // for the "image" creation branch) is covered in tests/daytona-launcher.test.ts; these tests only
170+ // cover that runViaDaytona actually forwards config.resources into the options it builds.
171+ describe ( 'autobrin daytona transport: resources config threading (superagent-ai/benchpress#40)' , ( ) => {
172+ const baseTask = { id : 't1' , benchmarkId : 'repo-cve-smoke' } ;
173+ const baseTarget = {
174+ benchmarkId : 'repo-cve-smoke' ,
175+ taskId : 't1' ,
176+ modality : 'repo' as const ,
177+ repo : 'owner/repo' ,
178+ sha : 'abc123' ,
179+ } ;
180+ const baseControls = { model : 'kimi-azure/kimi-k2.6' } ;
181+
182+ const tmpDirs : string [ ] = [ ] ;
183+
184+ afterEach ( ( ) => {
185+ vi . restoreAllMocks ( ) ;
186+ for ( const dir of tmpDirs . splice ( 0 ) ) rmSync ( dir , { recursive : true , force : true } ) ;
187+ } ) ;
188+
189+ function makeContext ( ) {
190+ const root = mkdtempSync ( path . join ( tmpdir ( ) , 'benchpress-daytona-resources-' ) ) ;
191+ tmpDirs . push ( root ) ;
192+ return { runId : 'run1' , resultsDir : path . join ( root , 'results' ) , engagementsDir : path . join ( root , 'engagements' ) } ;
193+ }
194+
195+ function mockSuccessfulEngagement ( ) {
196+ checkoutMocks . ensureAutobrinCheckout . mockReset ( ) . mockResolvedValue ( { root : '/cache/x' , ref : 'staging' , commitSha : 'deadbeef' } ) ;
197+ launcherMocks . runDaytonaEngagement . mockReset ( ) . mockResolvedValue ( {
198+ sandboxId : 'sandbox-1' ,
199+ engagement : { exitCode : 0 , streamLogPath : 'x' , resultPath : 'y' , resultJson : { } } ,
200+ computerUse : { } ,
201+ keptSandbox : false ,
202+ } ) ;
203+ }
204+
205+ it ( 'forwards config.resources into the options passed to runDaytonaEngagement' , async ( ) => {
206+ mockSuccessfulEngagement ( ) ;
207+ const runner = createAutobrinRunner ( {
208+ config : { id : 'x' , type : 'autobrin' , transport : 'daytona' , image : 'test-image' , resources : { cpu : 2 , memory : 4 , disk : 20 } } ,
209+ } ) ;
210+
211+ await runner . run ( { task : baseTask , target : baseTarget , controls : baseControls , context : makeContext ( ) } ) ;
212+
213+ const options = launcherMocks . runDaytonaEngagement . mock . calls [ 0 ] ?. [ 0 ] as { resources ?: unknown } ;
214+ expect ( options . resources ) . toEqual ( { cpu : 2 , memory : 4 , disk : 20 } ) ;
215+ } ) ;
216+
217+ it ( 'omits resources entirely when not configured (unchanged default behavior)' , async ( ) => {
218+ mockSuccessfulEngagement ( ) ;
219+ const runner = createAutobrinRunner ( { config : { id : 'x' , type : 'autobrin' , transport : 'daytona' , image : 'test-image' } } ) ;
220+
221+ await runner . run ( { task : baseTask , target : baseTarget , controls : baseControls , context : makeContext ( ) } ) ;
222+
223+ const options = launcherMocks . runDaytonaEngagement . mock . calls [ 0 ] ?. [ 0 ] as { resources ?: unknown } ;
224+ expect ( options . resources ) . toBeUndefined ( ) ;
225+ } ) ;
226+ } ) ;
0 commit comments