Skip to content

Fix Bluetooth auto-connect race conditions and simplify tests - #9666

Merged
arii merged 2 commits into
fix-bluetooth-race-condition-17974409934683189531from
fix-bluetooth-race-condition-17974409934683189531-16041091462057628058
Mar 26, 2026
Merged

Fix Bluetooth auto-connect race conditions and simplify tests#9666
arii merged 2 commits into
fix-bluetooth-race-condition-17974409934683189531from
fix-bluetooth-race-condition-17974409934683189531-16041091462057628058

Conversation

@arii

@arii arii commented Mar 23, 2026

Copy link
Copy Markdown
Owner

Refactored connection locks to fix race conditions as outlined in PR review directives. Simplified constants and visual test setups to avoid over-engineering.


PR created automatically by Jules for task 16041091462057628058 started by @arii

- Moved the saved device check strictly into `autoConnect` within `useBluetoothHRM`.
- Added missing `connectionLock.current = false` inside `finally` block of `connectToGatt` to prevent connection loops/leaks.
- Dropped stale memory variables (`isTimeoutDisconnect`).
- Removed environment-specific constants from `bluetooth-reconnection.ts` for improved testability and tree-shaking.
- Reverted PR-induced over-engineering in `vrt-dashboard.spec.ts` while preserving the intended race condition fixes via centralized `waitForWebSocketConnection` utility.

Co-authored-by: arii <342438+arii@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@github-actions

Copy link
Copy Markdown
Contributor

👋 Welcome to HRM!

Thanks for your contribution. This repository uses Gemini AI for automated triage, code review, and generation.

🤖 Gemini Manual Trigger Quick Reference

Command Action
@gemini-bot Run AI Code Review (PR only)
@gemini-enrich Run PR Enrichment (PR only)
@gemini-triage Run Issue Triage
@gemini-coder <task> Generate Code
@create-review-issues Create issues from review (PR only)
@gemini-help Show this help message
@pr-squash Squash PR commits (PR only)
@conflict-resolve Resolve merge conflicts (PR only)

For more details and GitHub CLI examples, see the Manual Trigger Guide.

- Moved the saved device check strictly into `autoConnect` within `useBluetoothHRM`.
- Added missing `connectionLock.current = false` inside `finally` block of `connectToGatt` to prevent connection loops/leaks.
- Dropped stale memory variables (`isTimeoutDisconnect`).
- Removed environment-specific constants from `bluetooth-reconnection.ts` for improved testability and tree-shaking.
- Reverted PR-induced over-engineering in `vrt-dashboard.spec.ts` while preserving the intended race condition fixes via centralized `waitForWebSocketConnection` utility.

Co-authored-by: arii <342438+arii@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

🤖 Gemini Review Skipped

Review was skipped for the following reason: Gemini review is globally disabled

🤖 Gemini Manual Trigger Guide

@arii arii added the not reviewed The review could not be performed or completed successfully. label Mar 23, 2026
@arii
arii marked this pull request as ready for review March 26, 2026 02:59
@arii
arii merged commit c890038 into fix-bluetooth-race-condition-17974409934683189531 Mar 26, 2026
29 checks passed
@arii
arii deleted the fix-bluetooth-race-condition-17974409934683189531-16041091462057628058 branch March 26, 2026 02:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

not reviewed The review could not be performed or completed successfully.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant