Skip to content

fix(webdriver): keep a session's own artifact lookup and provider id after release - #5122

Draft
ianunay wants to merge 1 commit into
callstack:mainfrom
ianunay:fix/webdriver-provider-job-id
Draft

ianunay wants to merge 1 commit into
callstack:mainfrom
ianunay:fix/webdriver-provider-job-id

Conversation

@ianunay

@ianunay ianunay commented Nov 26, 2026 •

Copy link
Copy Markdown

Summary

A released lease now lists artifacts through the lookup its prepared session bound, with the same provider and WebDriver session ids the active path passes; providers without one keep the runtime-wide lookup. A prepared session can read the hub's create-session answer through describeCreatedSession: its own provider session id, for hubs that key jobs by another id, and the allocated model, while the device keeps the requested name commands select it by. An empty id counts as absent. If anything after the hub created the session throws, the allocation deletes that session and runs provider cleanup, keeping the original error.

Part of #5121. Needed by the Sauce Labs plugin PR; no bundled provider sets the new hook.

Before / after

No observable change for BrowserStack, AWS Device Farm or TestMu AI: none binds a per-session lookup or sets describeCreatedSession. The new paths are covered by runtime-session tests.

Validation

Tested at 3691aca: provider-webdriver unit tests 349 pass; cloud-webdriver provider scenarios 34 pass; typecheck clean. The regression tests fail without the session delete and without the runtime-wide fallback.
CI obligations: full unit, provider-integration, gates.
Risks: none known.


Start Proof
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

View guided diff

…after release

A provider can bind its artifact lookup to the session it prepared, for
example to a per-session data center. After release, the runtime fell back
to the provider-wide lookup, so a later `artifacts` call asked the wrong
endpoint. A released lease now keeps the lookup its preparation bound and
passes it the same provider and WebDriver session ids as the active path.
A provider without one still uses the runtime-wide lookup.

A prepared session can now read the hub's create-session answer through
`describeCreatedSession`: the provider's own session id, for a hub whose
jobs and media are keyed by an id other than the WebDriver session id, and
the model the hub actually allocated. The device keeps its requested name,
which commands select it by. An empty id counts as absent. When anything
after the hub created the session throws, the allocation deletes that
session and runs the provider cleanup before it fails, keeping the
original error.
@thymikee

Copy link
Copy Markdown
Member

Thanks for the contribution. No code problem that must be fixed was found at 3691aca, but the change is not ready yet: CI results and answers about the need for it are still missing.

The answers to these questions decide whether the change fits the project:

  • Should this land before the plugin-or-bundled question in Sauce Labs real-device support #5121 is settled, or should the released-lookup fix go in on its own first?
  • Can Sauce Labs resolve the job from the WebDriver session id inside listArtifacts, or is the create-session answer the only source of the job id?
  • Is the model override needed for the Sauce flow to work, or can it be left out?
  • Which commit did the live Sauce Labs run in Sauce Labs real-device support #5121 use, and did it include this head?

CI has not run on this commit. The CI, Android, Apple, Linux, Size and Pull Request Body checks are waiting for approval to run for the fork, and the only check run, Proof, was skipped. The change is in provider-webdriver, which the unit and provider-integration checks exercise.

No live provider run is required for the bundled providers, because their behavior is unchanged. Not verified here: tests, typecheck and other local checks were not run, and the regression tests were judged by reading. The new hook and bound-lookup routes have no bundled consumer and no live evidence tied to this head. The Sauce Labs API and the full diff of #5123 were not reviewed.

Before merge, the questions above need answers, and CI needs to run and pass.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants