@@ -12,6 +12,7 @@ const {
1212 mockReplyAndResolve,
1313 mockRequestReview,
1414 mockReviewLanded,
15+ mockResolvePiSandboxLifetime,
1516} = vi . hoisted ( ( ) => ( {
1617 mockWithPiSandbox : vi . fn ( ) ,
1718 mockFetchSnapshot : vi . fn ( ) ,
@@ -21,6 +22,7 @@ const {
2122 mockReplyAndResolve : vi . fn ( ) ,
2223 mockRequestReview : vi . fn ( ) ,
2324 mockReviewLanded : vi . fn ( ) ,
25+ mockResolvePiSandboxLifetime : vi . fn ( ) ,
2426} ) )
2527
2628vi . mock ( '@/lib/execution/remote-sandbox' , ( ) => ( {
@@ -30,6 +32,14 @@ vi.mock('@/lib/execution/cancellation', () => ({
3032 isRedisCancellationEnabled : ( ) => false ,
3133 isExecutionCancelled : vi . fn ( ) . mockResolvedValue ( false ) ,
3234} ) )
35+ vi . mock ( '@/lib/execution/remote-sandbox/pi-lifetime' , async ( importOriginal ) => {
36+ const original =
37+ await importOriginal < typeof import ( '@/lib/execution/remote-sandbox/pi-lifetime' ) > ( )
38+ return {
39+ ...original ,
40+ resolvePiSandboxLifetimeMs : mockResolvePiSandboxLifetime ,
41+ }
42+ } )
3343vi . mock ( '@/executor/handlers/pi/babysit-github' , async ( importOriginal ) => {
3444 const original = await importOriginal < typeof import ( '@/executor/handlers/pi/babysit-github' ) > ( )
3545 return {
@@ -44,7 +54,11 @@ vi.mock('@/executor/handlers/pi/babysit-github', async (importOriginal) => {
4454 }
4555} )
4656
47- import { runBabysitPiWithOptions } from '@/executor/handlers/pi/babysit-backend'
57+ import { getMaxExecutionTimeout } from '@/lib/core/execution-limits'
58+ import {
59+ resolveBabysitExecutionBudgetMs ,
60+ runBabysitPiWithOptions ,
61+ } from '@/executor/handlers/pi/babysit-backend'
4862import { BABYSIT_ROUND_PATH } from '@/executor/handlers/pi/babysit-round'
4963import type { PiBabysitRunParams } from '@/executor/handlers/pi/backend'
5064import { DIFF_PATH } from '@/executor/handlers/pi/cloud-shared'
@@ -195,6 +209,7 @@ function makeRunner(options: {
195209describe ( 'runBabysitPiWithOptions' , ( ) => {
196210 beforeEach ( ( ) => {
197211 vi . clearAllMocks ( )
212+ mockResolvePiSandboxLifetime . mockReturnValue ( undefined )
198213 mockFetchDiagnostics . mockResolvedValue ( new Map ( [ [ 'check:ci' , 'failure output' ] ] ) )
199214 mockReplyAndResolve . mockResolvedValue ( {
200215 repliesPosted : 1 ,
@@ -213,6 +228,10 @@ describe('runBabysitPiWithOptions', () => {
213228 mockReviewLanded . mockResolvedValue ( false )
214229 } )
215230
231+ it ( 'uses the platform execution budget when the provider has no absolute lifetime' , ( ) => {
232+ expect ( resolveBabysitExecutionBudgetMs ( ) ) . toBe ( getMaxExecutionTimeout ( ) )
233+ } )
234+
216235 it ( 'returns clean before sandbox creation when the PR already needs nothing' , async ( ) => {
217236 mockFetchSnapshot . mockResolvedValue ( snapshot )
218237 mockFetchThreads . mockResolvedValue ( {
0 commit comments