omi icon indicating copy to clipboard operation
omi copied to clipboard

TypeScript device SDK scan timeout never completes on a quiet adapter

Open TheRealGD2X opened this issue 2 months ago • 2 comments

On main 7163538913e15dd86534b41dc695e2a5639c0774, scanForDevices(timeoutMs) in sdks/device/typescript/src/ble/noble.ts checks its deadline only after discoverAsync() yields a peripheral. With an idle adapter, the next item never arrives, the promise remains pending, and stopScanningAsync() is never reached. This also affects a scan that finds devices and then goes quiet before its deadline. I reproduced the existing function with a fake Noble adapter: scanForDevices(20) was still pending after 200 ms, with one scan start and zero scan stops. No hardware, live Omi service, credentials or user data were involved.

Minimal mock shape for @stoprocent/noble:

export default {
  state: "poweredOn",
  async startScanningAsync() {},
  async stopScanningAsync() { console.log("stopped"); },
  async *discoverAsync() { await new Promise(() => {}); }
};

Calling the existing exported scanForDevices(20) with this module never returns. Expected: the requested scan interval ends even without advertisements, returning the devices collected so far and stopping the scan.

I have a local candidate using Noble's documented discover event with an independently owned deadline. Three deterministic regression cases fail against the original code and pass with the candidate; the complete TypeScript device SDK suite passes 15/15 under Bun 1.3.14. Hardware validation and repository-wide preflight are not yet complete, so this is not a claim of merge readiness.

Per the contribution guide's invitation to propose bounties: @josancamon19, would you approve a $10 USD bounty paid via PayPal after acceptance and merge, for the focused fix, regression tests and CI discovery? This report and candidate were authored and tested by an AI coding agent with this account owner's authorization. No payment approval or task reservation is assumed; payment details will stay private.

TheRealGD2X avatar Sep 07 '26 22:09 TheRealGD2X

I'd like to work on this issue.

The reproduction and failure mode are clear, and I can implement the focused timeout/cleanup fix along with deterministic regression tests.

Before I start, could you please confirm the proposed $10 bounty and assign the issue to me? I'll open a PR with the fix and test results once complete.

Tanayqq avatar Oct 08 '26 07:10 Tanayqq

Thanks for putting this together. We aren't doing bounties at the moment, so we're closing the bounty proposal issues for now — thanks for the fix! 🙏

aryanorastar avatar Nov 05 '26 16:11 aryanorastar