Repository navigation
AWS Device Farm free-minute route and provider onboarding - #5
ninan-versioning wants to merge 2 commits into
Conversation
Device Farm sessions are created and stopped through the AWS CLI. Free-only routing uses a reconciled meter and refuses when the trial cannot be confirmed. odr onboard walks every registry provider; entries without a session driver stay stubs. Co-authored-by: QA.army Engineering <engineering@qa.army>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 6 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 617bbb6. Configure here.
| for (const run of runs) total += meteredOf(run, "test run"); | ||
| } | ||
| return Math.round(total * 100) / 100; | ||
| } |
There was a problem hiding this comment.
Reconcile omits completed remote-access minutes
High Severity
meteredDeviceMinutes treats ListRemoteAccessSessions plus ListRuns as account-wide metered usage. AWS documents ListRemoteAccessSessions as currently running sessions only, and ListRuns covers automated tests, not remote access. Completed remote-access minutes never enter the sum, so a “fresh” reconcile can report far too little usage. Free-only routing then believes the 1,000-minute trial still covers the session and can open a METERED session after the trial is gone. GetAccountSettings already returns trialMinutes.remaining, which is the figure this path is trying to reconstruct.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 617bbb6. Configure here.
| await wait(1_000); | ||
| } | ||
| throw new Error(`${label} did not reach ${want} (last status ${status ?? "unknown"})`); | ||
| }; |
There was a problem hiding this comment.
Session poll stops after forty tries
High Severity
poll advertises a 180s deadline but exits after 40 iterations with a 1s wait, so a remote-access session is given only about 40s of sleep plus API time to reach RUNNING. Device Farm commonly stays in PENDING_DEVICE or PREPARING longer than that; AWS’s own create-session example waits 600s. The session is then failed and stopped while the device is still coming up.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 617bbb6. Configure here.
| }); | ||
| const model = ctx.profile.model !== "*" ? ctx.profile.model.toLowerCase() : ctx.request.model?.toLowerCase(); | ||
| const device = listed.devices.find((d) => !model || (d.name ?? d.model ?? "").toLowerCase().includes(model)); | ||
| if (!device?.arn) throw new Error(`no available ${want} device in the Device Farm project`); |
There was a problem hiding this comment.
Device listing skips available hardware
Medium Severity
allocate calls listDevices once with AVAILABILITY EQUALS AVAILABLE and never follows nextToken. HIGHLY_AVAILABLE is a separate enum value, so the most free public devices are filtered out, and later pages are ignored. The driver then throws no available device while matching hardware is sitting on another page or in HIGHLY_AVAILABLE.
Reviewed by Cursor Bugbot for commit 617bbb6. Configure here.
| } | ||
| if (!other) missing.push("AWS_PROFILE or AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY or AWS_WEB_IDENTITY_TOKEN_FILE"); | ||
| return missing; | ||
| } |
There was a problem hiding this comment.
Driver rejects the default AWS chain
Medium Severity
awsCredentialGaps only accepts AWS_ACCESS_KEY_ID+AWS_SECRET_ACCESS_KEY, AWS_PROFILE, AWS_WEB_IDENTITY_TOKEN_FILE, or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI. The default shared-credentials profile and EC2 instance-metadata role, which the AWS CLI uses with no extra env vars, are treated as missing. requireCreds then throws missing_credentials before any Device Farm call, so a normal aws configure or instance-role setup cannot allocate even when AWS_DEVICE_FARM_PROJECT_ARN is set. A partial access key plus AWS_PROFILE is also reported as complete.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit 617bbb6. Configure here.
| const counted = minute && !left.expired && !a.manual_only && Number.isFinite(remaining); | ||
| if (counted) { | ||
| total += remaining; | ||
| by_unit[a.unit] = (by_unit[a.unit] ?? 0) + remaining; |
There was a problem hiding this comment.
Unverified minutes inflate the free total
Medium Severity
freeMinuteSummary counts any finite, non-expired, non-manual allowance whose unit is minute, device_minute, or browser_minute. It does not exclude type: unverified. Kobiton’s 300-minute allowance is unverified and unknown to renew, and the router already skips it as renewal_unverified, but odr onboard summary / odr providers status still add those 300 minutes to total_metered_minutes once the stub is connected.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 617bbb6. Configure here.
| }); | ||
| sessionArn = created.remoteAccessSession?.arn; | ||
| if (!sessionArn) throw new Error("Device Farm did not return a remote access session ARN"); | ||
| ctx.onLocator(locator()); |
There was a problem hiding this comment.
Sweep can miss a live metered session
Medium Severity
createRemoteAccessSession runs before onLocator is called with session_arn. If the process dies in that window, the stored locator has at most upload_arn / device_arn. sweepDeviceFarm only stops a session when locator.session_arn is set; otherwise it deletes the upload and reports verified with nothing to stop. The METERED remote-access session keeps running until AWS idle-timeout, outside the ledger.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 617bbb6. Configure here.


What changed
AWS Device Farm is a real route for metered remote-access sessions on Android and iOS. Free-only routing uses the ledger plus a provider meter:
odr reconcile aws-device-farmsums metered device minutes, and the router refuses when that figure is missing, stale, or too small to cover the session (rounded up to a whole minute).odr onboardwalks every registry provider. A person finishes each signup. Providers without a session driver are stubs: they are recorded andodr runwill not start them. Kobiton, Mobilerun, and Run Cloud are new registry entries. Firebase Test Lab stays excluded.The SDK export is
opendevicerouter/onboard.What is real vs stubbed
Real (tested against mocks, not a live AWS account):
METEREDbilling, stop, upload delete, and closure fromGetRemoteAccessSessionstatusCOMPLETED.not_enough_remaining. Heartbeat stops the session when the reserved minutes are used up.AWS_DEVICE_FARM_PROJECT_ARN. Tests assert credential values never appear in CLI args or receipts.odr onboard/odr providers statuscatalog, verify (presence only), and free-minute summary.Stubbed or not live:
CreateRemoteAccessSessionunless an interactor is injected. Tests inject one. Live taps are not wired, so a metered session is not opened and then abandoned. Needs a confirmed agent-device attach, then a live AWS run.deviceMinutes.metered, or a truncated page list. That behavior is mocked only.odr runskips them asadapter_stub.Evidence
Read 2026-11-26.
METEREDanddeviceMinutes. https://docs.aws.amazon.com/devicefarm/latest/APIReference/API_CreateRemoteAccessSession.html and https://docs.aws.amazon.com/devicefarm/latest/APIReference/API_DeviceMinutes.htmlunverified/unknownand is not routed. https://portal.kobiton.com/registernpm run checkpassed (validate, typecheck, 68 tests, generated docs, bench check).Checklist
npm run checkpassesregistry/has a first-party source URL andchecked_atis today's datebench/RESULTS.mdordocs/free-tiers.mdby hand (both are generated)Note
Medium Risk
Changes billing-sensitive routing and AWS session lifecycle; incorrect reconcile or reservation math could route paid Device Farm minutes, though free-only fails closed and credentials are not stored or logged.
Reviewed by Cursor Bugbot for commit 617bbb6. Bugbot is set up for automated code reviews on this repo. Configure here.