@@ -70,8 +70,8 @@ type WebDriverLeaseEntry = {
7070 * Whichever route took a lease away from its allocation, and the single disposal of what that entry
7171 * stood for. `settled` is what that disposal reported and stays missing while it is still running, so a
7272 * caller can tell a session that is gone from one whose outcome it cannot see yet. `artifacts` is the
73- * release envelope's report and is deliberately separate: it is optional, so it is never what a lease or
74- * a daemon close waits through .
73+ * release envelope's report and is deliberately separate: releasing the lease slot and `shutdown()`
74+ * await only disposal. A release also awaits artifacts, including when it joins a shutdown's take .
7575 */
7676type WebDriverLeaseTake = {
7777 by : 'release' | 'shutdown' ;
@@ -102,9 +102,8 @@ function warningMessagesByCode(warnings: CloudWebDriverReleaseWarning[]): Record
102102}
103103
104104/**
105- * Budget for one provider callback this manager waits on. A plugin may supply its own `prepareSession`
106- * cleanup and artifact lookup, and those callbacks are the plugin's code, so this manager cannot assume
107- * they answer: they get the budget this package already gives one WebDriver round trip.
105+ * Budget for prepared-session cleanup on disposal and failed creation, and for teardown artifact lookup.
106+ * The preparation callback itself is not bounded by this budget.
108107 */
109108const DEFAULT_PROVIDER_CALLBACK_TIMEOUT_MS = 30_000 ;
110109
@@ -350,10 +349,9 @@ export class WebDriverSessionManager {
350349 const settle = ( outcome : WebDriverDisposalOutcome ) : void => {
351350 take . settled = outcome ;
352351 take . providerSessionId = outcome . session ?. providerSessionId ;
353- // The artifact report belongs to the release envelope and to nothing else: it starts here and the
354- // release joins it, while the lease and a daemon close are answered by `disposal` alone. A plugin's
355- // artifact lookup therefore cannot keep a lease from being allocated again, nor a close from
356- // finishing.
352+ // The artifact report starts once session deletion and provider cleanup settle. The lease slot is
353+ // freed and `shutdown()` answers without awaiting it. A release still joins the report, even when
354+ // shutdown started this take.
357355 take . artifacts =
358356 outcome . session === undefined
359357 ? undefined
@@ -381,8 +379,8 @@ export class WebDriverSessionManager {
381379 /**
382380 * Ends what one taken entry stands for: the session its create rented, once that create answers, or
383381 * nothing when the create billed nothing. This is the only place a session is ended, and one entry is
384- * taken by exactly one route, so a session is ended once. Everything here is bounded: the provider's own
385- * cleanup belongs to the plugin that supplied it, and this manager must still answer when it does not .
382+ * taken by exactly one route, so a session is ended once. After creation answers, session deletion and
383+ * provider cleanup are bounded. Creation still awaits `prepareSession` without a callback budget .
386384 */
387385 private async disposeTakenEntry ( entry : WebDriverLeaseEntry ) : Promise < WebDriverDisposalOutcome > {
388386 const session = entry . session ?? ( await entry . creation . catch ( ( ) => undefined ) ) ;
0 commit comments