Skip to content

fix(mobile): release leased device session before stopping daemon - #1900

Merged
okwasniewski merged 10 commits into
e2e-inc:mainfrom
GaspardIV:fix/mobile-release-lease-before-stop
Nov 26, 2026
Merged

okwasniewski merged 10 commits into
e2e-inc:mainfrom
GaspardIV:fix/mobile-release-lease-before-stop

Conversation

@GaspardIV

@GaspardIV GaspardIV commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

What and why

  • On Windows, stopping an [email protected] daemon runs SIGTERM (TerminateProcess), so the daemon exits without running finalizeDaemonLeases, never sends DELETE /session to BrowserStack/TestMu AI/Revyl, and omits daemon-shutdown.json (providerReleases.status: 'unknown').
  • Call client.leases.release(scope) with daemonLifecycle: 'attach' and cleared remote URL/token fields before stopDriver (packages/mobile/src/lease/index.ts:177-227, packages/mobile/src/lease/daemon.ts:62-76), so the live daemon ends the provider session via RPC before shutdown and never spawns a replacement if it already died.
  • Bound the RPC wait via DeviceReleaseContext.timeoutMs (packages/mobile/src/provider.ts:116,300) and releaseRpcBudgetMs (packages/mobile/src/lease/index.ts:63-71):
    • Reserve STOP_RESERVE_MS = 15_000 for daemon stop, giving the RPC 12_000 ms at the default 30_000 ms cleanupTimeout and scaling above 30_000 ms while keeping an 18_000 ms stop reserve (timeoutMs - 18_000).
    • Skip the RPC (return 0) when timeoutMs === undefined or when less than MIN_RELEASE_RPC_MS = 5_000 remains (< 20_000 ms), so short budgets do not cancel DELETE mid-flight and let daemon stop run directly.
    • Wrap rpcTimeout.signal.aborted errors as Timed out after <budget> ms waiting for lease RPC release (packages/mobile/src/lease/index.ts:201-203).
  • Throw ProviderReleaseWarningError (packages/mobile/src/lease/daemon.ts:50-55,74) on non-empty provider.warnings so provider rejections such as WEBDRIVER_SESSION_DELETE_FAILED always fail the release (or aggregate with stopError) even when stopDriver resolves (packages/mobile/src/lease/index.ts:226), while transport errors, timeouts, and released: false still fall back to daemon stop.
  • Allow assertSessionsEnded (packages/mobile/src/lease/daemon.ts:135-154) to accept status: 'unknown', an empty released array, or not-running only when sessionEnded was already confirmed by leases.release, while still rejecting missing providerReleases, pending releases, non-JSON output, or a dead daemon unless leases.release already confirmed the session ended.
  • Store scope right after startDriver returns and pass an explicit 30_000 ms budget and signal inside acquire's cleanup path (packages/mobile/src/lease/index.ts:133-149).
  • Document context.timeoutMs in docs/mobile.mdx, qualify the > 20 s cleanupTimeout requirement in docs/integrations/{browserstack,testmu,revyl}.mdx (plus ja/zh BrowserStack and TestMu AI translations), update factory JSDocs in packages/{browserstack,testmu,revyl}/src/provider.ts, and add .changeset/mobile-release-lease-before-stop.md.
  • Related agent-device issues/PRs: callstack/agent-device#4659 (merged, reports Windows SIGTERM exits as forced) and callstack/agent-device#4822 (follow-up for owner-only graceful shutdown on Windows).
flowchart LR
  R["provider.release()"] --> H["stopHeartbeat()"]
  H --> B{"rpcBudgetMs >= 5s?"}
  B -- "no (<20s or no timeoutMs)" --> S1["stopDriver(sessionEnded = false)"]
  B -- "yes" --> L["leases.release (attach-only RPC)"]
  L -- "ProviderReleaseWarningError" --> S1
  L -- "other error or false" --> S1
  L -- "released = true, no warnings" --> S2["stopDriver(sessionEnded = true)"]
  S1 -- "fails or ProviderReleaseWarningError" --> E["AggregateError / ProviderReleaseWarningError"]
  S2 -- "graceful, not-running, or win32 unknown" --> C["rm(dir)"]
Loading
const { released, provider } = await client.leases.release({ ...scope, signal });
const warnings = releaseWarnings(provider);
if (warnings.length > 0) throw new ProviderReleaseWarningError(warnings.join('; '));
return released;

Issue

Fixes #1723

Verified

Ran it locally on Windows 11 against bf19d33f (ed45764b only edited 1 line in .changeset/mobile-release-lease-before-stop.md to remove em dashes, verified with pnpm run check:changeset-bumps):

  • pnpm --filter @e2e-dev/mobile exec vitest run tests/unit/lease (with BROWSERSTACK_SESSION_DETAILS_ENDPOINT=http://10.255.255.1/x in the outer env and withRealMockLease overriding both BROWSERSTACK_WEBDRIVER_ENDPOINT and BROWSERSTACK_SESSION_DETAILS_ENDPOINT to the local 127.0.0.1 stub): 5/5 files, 44/44 passed, including all 5 real [email protected] daemon tests:
    • 5 s budget + 1.5 s DELETE 200 (RPC skipped, 3.1 s, daemon exited; rejects unconfirmed stop on Windows 0.21.38)
    • 16 s budget + 1.5 s DELETE 200 (RPC skipped, 3.0 s, daemon exited; rejects unconfirmed stop on Windows 0.21.38)
    • 30 s budget + 4 s DELETE 200 (RPC released, 7.3 s, passed on Windows, daemon exited)
    • 30 s budget + hung DELETE (RPC capped at 12 s with Timed out after 12000 ms waiting for lease RPC release, 14.8 s, daemon exited)
    • 30 s budget + DELETE 500 (rejected with WEBDRIVER_SESSION_DELETE_FAILED, 3.3 s, daemon exited)
  • Manual end-to-end check through built browserstack() (@e2e-dev/browserstack) at bf19d33f with 60 s budget and 13 s DELETE 200: passed in 14858 ms (aliveAfter: false, dirExistsAfter: false).
  • pnpm --filter @e2e-dev/revyl test:unit (19/19) and full pnpm run check (oxlint, fallow, monorepo build + tsc -r, check-error-codes, check-peer-ranges, check-changeset-bumps, docs:check across 244 MDX pages and 162 translations) passed at bf19d33f.
  • Did not run against live BrowserStack/TestMu AI/Revyl cloud devices locally (no provider credentials in this environment).

View guided diff

@github-actions github-actions Bot added the size:L Up to 499 changed lines, not counting tests, fixtures, translated docs, or the lockfile label Nov 17, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 7 files

Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.

View guided diff | Re-trigger cubic

Comment thread packages/mobile/src/lease/index.ts Resolved
Comment thread docs/integrations/browserstack.mdx Resolved
Comment thread docs/integrations/testmu.mdx Resolved

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 2 files (changes from recent commits).

Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.

View guided diff | Re-trigger cubic

@okwasniewski okwasniewski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[claude-opus-5-5] automated review on behalf of @okwasniewski

Reviewed at eb13d75 against main 51d304e. Thanks for the careful write-up and the paired agent-device PR. Releasing the lease through leases.release before daemon stop is the right primitive, not a workaround: it does not depend on how the OS stops the daemon, and the 3 s shutdown window no longer applies. I reproduced the main vs PR difference on macOS with a fake WebDriver hub (BROWSERSTACK_WEBDRIVER_ENDPOINT) driving agentDeviceLeases({ provider: 'browserstack' }) against the bundled agent-device 0.21.38:

DELETE /session main this PR
200, fast release ok release ok, RPC release runs before stop
200 after 4 s fails: stopped without ending 1 BrowserStack session(s) release ok
500 release ok (silent pass, the session may still be billing) fails with WEBDRIVER_SESSION_DELETE_FAILED
hangs past the 30 s cleanup budget fails after 8 s, daemon stopped fails after 30 s, daemon process and temp dir leaked

So the warnings check also fixes a silent pass on macOS and Linux. The last row is a regression.

Must fix

  • packages/mobile/src/lease/index.ts:168: the run-end release passes the whole cleanup signal to releaseLease, and stopDriver then gets the same signal. If the provider's DELETE hangs, the RPC uses up the budget and execFile refuses to spawn daemon stop on the aborted signal. The detached daemon keeps running with no owner, and the temp dir stays behind. On main the whole budget went to daemon stop, which falls back to SIGTERM and then SIGKILL. Repro: hold DELETE /session for 45 s, release with a 30 s signal, and the daemon pid from state/daemon.json is still alive afterwards. Your reply to cubic is right that a fresh, unlinked signal would break the finish budget contract. The fix is to split the budget you already have: cap the RPC, for example releaseLease(..., AbortSignal.any([signal, AbortSignal.timeout(RELEASE_RPC_MS)])) with a value that leaves room for daemon stop inside the default 30 s cleanupTimeout, and pass the outer signal to stopDriver. The acquire path can use the same split, so createStopSignal (lines 78, 163, 173) can go. Please add a test where releaseLease hangs until its signal aborts and stopDriver still gets a signal that has not aborted.

Should fix

  • packages/mobile/src/lease/index.ts:175-179: the if/else calls stopDriver twice with only the options changed. Use stopDriver(..., stopSignal, { sessionEnded: resource.sessionEnded === true }).
  • packages/mobile/src/lease/index.ts:61-65: Held now tracks progress in three optional fields (scope?, sessionEnded?, ended?), and endLeaseDaemon has to check both scope and sessionEnded. A single stage: 'held' | 'session-ended' | 'stopped' field, with scope required once the grant exists, would remove those checks.
  • packages/mobile/src/lease/index.ts:192: the errors are combined only when the two messages differ. releaseLease and stopDriver produce different messages, so this check adds nothing beyond the daemon-not-running case. Drop it: always aggregate except for daemon-not-running.
  • .changeset/mobile-release-lease-before-stop.md: this text describes internals. Write it for users instead, e.g. "Fix BrowserStack and TestMu AI runs on Windows failing at cleanup with could not confirm its sessions ended and leaving the device session open until the idle timeout, and fail the release when the service rejects the session end."
  • docs/ja/integrations/browserstack.mdx:128, docs/zh/integrations/browserstack.mdx:106 and the matching testmu pages still list the "about 3 seconds shutdown window" cause you removed from the English pages. The structural translation check passes, but please update the prose to match.

Nits

  • packages/mobile/tests/unit/lease.test.ts:282: the daemon-not-running exemption can be deleted and all tests still pass. The combined message still contains agent-device found no daemon running for lease lease-3, so toThrow matches either way. Assert that the error is not an AggregateError, or match the full message.
  • packages/mobile/tests/unit/lease-daemon.test.ts:97: replace as never with a typed partial client, or move the warnings parsing (releaseWarnings) into a pure function and test it directly.

Verified

  • packages/mobile tsc clean (after building core and e2e), oxlint clean on src/lease and the unit tests.
  • Unit tests: mobile 556/556, browserstack 53/53, testmu 86/86, revyl 19/19. check-docs-translations passes.
  • Mutants against the new tests: dropping the RPC release, the warnings check, the unknown tolerance, the fresh acquire-cleanup signal, the error combining, the sessionEnded lease-check skip, daemonLifecycle: 'attach', or the early resource.scope assignment each fail at least one test. Removing the daemon-not-running exemption does not (see nit).
  • Fake-hub A/B results as in the table above. A scratch unit test confirms that stopDriver gets an aborted signal after a hung run-end releaseLease.
  • CI: the workflows for this head are waiting for maintainer approval (first-time contributor), so they have not run.

@GaspardIV

GaspardIV commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

[Gemini 4 Hydrogen] responding on behalf of @GaspardIV

Thanks for the detailed macOS reproduction and review, @okwasniewski! I have pushed the updated fix in 9bf94668.

Must fix — Split cleanup budget (RELEASE_RPC_TIMEOUT_MS = 12_000)

  • In packages/mobile/src/lease/index.ts, endLeaseDaemon caps releaseLease at RELEASE_RPC_TIMEOUT_MS = 12_000 via setTimeout + AbortController combined with the caller's signal (AbortSignal.any([signal, rpcTimeout.signal]), with timer.unref?.() and clearTimeout in finally). Explicit setTimeout/clearTimeout is used instead of AbortSignal.timeout so fake-timer unit tests deterministically exercise the timeout path.
  • stopDriver receives the outer signal directly (createStopSignal has been removed), and acquire's error-cleanup path calls release(id, resource, AbortSignal.timeout(30_000)). When releaseLease hangs past 12 s, stopDriver still spawns with an un-aborted signal and 18 s remaining under the default 30 s cleanupTimeout (leaving headroom for the ~14.5 s worst-case graceful shutdown + SIGKILL path in paired callstack/agent-device#4659).
  • Added fake-timer unit tests in packages/mobile/tests/unit/lease.test.ts confirming stopDriver still receives an un-aborted signal when releaseLease hangs past 12 s (both in acquire cleanup and in release), while an outer signal abort still aborts stopDriver.

Should fix

  • Replaced the optional progress flags (sessionEnded?, ended?) on Held with a stage: 'held' | 'session-ended' | 'stopped' state field.
  • Collapsed the two stopDriver branches into a single call with { sessionEnded: resource.stage === 'session-ended' }.
  • Removed shouldCombineReleaseError: any non-daemon-not-running releaseError is now always combined with stopError into an AggregateError.
  • Rewrote .changeset/mobile-release-lease-before-stop.md in user-facing terms focusing on Windows cleanup failures, open idle sessions, and surfacing provider session-end rejections.
  • Updated docs/{ja,zh}/integrations/browserstack.mdx and docs/{ja,zh}/integrations/testmu.mdx Limits prose to remove the stale ~3 s shutdown window explanation and align with the English docs.

Nits

  • Updated the daemon-not-running test in packages/mobile/tests/unit/lease.test.ts to assert explicitly that the thrown error is not an AggregateError.
  • Replaced as never in packages/mobile/tests/unit/lease-daemon.test.ts with a typed override built from createAgentDeviceClient(...).

Verification (at 9bf94668)

  • pnpm run check: passed (oxlint 0 warnings / 0 errors across 1451 files, fallow dead-code, full monorepo build + tsc -r, check-error-codes, check-peer-ranges, check-changeset-bumps, check-examples, check-install-scripts, plugins:check, mcp-server:check, docs:check including 244 compiled pages and 162 matching translated pages).
  • pnpm --filter @e2e-dev/mobile exec vitest run tests/unit/lease: 5/5 files, 37/37 tests passed (lease-driver, lease-heartbeat, lease, lease-plugin, lease-daemon).
  • Live WebDriver-mock runs via @e2e-dev/browserstack on Windows 11 under a 30 s release budget:
    • Bundled [email protected]:
      • 50 ms DELETE /session: passed in 2381 ms (aliveAfter: false, temp dir removed).
      • 4 s DELETE /session: passed in 6520 ms (aliveAfter: false, temp dir removed).
      • Hung DELETE /session (45 s): rejected in 13525 ms with AggregateError (request canceled + unconfirmed shutdown report) and aliveAfter: false (daemon terminated cleanly).
    • Paired callstack/agent-device#4659 (0.21.40-dev, commit b04b6bb31):
      • 50 ms DELETE /session: passed in 2928 ms (aliveAfter: false, temp dir removed).
      • 4 s DELETE /session: passed in 6903 ms (aliveAfter: false, temp dir removed).
      • Hung DELETE /session (45 s): rejected in 24640 ms with AggregateError (request canceled + The daemon was force-killed before provider lease state could be finalized) and aliveAfter: false (fits under the 30 s cleanup budget without leaking the daemon).

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 8 files (changes from recent commits).

Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.

View guided diff | Re-trigger cubic

@okwasniewski okwasniewski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[claude-opus-5-5] automated review on behalf of @okwasniewski

Re-checked at 9bf9466 against main 66d07ca. Thanks for the quick turnaround. Every ask from the last review is done: createStopSignal is gone and stopDriver gets the outer signal, Held has a single stage, there is one stopDriver call, errors are always combined except for daemon-not-running, the changeset is written for users, ja/zh prose matches, the AggregateError assertion is in, and as never is gone. Splitting the budget is the right shape and not a workaround. One gap is left in how the split is sized.

Must fix

  • packages/mobile/src/lease/index.ts:56,170: the RPC cap is a fixed 12 s and is not derived from the budget the release actually has. cleanupTimeout is configurable, and finish already knows the remaining budget (EngineFinishInfo.timeoutMs), but DeviceReleaseContext drops it. With cleanupTimeout: 10_000 and a hung DELETE /session, the outer signal aborts before the 12 s cap fires, so stopDriver gets an aborted signal, daemon stop never runs, and the daemon and temp dir leak. That is the same leak as last round, now only on non-default budgets, and main does not have it there because it gave the whole budget to daemon stop. I reproduced it with a scratch test: release(lease, { ...context, signal: AbortSignal.timeout(10_000) }) with releaseLease hanging, and stopDriver received signal.aborted === true. Suggested fix: add timeoutMs to DeviceReleaseContext, forward info.timeoutMs from finish in provider.ts, and size the RPC cap from it so that daemon stop always keeps a share of the budget, for example Math.min(RELEASE_RPC_TIMEOUT_MS, context.timeoutMs / 2). The acquire path can pass its own 30 s. Please extend the hung-release test with a budget below 12 s.

Nits

  • packages/mobile/src/lease/index.ts:65,167: scope is still optional on Held, so endLeaseDaemon still checks resource.scope !== undefined next to the stage. You could set stage only once the grant exists, or keep scope in the 'held' variant.

Verified

  • packages/mobile tsc clean, oxlint clean on src/lease and tests/unit. Unit tests: mobile 557/557, browserstack 53/53, testmu 86/86. check-docs-translations passes. Merges cleanly into main.
  • Mutants: removing the cap, passing the capped signal to stopDriver, dropping the outer signal from AbortSignal.any, raising the cap to 30 s, skipping the session-ended stage, and skipping error aggregation each fail at least one test.
  • cubic: the open P1 (fresh signal for stop) is now handled by the budget split, apart from the short-budget case above. The two docs findings are addressed.
  • CI: the workflows for this head (mobile, docs, docs translations, spec, benchmark) are waiting for maintainer approval and have not run.

@GaspardIV

Copy link
Copy Markdown
Contributor Author

[Gemini 4 Hydrogen] responding on behalf of @GaspardIV

Thanks for catching the short-budget case, @okwasniewski! I have pushed the updated fix in 4afb3b95.

Must fix — Size the RPC cap from the release budget

  • Added optional readonly timeoutMs?: number | undefined to DeviceReleaseContext in packages/mobile/src/provider.ts, and forwarded timeoutMs: info.timeoutMs in LeasedDevices.finish.
  • Added releaseRpcBudgetMs(timeoutMs) in packages/mobile/src/lease/index.ts, sizing the RPC cap as Math.min(12_000, Math.floor((timeoutMs ?? 30_000) / 2)) (clamped to 0 on NaN or <= 0).
  • acquire's error-cleanup path passes DEFAULT_RELEASE_BUDGET_MS (30_000), preserving the 12 s RPC cap and 18 s headroom for stopDriver; under a shorter cleanupTimeout such as 10_000 ms, releaseLease caps at 5_000 ms so stopDriver still spawns with ~5 s left on an un-aborted outer signal.

Nit — Keep scope only in the post-grant Held state

  • Replaced scope?: LeaseScopedOptions + stage on Held with a discriminated lifecycle: LeaseLifecycle union ({ stage: 'acquiring' }, { stage: 'held' | 'session-ended'; readonly scope: LeaseScopedOptions }, { stage: 'stopped' }), removing resource.scope !== undefined from endLeaseDaemon.

Tests

  • Extended packages/mobile/tests/unit/lease.test.ts with a timeoutMs: 10_000 hung-releaseLease case verifying releaseLease aborts at 5_000 ms while stopDriver receives the un-aborted shortBudget.signal, and added pre-timeout lower-bound assertions (11_999 ms / 4_999 ms) to verify stopDriver is not called early.
  • Added an assertion in packages/mobile/tests/unit/provider.test.ts confirming LeasedDevices.finish forwards timeoutMs (5_000) to DeviceReleaseContext.

Verification (at 4afb3b95)

  • pnpm run check: passed (oxlint 0 warnings / 0 errors across 1451 files, fallow dead-code, full monorepo build + tsc -r, check-error-codes, check-peer-ranges, check-changeset-bumps, check-examples, check-install-scripts, plugins:check, mcp-server:check, docs:check: 244 compiled pages and 162 matching translated pages).
  • Unit suites: @e2e-dev/mobile tests/unit/lease (5/5 files, 37/37 passed), @e2e-dev/revyl (19/19), @e2e-dev/limrun (18/18), @e2e-dev/eas (48/48), @e2e-dev/e2b (66/66); packages/mobile/tests/unit/provider.test.ts passed 42/43 on Windows (1 pre-existing Windows '/project' path.resolve vs path.join assertion failure at line 162).
  • Live WebDriver-mock check via @e2e-dev/browserstack against bundled [email protected] with a 10 s release budget and hung DELETE /session (45 s): rejected in 6484 ms with AggregateError and aliveAfter: false (daemon terminated cleanly).

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 4 files (changes from recent commits).

Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.

View guided diff | Re-trigger cubic

@okwasniewski okwasniewski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[claude-opus-5-5] automated review on behalf of @okwasniewski

Re-checked at 4afb3b9 against main 847a09e. The ask from the last review is done, and the new commit adds no regressions.

  • Budget-derived RPC cap: DeviceReleaseContext has an optional timeoutMs, and LeasedDevices.finish forwards info.timeoutMs into it. releaseRpcBudgetMs caps the RPC at min(12 s, budget / 2), so daemon stop always keeps at least half of the budget. With cleanupTimeout: 10_000 and a hung DELETE /session, the RPC now aborts at 5 s, and stopDriver gets the outer signal before it aborts, so the daemon no longer leaks on short budgets. The acquire cleanup passes its own 30 s budget. An optional field is the right shape for a public type that third-party providers construct.
  • scope nit: the LeaseLifecycle union carries scope only in the held and session-ended variants, so endLeaseDaemon no longer checks scope !== undefined.

cubic found no issues at this head. The earlier P1 (a fresh signal for stop) is now fully covered by the budget split.

Verified

  • Unit tests: mobile 557/557. tsc --noEmit is clean for mobile, and oxlint is clean on src/lease, provider.ts, and tests/unit.
  • Mutants against the lease and provider tests:
    • Going back to the fixed 12 s cap fails tests.
    • So does not forwarding timeoutMs from finish.
    • So does giving the RPC the whole budget instead of half.
    • So does dropping context.timeoutMs in release.
  • Merges cleanly into main 847a09e. CI is green at this head: mobile (iOS and Android deterministic), spec, docs, docs translations, and benchmark.

@okwasniewski
okwasniewski dismissed stale reviews from themself November 18, 2026 16:19

Asks done, see latest automated re-check.

@okwasniewski okwasniewski added the Ready for Human Review Green, conflict-free, every thread handled. Waiting on a maintainer. label Nov 18, 2026
kdy1
kdy1 previously requested changes Nov 19, 2026

@kdy1 kdy1 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

This text was drafted with AI and posted after human approval.

  • Harnesses: T3 Code, Claude Code, Codex
  • AI agents: Claude Opus 5.5 (claude-opus-5-5), coordinator in Claude Code, GPT-6.2 Astra (gpt-6.2-astra), reviewer subagent in Codex, GPT-6.1 Sol (gpt-6.1-sol), reviewer subagent in Codex, Claude Opus 5.5 (claude-opus-5-5), reviewer subagent in Claude Code, Claude Sonnet 5.5 (claude-sonnet-5-5), reviewer subagent in Claude Code

Reviewed at 4afb3b95 against merge base 51d304e7. Releasing the lease through leases.release before daemon stop is the right approach. With the default 30 s cleanupTimeout this branch is better than main in every case I ran. The budget split still has two regressions when cleanupTimeout is shorter than about 20 s, so I am requesting changes. Details are in 5 inline comments.

What I ran

macOS. A local fake WebDriver hub through BROWSERSTACK_WEBDRIVER_ENDPOINT. browserstack().acquire() and release() with the bundled [email protected]. main and this branch were built separately and given the same input. "Daemon" is the daemon pid from state/daemon.json, checked 500 ms after release returns.

DELETE /session Budget main This branch Result
200 at once 30 s ok ok same
200 after 4 s 30 s fails: stopped without ending 1 BrowserStack session(s) ok, 5.7 s fixed
500 30 s ok (silent pass) fails: WEBDRIVER_SESSION_DELETE_FAILED fixed
hangs 30 s fails, 8.2 s, daemon stopped fails, 22.3 s, daemon stopped same
hangs 24 s — fails, 22.3 s, daemon stopped —
hangs 20 s — fails, 20.0 s, daemon still running worse
hangs 10 s fails, 8.4 s, daemon stopped fails, 10.0 s, daemon still running worse
200 after 1.5 s 5 s ok fails: request canceled; … stopped without listing lease … as released worse

Also: @e2e-dev/mobile typecheck, oxlint, and unit tests 557/557 pass. browserstack 53/53, testmu 86/86, and revyl 19/19 pass.

Outside the diff

  • packages/browserstack/src/provider.ts:98-101, packages/testmu/src/provider.ts:96-98, packages/revyl/src/provider.ts:41-43: the factory JSDoc still says that releasing the lease stops the daemon, which ends the session. The normal path is now the explicit leases.release, and daemon stop is the fallback. Please update these comments.

Not verified

Windows, the real BrowserStack, TestMu AI, and Revyl services, and callstack/agent-device#4659. On Windows, the accepted status: 'unknown' report is covered only by the unit test.

Comment thread packages/mobile/src/lease/index.ts Resolved
Comment thread packages/mobile/src/lease/index.ts Resolved
Comment thread packages/mobile/src/provider.ts Resolved
@okwasniewski okwasniewski removed the Ready for Human Review Green, conflict-free, every thread handled. Waiting on a maintainer. label Nov 19, 2026
@GaspardIV

Copy link
Copy Markdown
Contributor Author

[Gemini 4 Hydrogen] responding on behalf of @GaspardIV

Thanks for the thorough review and catching the short-cleanupTimeout and warning-suppression regressions @kdy1! I have pushed the fixes in c224f78b.

Fixed stop reserve (packages/mobile/src/lease/index.ts)

  • Replaced Math.floor(budget / 2) in releaseRpcBudgetMs with a fixed STOP_RESERVE_MS = 15_000 (Math.max(0, Math.min(RELEASE_RPC_TIMEOUT_MS, budget - STOP_RESERVE_MS))).
    • Default 30 s retains the 12 s RPC / 18 s stop split; 20 s gives 5 s RPC / 15 s stop.
    • Budgets <= 15_000 (or NaN) skip leases.release so stopDriver receives the full budget immediately.

Never drop provider warning rejections (packages/mobile/src/lease/daemon.ts, packages/mobile/src/lease/index.ts)

  • Added ProviderReleaseWarningError thrown by releaseLease when provider.warnings is non-empty.
  • endLeaseDaemon still runs stopDriver so the daemon exits cleanly, and always rethrows ProviderReleaseWarningError (or combines it into an AggregateError if stopDriver also fails). Transport errors, timeouts, and released: false keep falling back to daemon stop confirmation.

Tests, docs, and JSDoc

  • Updated packages/mobile/tests/unit/lease.test.ts:
    • Asserts 20 s (5 s RPC / 15 s reserve), skipped RPC at 10 s / 5 s / NaN, transport/timeout fallback cases, and that ProviderReleaseWarningError fails the release even when stopDriver resolves.
    • Added a fake-timer regression test simulating slow POSIX daemon stop exits (9 s under a 10 s budget and 10.5 s under a 20 s budget), verified to fail against 4afb3b95 (daemon still alive when the outer signal aborts) and pass at c224f78b.
  • Extended packages/mobile/tests/unit/lease-daemon.test.ts with real [email protected] + local mock WebDriver tests checking ProviderReleaseWarningError, verifying the daemon PID exits under short budgets (5 s w/ 1.5 s DELETE, 12 s w/ hung DELETE), and checking DELETE HTTP 500 rejects with WEBDRIVER_SESSION_DELETE_FAILED while stopping the daemon.
  • Updated .changeset/mobile-release-lease-before-stop.md to name @e2e-dev/revyl / all agent-device lease providers, added the Limits note to docs/integrations/revyl.mdx, documented context.timeoutMs in docs/mobile.mdx, and updated the factory JSDocs in packages/browserstack/src/provider.ts, packages/testmu/src/provider.ts, and packages/revyl/src/provider.ts.

Verification (Windows 11)

  • pnpm run check: passed (oxlint 0 warnings / 0 errors across 1451 files, fallow dead-code, full monorepo build + tsc -r, docs:check: 244 compiled pages and 162 matching translated pages).
  • pnpm --filter @e2e-dev/mobile exec vitest run tests/unit/lease: 5/5 files, 42/42 passed (including the 3 real-daemon short-budget / 500 tests against [email protected]).
  • Provider/mobile unit suites on the final implementation: @e2e-dev/revyl (19/19), @e2e-dev/browserstack (52/53 — 1 pre-existing Windows C:\project vs \project assertion at line 130), @e2e-dev/testmu (85/86 — 1 same pre-existing Windows path assertion at line 141), @e2e-dev/mobile test:unit (556/561 — 5 pre-existing Windows POSIX path assertions).
  • Live fake WebDriver runs via browserstack() ([email protected], Windows 11):
    • 30 s, 4 s DELETE 200: ok in 6496 ms, aliveAfter: false
    • 30 s, DELETE 500: rejected (WEBDRIVER_SESSION_DELETE_FAILED), 2903 ms, aliveAfter: false
    • 24 s, hung DELETE: rejected in 10621 ms, aliveAfter: false
    • 20 s, hung DELETE: rejected in 6600 ms, aliveAfter: false
    • 10 s, hung DELETE: rejected in 1478 ms, aliveAfter: false
    • 5 s, 1.5 s DELETE 200: RPC skipped (1520 ms, aliveAfter: false; rejects on unpatched Windows 0.21.38 due to missing Win32 SIGTERM shutdown report, matching main)
    • 20 s, 1.5 s DELETE 200: ok in 3975 ms, aliveAfter: false

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 10 files (changes from recent commits).

Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.

View guided diff | Re-trigger cubic

Comment thread packages/mobile/src/lease/index.ts Resolved

@okwasniewski okwasniewski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[claude-opus-5-5] automated review on behalf of @okwasniewski

Re-checked at c224f78 against main e88153b, which merges in cleanly. I found nothing that must change. Every ask from kdy1's review at 4afb3b9 is done:

  • Short budgets: daemon stop now always keeps 15 s. With a budget of 15 s or less the RPC is skipped (rpcBudgetMs > 0), so daemon stop gets the whole budget. Real-daemon tests in lease-daemon.test.ts check that the daemon pid is gone after a 5 s budget with a 1.5 s DELETE and after a 12 s budget with a hung DELETE. Those are the two rows from kdy1's table that got worse.
  • Provider rejection: ProviderReleaseWarningError is always rethrown, also when stopDriver resolves, and it is aggregated when stopDriver fails too. Transport errors, timeouts, and released: false still fall back to the stop report. The test at the old line 422 now uses a transport error and a timeout, and a separate test covers the warning.
  • The changeset names Revyl, revyl.mdx has the Limits note, docs/mobile.mdx documents context.timeoutMs, and the factory JSDoc in browserstack, testmu, and revyl is updated.

cubic's new P2 (index.ts:220, a temp dir left behind after a provider warning) is not a real bug. Every failed release keeps the dir and stays retryable on purpose: the forced-stop test asserts existsSync(dir) after a failure. LeasedDevices.finish also calls release only once per lease. A provider rejection follows the same rule.

Should fix

  • packages/mobile/tests/unit/lease-daemon.test.ts, the "12 s budget when DELETE /session hangs" test: daemon stop with a hung DELETE took 8.5 s here, and kdy1 measured up to 10.5 s. That leaves the 12 s signal about 1.5 to 3.5 s of headroom, which is tight for a shared CI runner. A 15 s budget skips the RPC just the same (budget - STOP_RESERVE_MS is 0), tests the same path, and gives more room.

Nits

  • packages/mobile/src/lease/index.ts:63: the Number.isNaN check is dead code. Math.max(0, NaN) is NaN, and NaN > 0 is false, so the RPC is skipped either way. Deleting the line keeps all 85 tests passing.
  • packages/mobile/src/lease/index.ts:179,197: providerRejected copies information releaseError already has. if (releaseError instanceof ProviderReleaseWarningError) throw releaseError; at the end removes the extra flag.

Verified

  • @e2e-dev/mobile tsc --noEmit is clean. oxlint is clean on src/lease and the lease tests. tests/unit/lease* plus provider.test.ts: 85/85 on macOS. The real-daemon tests take 2.5 s, 8.5 s, and 1.3 s.

  • Mutants, each of which fails at least one test:

    • dropping the provider rethrow
    • forcing providerRejected = false
    • going back to the half split
    • removing the rpcBudgetMs > 0 skip
    • a 10 s reserve
    • a 20 s reserve

    Removing the NaN guard fails nothing (see the nit).

  • CI is green at c224f78: mobile (iOS and Android deterministic), spec, check, tests on Node 22/24/26 and Bun, docs, docs translations, and benchmark.

@okwasniewski okwasniewski added the Ready for Human Review Green, conflict-free, every thread handled. Waiting on a maintainer. label Nov 20, 2026
@GaspardIV

Copy link
Copy Markdown
Contributor Author

[Gemini 4 Hydrogen] responding on behalf of @GaspardIV

Thanks @kdy1 for the thorough re-review and for catching the BROWSERSTACK_SESSION_DETAILS_ENDPOINT network call in the real-daemon tests! Addressed the must-fix and all four optional/nit items:

  • Isolated mock details endpoint (packages/mobile/tests/unit/lease-daemon.test.ts:178): Set BROWSERSTACK_SESSION_DETAILS_ENDPOINT: endpoint in withRealMockLease so the real-daemon tests never hit the live BrowserStack API. Verified with BROWSERSTACK_SESSION_DETAILS_ENDPOINT=http://10.255.255.1/x set in the outer environment.
  • 30 s happy-path real-daemon test (lease-daemon.test.ts): Added a real-daemon test with a 30 s budget and a 4 s DELETE 200 confirming the RPC release succeeds, daemon stop runs cleanly, and the daemon exits.
  • Scale RPC budget above 30 s (packages/mobile/src/lease/index.ts, lease.test.ts): Used Math.max(Math.min(RELEASE_RPC_TIMEOUT_MS, timeoutMs - STOP_RESERVE_MS), timeoutMs - (DEFAULT_RELEASE_BUDGET_MS - RELEASE_RPC_TIMEOUT_MS)), keeping <= 30 s behavior unchanged while retaining an 18 s stop reserve and giving larger cleanupTimeout values (e.g. 60 s -> 42 s RPC) to slow providers.
  • Changeset & docs precision (.changeset/mobile-release-lease-before-stop.md, browserstack.mdx, testmu.mdx, revyl.mdx + ja/zh): Qualified provider-rejection failures and the Windows RPC path as requiring more than 20 seconds of remaining cleanupTimeout (recommending keeping the default 30 seconds).

Verification (Windows 11)

  • pnpm --filter @e2e-dev/mobile exec vitest run tests/unit/lease (with BROWSERSTACK_SESSION_DETAILS_ENDPOINT=http://10.255.255.1/x): 5/5 files, 44/44 passed (including all 5 real-daemon tests in 3.0–14.8 s, and the 4 s DELETE 200 30 s test passing on Windows).
  • pnpm --filter @e2e-dev/revyl test:unit: 19/19 passed.
  • pnpm run check: passed (oxlint 0 warnings/0 errors across 1451 files, full build + tsc -r, check-error-codes, check-peer-ranges, check-changeset-bumps, docs:check: 244 MDX pages and 162 matching translations).

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 11 files (changes from recent commits).

Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.

View guided diff | Re-trigger cubic

Comment thread docs/ja/integrations/testmu.mdx Resolved
@kdy1
kdy1 dismissed their stale review November 23, 2026 11:53

All requested changes are in as of bf19d33. Checked and dismissed by a T3 Code automation (Claude) for @kdy1.

@okwasniewski okwasniewski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[claude-opus-5-5] automated review on behalf of @okwasniewski

Re-checked at bf19d33 against kdy1's 04:20 review (5 inline comments) and the author's 11:49 replies. mergeable_state: clean, all 20 review threads are resolved, and CI at bf19d33 is green (iOS/Android deterministic, mobile, spec, docs, benchmark gates, check, tests on Node 22/24/26, Bun). kdy1's review is dismissed, so no change request is standing. Every kdy1 ask is done:

  • Real BrowserStack API in tests (must-fix): done. withRealMockLease now sets BROWSERSTACK_SESSION_DETAILS_ENDPOINT to the mock. With BROWSERSTACK_SESSION_DETAILS_ENDPOINT=http://10.255.255.1/x in the outer env, all 16 tests in lease-daemon.test.ts pass. With the new env key removed and the endpoint blackholed, the 5 s, 16 s, and new 4 s tests fail with stopped without ending, matching kdy1's repro.
  • 30 s DELETE 200 real-daemon test: done. A 4 s DELETE 200 under a 30 s budget resolves and the daemon exits (4.6 s). With the RPC disabled (the main behavior), it fails with agent-device stopped without ending 1 BrowserStack session(s), kdy1's table row 1.
  • RPC budget above 30 s: done with kdy1's formula. 30 s still gives a 12 s RPC, 60 s gives 42 s and keeps 18 s for stop. The new fake-timer case at 60 s fails when the formula is reverted to the old Math.min. Budgets come from cleanupTimeout, which is capped at MAX_TIMER_MS, so setTimeout cannot overflow.
  • Changeset and docs qualified: done. BrowserStack, TestMu AI, and Revyl say "more than 20 seconds of cleanupTimeout remaining" and "keep the default 30 seconds". That covers kdy1's nit that cleanupTimeout: 20000 leaves just under 20 s at finish.

cubic's new P2 (docs/ja/integrations/testmu.mdx:220, use "20 秒以上") is not a real bug. Exactly 20 000 ms remaining would run the RPC, but finish receives deadline.remaining(), so a configured 20 s always arrives below 20 000 ms. The author's reply is correct.

Must fix

  • .changeset/mobile-release-lease-before-stop.md:5: the new sentence uses two em dashes ("and — with the default cleanupTimeout (over 20 s remaining at release) — fail the release"). This text ships as release notes, and the repo bans em/en dashes. Suggested: "..., and fail the release when any agent-device lease provider rejects ending the session (with the default cleanupTimeout)."

Verified

  • tests/unit/lease* plus provider.test.ts: 87/87 on macOS. The real-daemon tests take 2.2 s (5 s budget), 2.1 s (16 s), 4.6 s (4 s DELETE 200, 30 s), 22.5 s (hung DELETE, 30 s), and 0.8 s (DELETE 500). oxlint is clean on src/lease and both lease tests. The @e2e-dev/mobile typecheck shows only the e2e module error in src/runner-test.ts, which comes from not building e2e locally.
  • Mutants, each of which fails at least one test: Math.max reverted to Math.min (fails the 60 s unit case), RPC disabled (fails the 4 s real-daemon test), details-endpoint env removed with the endpoint blackholed (fails 3 real-daemon tests).

@GaspardIV

Copy link
Copy Markdown
Contributor Author

Removed the em dashes from .changeset/mobile-release-lease-before-stop.md\ (@okwasniewski).

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 1 file (changes from recent commits).

Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.

View guided diff | Re-trigger cubic

@okwasniewski okwasniewski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[claude-opus-5-5] automated review on behalf of @okwasniewski

Re-checked at ed45764b3. The only change since bf19d33f3 is the changeset, and the em dashes are gone. The new wording still says what the fix does. CI is green.

Nothing else to ask. Ready for human review. Maintainer call still open: accept the slow provider DELETE being cut at the RPC cap (agent-device#4822).

@okwasniewski okwasniewski added the Ready for Human Review Green, conflict-free, every thread handled. Waiting on a maintainer. label Nov 23, 2026
@okwasniewski
okwasniewski dismissed their stale review November 23, 2026 22:15

Superseded by the latest automated re-check.

@michal-e2e michal-e2e left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drafted by an AI agent and posted autonomously on Michal's behalf, without him reading it first.

Reviewed at ed45764b3 (merge base 51d304e73, main).

Nothing here blocks the merge. I could not run the Windows path from #1723 here, so that part rests on your Windows runs. The one open question is the maintainers' call on slow DELETEs (below).

Must fix: none.

Optional

  • Your PR description still describes an earlier commit. The ## Verified table names built packages at 88d9d566, and the line links (index.ts:157-177, daemon.ts:71-85) no longer match. It also leaves out the release time budget the head adds: the RPC gets at most 12 s, daemon stop keeps a 15 s reserve, the RPC is skipped below 20 s of cleanupTimeout, and DeviceReleaseContext gains an optional timeoutMs. Please add those and say whether the Windows runs were repeated at ed45764b3. One sentence is also broader than the code: "while still rejecting ... a dead daemon (daemon-not-running)". After leases.release has confirmed the session ended, a stop report from a daemon that is gone passes (lease-daemon.test.ts:68). That is the right behavior, so "unless leases.release already confirmed the session ended" is enough.
  • A provider warning with a code and an empty or missing message is dropped, so the release passes as if the provider had no complaint. daemon.ts:88. No provider we ship returns that shape today, so this is hardening: keep the entry whenever it has a non-empty code or message. Can we add a test for that shape and for a plain string warning? Two mutants of this parser survived the whole mobile suite: one that keeps an entry with an empty message, and one that blanks a string warning's text.

Verified

  • The user path from #1723, on macOS, through the built @e2e-dev/browserstack provider and the real agent-device daemon, against a local WebDriver stub on 127.0.0.1 (no BrowserStack credentials). Same script and inputs on the merge base and the head, one run each:

    DELETE /session behavior, cleanup budget merge base 51d304e73 this PR ed45764b3
    200 at once, 30 s passes passes
    200 after 4 s, 30 s fails: agent-device stopped without ending 1 BrowserStack session(s) passes
    500, 30 s passes, so a session the service refused to end goes unreported fails with WEBDRIVER_SESSION_DELETE_FAILED
    500, session details held 14 s, 30 s fails fails: stopped without listing lease ... as released
    200 after 1.5 s, 5 s (RPC skipped) passes passes
    never answers, 30 s fails after 8 s fails after 22 s: Timed out after 12000 ms waiting for lease RPC release

    The daemon process was gone after every release on both sides, and each failing case on the head says why. Main now pins agent-device 0.21.42, so I also ran the same script on a local merge of this head into main (5db0f4151): every case gave the same result, the hung DELETE failing after 25 s, and the three changed test files passed there too. Main has since moved to 7838198ca, which changes no file under packages/mobile, the three providers or the lockfile, and the head still merges into it without conflicts.

  • Suites at ed45764b3, run here: pnpm check, pnpm test, the testbed and the web benchmark passed. The web agent suite from its recordings (--strict-cache) failed 8 tests, the same 8 on the merge base: they are the steps with no recording, which call a model, and this machine has no model key. The mobile benchmark on an iOS simulator and an Android emulator failed 18 tests at the head and 17 on the merge base, 16 of them the same on both (Android fill checks, iOS keyboard dismissal, the web view coupon). The head's two others are iOS: the permission prompt test passed on a rerun, and device-fixture.e2e.ts:83 (closeApp, then Login Form not found within 5 s) failed again on a rerun at a load average near 11. The base's other one is Android device.e2e.ts:30. I don't think this PR causes any of them: the benchmark names a simulator, not a provider, so it never builds LeasedDevices (pool.ts:78-91), and nothing else this PR changes in packages/mobile/src runs there. I could not run the closeApp test on the base as a control because another job held the simulator.

  • New tests: 14 added, 14 fail under at least one mutant (new-test-kills.mjs, plus one targeted mutant: gives stopDriver an un-aborted signal during acquire cleanup fails when daemon stop is handed the RPC's own signal). Every new test fails under a mutant. 12 of the 14 fail on the merge base; the other two (the 16 s budget real-daemon stop and the slow POSIX stop under 10 s and 20 s budgets) check behavior the PR keeps.

  • Mutation testing: 34 places this PR adds or changes a branch, condition, constant or error mapping in packages/mobile/src/lease/ and provider.ts, 34 mutants, 31 killed by a failing assertion, run with each mutant applied to ed45764b3. Survivors were rerun against the whole mobile suite. Three survived: the two warning-parser mutants above, and one that hands acquire's cleanup the run's own signal instead of a fresh 30 s timeout. That last one guards code the merge base already had, so it is not this PR's gap. One mutant (daemonLifecycle: 'ensure') did not compile; its rewrite to 'managed' was killed.

Not run

  • Windows. #1723 is a Windows bug, and the head's budget logic landed after the Windows table in the description. A rerun of that table at ed45764b3 on Windows 11 would close it.
  • Real BrowserStack, TestMu and Revyl devices: hosted and paid. The local WebDriver stub stands in for BrowserStack only, and TestMu and Revyl share the same agentDeviceLeases path.

For the maintainer

  • Already raised in the last review: a DELETE slower than the 12 s RPC cap is cut, and the release then fails even if the service ends the session a moment later (agent-device#4822). The head fails closed here, as the table shows, so the cost is a red cleanup, not a leaked session reported as ended.

Nit

  • docs/integrations/browserstack.mdx says the RPC needs "more than 20 seconds" of cleanupTimeout. Exactly 20,000 ms is enough (lease.test.ts:310), so "at least 20 seconds" matches the code.

@github-actions github-actions Bot removed the Ready for Human Review Green, conflict-free, every thread handled. Waiting on a maintainer. label Nov 24, 2026
…ase-before-stop

# Conflicts:
#	docs/integrations/revyl.mdx
#	packages/mobile/src/lease/index.ts

@okwasniewski okwasniewski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[claude-opus-5-5] automated review on behalf of @okwasniewski

Re-checked at a277ceded (merge of main 1642ef238 into ed45764b3, which we and michal-e2e already found ready). mergeable, no conflict, all 20 review threads resolved, CI green (iOS/Android deterministic, mobile, spec, docs and benchmark gates, check, tests on Node 22/24/26, Bun).

The hand-resolved conflicts keep both sides:

  • packages/mobile/src/lease/index.ts: the two agent-device imports are merged into one line (createAgentDeviceClient, isAgentDeviceError, type LeaseScopedOptions). main's deviceSelection, installedIdentity, installAppPath and installLeasedApp are all there, and so are the PR's releaseLease / ProviderReleaseWarningError and the RPC budget. The PR's net diff against main matches its diff against the old merge base line for line, apart from that import.
  • docs/integrations/revyl.mdx: main's text is kept (5 minute idle, app or app.appPath, the per-session upload note), and the PR's release paragraph is inserted between them unchanged.
  • The new installLeasedApp path also works with the PR's release: when the install throws, acquire releases through the same release with the 30 s budget.

Must fix

  • None.

Verified

  • @e2e-dev/mobile typecheck clean (core and e2e built). tests/unit/lease* plus provider.test.ts: 96/96, including the real-daemon tests. Full mobile unit suite: 662/662 (provider-example fails to load only because my worktree has no mobile dist). oxlint is clean on src/lease and the unit tests, and check:changeset-bumps passes.

michal-e2e's two optional points from 11-24 are still open: the PR description is stale, and a provider warning with a code but no message is dropped. Neither blocks the merge.

@okwasniewski okwasniewski added the Ready for Human Review Green, conflict-free, every thread handled. Waiting on a maintainer. label Nov 25, 2026

@michal-e2e michal-e2e left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drafted by an AI agent and posted autonomously on Michal's behalf, without him reading it first.

Reviewed a277ceded against merge base 1642ef238.

The merge from main preserves both the app upload path and the lease release before daemon shutdown. I found no new issue in the merge resolution. The Windows run in the description used agent-device 0.21.38. A rerun with the version that will ship would close the remaining platform gap.

Verified

  • With agent-device 0.21.42 on macOS, I ran the built BrowserStack provider against the same local WebDriver stub on the base and head. A DELETE returning HTTP 200 after four seconds failed cleanup on the base and passed on the head. When the stub returned HTTP 500, cleanup passed on the base and failed with WEBDRIVER_SESSION_DELETE_FAILED on the head. The daemon exited in each case.

  • The build, pnpm check, the focused mobile lease and provider suites, and the Revyl unit suite passed at a277ceded. The Revyl docs preserve the app upload instructions and five-minute idle timeout from main. Revyl docs

  • The PR merged cleanly in a local Git check against main at 74e2abea8. That prospective merge moves to agent-device 0.21.43 and has yet to be built.

  • The lease unit tests caught both targeted changes: skipping release before daemon stop and suppressing provider warnings. Each produced a failing assertion.

Not run

  • Windows and live cloud devices. This round reran the cleanup paths affected by the merge. The previous review records the broader suites and mutation pass on the earlier head.

@michal-e2e michal-e2e left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@okwasniewski
okwasniewski merged commit c801a12 into e2e-inc:main Nov 26, 2026
41 checks passed
kblok added a commit to hardkoded/e2e-dotnet that referenced this pull request Nov 28, 2026
kblok added a commit to hardkoded/e2e-dotnet that referenced this pull request Nov 29, 2026
kblok added a commit to hardkoded/e2e-dotnet that referenced this pull request Dec 2, 2026
)

* Port the testmu() mobile device provider as TestMuDevices (e2e-inc/e2e#1900)

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Ls2e1z27tFwisNHfx3cDZt

* Redact the API message, bound the timestamp regex, document TestMuDevices

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Ls2e1z27tFwisNHfx3cDZt

---------

Co-authored-by: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ready for Human Review Green, conflict-free, every thread handled. Waiting on a maintainer. size:L Up to 499 changed lines, not counting tests, fixtures, translated docs, or the lockfile

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[browserstack] ENGINE_FAILURE (cleanup) on iOS: agent-device fails to send DELETE /session and times out waiting for graceful shutdown report

4 participants