Skip to content

AWS Device Farm free-minute route and provider onboarding - #5

Open
ninan-versioning wants to merge 2 commits into
mainfrom
cursor/device-farm-onboard-8b90
Open

ninan-versioning wants to merge 2 commits into
mainfrom
cursor/device-farm-onboard-8b90

Conversation

@ninan-versioning

@ninan-versioning ninan-versioning commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

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-farm sums 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 onboard walks every registry provider. A person finishes each signup. Providers without a session driver are stubs: they are recorded and odr run will 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):

  • CreateUpload, PUT, remote-access session create with METERED billing, stop, upload delete, and closure from GetRemoteAccessSession status COMPLETED.
  • Failure, cancel, and unverified-closure paths release or keep the reservation.
  • Sweep stops a session from the stored locator.
  • Spend refusal: no Device Farm call until a fresh reconcile says the trial covers the session. A session that would pass the remainder is not_enough_remaining. Heartbeat stops the session when the reserved minutes are used up.
  • Auth is the AWS CLI credential chain plus AWS_DEVICE_FARM_PROJECT_ARN. Tests assert credential values never appear in CLI args or receipts.
  • odr onboard / odr providers status catalog, verify (presence only), and free-minute summary.

Stubbed or not live:

  • Pixel control (screenshot, tap, type, swipe). The driver refuses before CreateRemoteAccessSession unless 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.
  • Live reconcile against a real account. The sum is remote-access sessions plus automated runs, account-wide, and fails closed on an open session, a missing deviceMinutes.metered, or a truncated page list. That behavior is mocked only.
  • BrowserStack, Sauce Labs, TestMu AI, TestingBot, Genymotion, browser clouds, Kobiton, Mobilerun, and Run Cloud: onboarding entries only. odr run skips them as adapter_stub.
  • Firebase Test Lab: not added. Deprecated, shutdown 2027-09-30; the replacement requires billing.

Evidence

Read 2026-11-26.

npm run check passed (validate, typecheck, 68 tests, generated docs, bench check).

Checklist

  • npm run check passes
  • Every changed fact in registry/ has a first-party source URL and checked_at is today's date
  • No credentials, account identifiers, or personal data in the diff
  • No numbers added to bench/RESULTS.md or docs/free-tiers.md by hand (both are generated)
  • Nothing here automates account creation, terms acceptance, captcha, phone, or card steps
Open in Web Open in Cursor 

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.

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>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 6 potential issues.

Fix All in Cursor

❌ 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;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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)
Fix in Cursor Fix in Web

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"})`);
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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)
Fix in Cursor Fix in Web

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`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Fix in Cursor Fix in Web

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;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 617bbb6. Configure here.

Comment thread src/onboarding/catalog.ts
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;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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)
Fix in Cursor Fix in Web

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());

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 617bbb6. Configure here.

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