File tree Expand file tree Collapse file tree
apps/sim/lib/execution/remote-sandbox Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -127,9 +127,14 @@ describe('resolvePiRunLifetimeMs', () => {
127127 '@/lib/execution/remote-sandbox/pi-lifetime'
128128 )
129129
130- // The async ceiling is 90 minutes, above what E2B will grant, so the
131- // provider cap still wins.
132- const timeout = createTimeoutAbortController ( 90 * 60 * 1000 )
130+ // The deadline must be strictly past the ceiling for the ceiling to win.
131+ // Passing exactly `PI_SANDBOX_MAX_LIFETIME_MS` made this a coin flip: the
132+ // remaining budget is `deadline - Date.now()`, so it decays below the ceiling
133+ // as soon as one millisecond of test time elapses, and `Math.min` then
134+ // returns the remaining budget instead (`expected 5399999 to be 5400000`).
135+ // An equal deadline also isn't the case the name describes — the run has to
136+ // outlive the ceiling, not match it.
137+ const timeout = createTimeoutAbortController ( PI_SANDBOX_MAX_LIFETIME_MS + 60_000 )
133138
134139 expect ( resolvePiRunLifetimeMs ( timeout . signal ) ) . toBe ( PI_SANDBOX_MAX_LIFETIME_MS )
135140 timeout . cleanup ( )
You can’t perform that action at this time.
0 commit comments