Repository navigation
OTA and Microphone Improvements - #586
Conversation
WalkthroughThis pull request introduces enhancements to the device settings and firmware update UI, improves navigation, and modifies WebSocket handling in recording functions. It also updates support page interactions with a custom dialog widget and revises text messages related to firmware updates. Changes
Uplevel your code reviews with Entelligence.AI ProEntelligence.AI ProIf you like this project, please support us by purchasing the Pro version. The Pro version has advanced context, superior noise reduction and several proprietary improvements compared to the open source version. Moreover, Entelligence.AI Pro is free for open source projects. |
There was a problem hiding this comment.
Files selected (6)
- app/lib/pages/capture/connect.dart (2)
- app/lib/pages/capture/logic/phone_recorder_mixin.dart (2)
- app/lib/pages/home/device.dart (1)
- app/lib/pages/home/device_settings.dart (4)
- app/lib/pages/home/firmware_update.dart (3)
- app/lib/pages/home/support.dart (3)
Review comments generated (18)
- Review: 13
- LGTM: 5
Tips
Chat with
Entelligence.AI Bot (@Entelligence.AI)
- Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
- Invite the bot into a review comment chain by tagging
@Entelligence.AIin a reply.
Code suggestions
- The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
- You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.
Pausing incremental reviews
- Add
@Entelligence.AI: ignoreanywhere in the PR description to pause further reviews from the bot.
| const SizedBox(height: 10), | ||
| const Text( | ||
| 'Please turn off and turn on the Friend device to complete the update', | ||
| 'Please restart the Friend device to complete the update', |
There was a problem hiding this comment.
The instruction to restart the device is clear, but it might be helpful to provide more specific instructions on how to do so. Not all users may know how to properly restart their device.
- 'Please restart the Friend device to complete the update',
+ 'Please press and hold the power button on your Friend device until it turns off. Then press the power button again to turn it back on and complete the update.',| }, | ||
| child: const Text( | ||
| "Go Back", | ||
| "Finalize", |
There was a problem hiding this comment.
The change from "Go Back" to "Finalize" makes sense in the context of a firmware update. However, ensure that this change doesn't confuse users who are used to seeing "Go Back". It might be worth considering user testing or feedback to confirm this change improves the user experience.
- "Finalize",
+ "Complete Update",| stopStreamRecording(WebsocketConnectionStatus wsConnectionState, IOWebSocketChannel? websocketChannel) async { | ||
| if (await record.isRecording()) await record.stop(); | ||
| if (wsConnectionState == WebsocketConnectionStatus.connected) websocketChannel?.sink.close(); | ||
| setState(() => recordingState = RecordingState.stop); | ||
| } |
There was a problem hiding this comment.
The removal of the WebSocket channel closing logic might lead to potential issues. If the WebSocket connection is not properly closed, it could lead to memory leaks or other unexpected behavior. It's generally a good practice to close resources when they are no longer needed.
stopStreamRecording(WebsocketConnectionStatus wsConnectionState, IOWebSocketChannel? websocketChannel) async {
if (await record.isRecording()) await record.stop();
+ if (wsConnectionState == WebsocketConnectionStatus.connected) websocketChannel?.sink.close();
setState(() => recordingState = RecordingState.stop);
}| final DeviceInfo? deviceInfo; | ||
| final BTDeviceStruct? device; | ||
| const DeviceSettings({super.key, required this.deviceInfo, this.device}); | ||
| final bool isDeviceConnected; | ||
| const DeviceSettings({super.key, this.deviceInfo, this.device, this.isDeviceConnected = false}); |
There was a problem hiding this comment.
The deviceInfo parameter has been changed from non-nullable to nullable. This could potentially introduce null reference errors in the code where deviceInfo is used without null checks. Please ensure that all usages of deviceInfo are properly checked for null values.
- final DeviceInfo deviceInfo;
+ final DeviceInfo? deviceInfo;| Stack( | ||
| children: [ | ||
| Column( | ||
| children: deviceSettingsWidgets(deviceInfo, device, context), | ||
| ), | ||
| if (!isDeviceConnected) | ||
| ClipRRect( | ||
| child: BackdropFilter( | ||
| filter: ImageFilter.blur( | ||
| sigmaX: 3.0, | ||
| sigmaY: 3.0, | ||
| ), | ||
| child: Container( | ||
| height: 410, | ||
| width: double.infinity, | ||
| margin: const EdgeInsets.only(top: 10), | ||
| decoration: BoxDecoration( | ||
| boxShadow: [ | ||
| BoxShadow( | ||
| color: Colors.black.withOpacity(0.1), | ||
| spreadRadius: 5, | ||
| blurRadius: 7, | ||
| offset: const Offset(0, 3), | ||
| ), | ||
| ], | ||
| ), | ||
| child: const Center( | ||
| child: Text( | ||
| 'Connect your device to access these settings', | ||
| style: TextStyle( | ||
| color: Colors.white, | ||
| fontSize: 16, | ||
| fontWeight: FontWeight.w500, | ||
| ), | ||
| ), | ||
| )), | ||
| ), | ||
| ), | ||
| ); | ||
| }, | ||
| child: ListTile( | ||
| title: const Text('Firmware Update'), | ||
| subtitle: Text(deviceInfo.firmwareRevision), | ||
| trailing: const Icon(Icons.arrow_forward_ios), | ||
| ), | ||
| ), | ||
| ListTile( | ||
| title: const Text('Hardware Revision'), | ||
| subtitle: Text(deviceInfo.hardwareRevision), | ||
| ), | ||
| ListTile( | ||
| title: const Text('Model Number'), | ||
| subtitle: Text(deviceInfo.modelNumber), | ||
| ), | ||
| ListTile( | ||
| title: const Text('Manufacturer Name'), | ||
| subtitle: Text(deviceInfo.manufacturerName), | ||
| ], |
There was a problem hiding this comment.
This new UI layer added when the device is not connected seems fine, but it's important to ensure that this doesn't interfere with any existing touch events on the underlying widgets. If there are interactive elements underneath this overlay, they might become inaccessible when the device is disconnected.
| @@ -1,4 +1,5 @@ | |||
| import 'package:flutter/material.dart'; | |||
| import 'package:friend_private/widgets/dialog.dart'; | |||
There was a problem hiding this comment.
| showDialog( | ||
| context: context, | ||
| builder: (c) => getDialog( | ||
| context, | ||
| () => Navigator.pop(context), | ||
| () {}, | ||
| singleButton: true, | ||
| 'Device Not Appearing After Update', | ||
| 'If your device doesn\'t appear in the list after updating the firmware, try restarting it. If it keeps blinking after restarting and doesn\'t appear in list, then the update was not successful and got corrupted.\n\nYou can try updating the firmware manually by following the guide mentioned on this page.', | ||
| okButtonText: 'Ok, I understand', | ||
| ), | ||
| ); |
There was a problem hiding this comment.
The direct URL launch has been replaced with a dialog popup. This change improves user experience by providing immediate feedback within the app instead of redirecting to an external page. However, ensure that the text in the dialog is accurate and provides sufficient information for the user.
+ showDialog(
+ context: context,
+ builder: (c) => getDialog(
+ context,
+ () => Navigator.pop(context),
+ () {},
+ singleButton: true,
+ 'Device Not Appearing After Update',
+ 'If your device doesn\'t appear in the list after updating the firmware, try restarting it. If it keeps blinking after restarting and doesn\'t appear in list, then the update was not successful and got corrupted.\n\nYou can try updating the firmware manually by following the guide mentioned on this page.',
+ okButtonText: 'Ok, I understand',
+ ),
+ );| onTap: () { | ||
| showDialog( | ||
| context: context, | ||
| builder: (c) => getDialog( | ||
| context, | ||
| () => Navigator.pop(context), | ||
| () {}, | ||
| singleButton: true, | ||
| 'Firmware Update on v1.0.2', | ||
| 'The app only supports updating the firmware from v1.0.3 onwards. If you are on v1.0.2 or below, you will need to update the firmware manually to v1.0.3 and bootloader to v0.9.0.\n\nYou can find the guide on how to update the firmware manually on this page.', | ||
| okButtonText: 'Ok, I understand', | ||
| ), | ||
| ); |
There was a problem hiding this comment.
Similar to the previous comment, the direct URL launch has been replaced with a dialog popup. Again, ensure that the text in the dialog is accurate and provides sufficient information for the user.
+ showDialog(
+ context: context,
+ builder: (c) => getDialog(
+ context,
+ () => Navigator.pop(context),
+ () {},
+ singleButton: true,
+ 'Firmware Update on v1.0.2',
+ 'The app only supports updating the firmware from v1.0.3 onwards. If you are on v1.0.2 or below, you will need to update the firmware manually to v1.0.3 and bootloader to v0.9.0.\n\nYou can find the guide on how to update the firmware manually on this page.',
+ okButtonText: 'Ok, I understand',
+ ),
+ );| onTap: () { | ||
| launchUrl(Uri.parse('https://github.com/BasedHardware/Omi/releases/tag/v1.0.3-firmware')); |
There was a problem hiding this comment.
The URL for launching has been updated. Ensure that the new URL is correct and accessible.
- launchUrl(Uri.parse('https://docs.basedhardware.com/assembly/Install_firmware/'));
+ launchUrl(Uri.parse('https://github.com/BasedHardware/Omi/releases/tag/v1.0.3-firmware'));| launchUrl(Uri.parse('https://github.com/BasedHardware/Omi/releases/tag/v1.0.3-firmware')); | ||
| }, |
There was a problem hiding this comment.
Similar to the previous comment, the URL for launching has been updated. Again, ensure that the new URL is correct and accessible.
- launchUrl(Uri.parse('https://docs.basedhardware.com/assembly/Install_firmware/'));
+ launchUrl(Uri.parse('https://github.com/BasedHardware/Omi/releases/tag/v1.0.3-firmware'));<!-- This is an auto-generated comment: release notes by OSS Entelligence.AI --> ### Summary by Entelligence.AI - New Feature: Added navigation to `DeviceSettings` from the app bar in `connect.dart` and `device.dart`. - Refactor: Updated UI rendering logic in `DeviceSettings` based on device connection status for improved user experience. - Bug Fix: Removed unnecessary WebSocket channel closure in `phone_recorder_mixin.dart` to enhance WebSocket handling. - Style: Updated text related to firmware updates in `firmware_update.dart` for better user understanding. - New Feature: Introduced a custom dialog widget in `support.dart` to replace direct URL launches, improving user interaction. <!-- end of auto-generated comment: release notes by OSS Entelligence.AI -->
…s 503 (SCA-2225) (#26458) ## What Every handler-level designed 503 refusal on `POST /v2/sync-local-files` now writes exactly one INFO record: `sync_upload_refused uid=%s status=503 reason=%s trace=<32-hex X-Cloud-Trace-Context id>` The mechanism lives in `utils/sync/designed_refusal.py`: - The handler calls `mark_designed_refusal(...)` right before the designed 503. - `designed_refusal_outcome`, the innermost decorator, captures the handler's own response or exception. - `records_designed_refusals`, outside `custody_upload`, writes the record only if the final outcome is that same object and is a 503. A 503 that the custody finalizer substitutes is left unrecorded. - The fence cutover is marked only when `SYNC_LEDGER_FENCE_MODE` is explicitly `standby`, so an invalid setting that fails closed is not marked. The existing `backfill_day_cap` line moves onto this mechanism. Failure 503s write no record. Those include `sync_dispatch_unavailable` (staging or sequencer), `sync_batch_unavailable` from batch-admission errors, custody, config and platform 503s. ## Why SCA-2225. The Cloud Run rollout guard used to exclude every sync-local-files 503 (`refusal_statuses: [503]`), which hid real failures. Removing that exclusion outright flips the labelled trip backtest, because designed backpressure then counts as errors. Luna approved a design on SCA-2225 (2026-11-27T00:09Z): exclude a 503 only when the same revision logged a designed-refusal record for the same request, and hold on anything that cannot be reconciled. The `trace=` field lets the guard match each record to its own request log one-to-one, so window edges do not skew the counts. The guard side of the change is a separate PR stacked on #26438 (linked below). Production shape check (ro-prod `read-only-bot-account`, 2026-11-27, projections only, no payloads or uids read): backend-sync 503 request logs for this route carry `trace=projects/based-hardware/traces/<id>`. The existing `sync_upload_refused … status=503` records land in `run.googleapis.com%2Fstdout` with `resource.labels.revision_name`. ### 503 inventory: `POST /v2/sync-local-files` (BasedHardware/omi `origin/main` f628eab) Line numbers are at f628eab. "Record" means one `sync_upload_refused uid=… status=503 reason=… trace=…` line. The handler marks the refusal right before its 503, and the outermost wrapper writes the line only if that same 503 is the final response. Before this change, only #8 wrote a record, and that record had no trace. `sync_upload_refused` is written only inside `sync_local_files_v2`; no other route or file writes that string. | # | file:line | code | trigger | designed? | record before | record after | |---|---|---|---|---|---|---| | 1 | utils/sync/stage.py:50 (router dependency) | stage unavailable | `OMI_ENV_STAGE` missing or invalid | failure (config) | no | no (counts as error) | | 2 | utils/other/endpoints.py:65 | `directory_routing_unavailable` | directory resolution fails | failure | no | no | | 3 | utils/other/endpoints.py:112 | `account_deletion_state_unavailable` | deletion-fence read raises | failure | no | no | | 4 | utils/account_cutover/access.py:260/262 | `account_cutover_state_unavailable` | cutover state unreadable | failure | no | no | | 5 | live_upload.py:118 via `memoized_record_wait` (sync.py:852) | `record_capture_pending` | cached conversation-level wait | designed | no | **no (gap, see below)** | | 6 | sync.py:873 | `sync_ledger_fence_cutover` | fence mode STANDBY | designed pause only when explicitly configured* | no | **yes, explicit standby only** `sync_ledger_fence_cutover` | | 7 | sync.py:973 | `backfill_capacity` | backfill lane, `SYNC_BACKFILL_ENABLED` off | designed (kill switch) | no | **yes** `backfill_disabled` | | 8 | sync.py:1040 (log at 1038) | `backfill_capacity` | unlimited_v2 backfill day cap | designed | yes, no trace | **yes** `backfill_day_cap`, now with trace | | 9 | utils/sync/record_token_lease.py:120 | custody admission | `record_custody_append.begin` raises | failure (custody) | no | no | | 10 | utils/sync/receipt_clock.py:197 / :204 | `capture_clock_anchor_unavailable` | :197 too many scopes (bounded refusal); :204 read fails | :197 designed, :204 failure | no | no (gap for :197) | | 11 | sync.py:1118 | "Historical recovery is paused" | retained recovery while backfill is off | designed | no | **yes** `retained_recovery_disabled` | | 12 | sync.py:1169 | `capture_clock_identity_required` | future-clock files with no device id | designed | no | **yes** `capture_clock_identity_required` | | 13 | live_upload.py:118 via record router (sync.py:1265, intake.py:750) | `record_capture_pending` | 9 wait reasons are designed; 4 `*_failed` reasons are failures | mixed | no | no (gap for the waits) | | 14 | intake.py:749 | `record_capture_pending` | `record_router` is None | wiring fault, unreachable | no | no | | 15 | utils/batch_pipeline/upload_coalescing.py:242 | `sync_batch_unavailable`, Retry-After 1 | coalescing wait | designed | no | no (gap) | | 16 | intake.py:987 | `sync_batch_unavailable` | decode-failure memo hit | designed repeat | no | no (gap) | | 17 | intake.py:1271 (`FutureCaptureRetry`) | `capture_clock_anchor_pending` / `identity_required` / `anchor_unavailable` | clock anchoring in batch decode | pending and identity designed; unavailable failure | no | no (gap) | | 18 | intake.py:1298 | `sync_batch_unavailable` | any batch-admission exception | failure | no | no | | 19 | sync.py:1421 | `sync_batch_unavailable` | batch declined an estimated or retained-clock upload | designed decline | no | **yes** `repaired_clock_batch_declined` | | 20 | sync.py:1608 | `backfill_capacity` | backfill lane but not Cloud Tasks eligible | failure (config, fail closed) | no | no | | 21 | sync.py:1664 | `dispatch_hold` | staging hit `DestructiveOperationInProgress` | designed pause | no | **yes** `dispatch_hold` | | 22 | sync.py:1675 | `sync_dispatch_unavailable` | GCS staging failed | failure | no | no (counts) | | 23 | sync.py:1758 | `sync_dispatch_unavailable` | sequencer registration failed | failure | no | no (counts) | | 24 | record_token_lease.py:93 (`@custody_upload` finally) | custody | `record_custody_append.finish` raises; can replace any response | failure | no | no | | — | Cloud Run platform | — | no instance, queue full, crash | infra | no app log | no (counts) | \* #6: an invalid fence setting also fails closed to STANDBY (`database/sync_jobs.py:154`) and returns the same 503. Since 61972e1, only `SYNC_LEDGER_FENCE_MODE=standby` is marked; an invalid setting stays unrecorded and counts as an error (regression test included). **Records gap (designed, but still counted as errors):** #5, #10:197, the wait reasons in #13, #15, #16, and #17 pending/identity. These 503s come from below the handler: `live_upload`, batch intake, `receipt_clock`. There the request's trace is not in scope, and the same response code is shared with failure paths. Batch intake's outer `try` also rewrites exceptions into the generic `sync_batch_unavailable`. Recording them needs the trace passed down (for example a contextvar) and its own review. Until then they count as errors on both revisions, which is the conservative direction: a candidate that changes their rate is scored as a 5xx change. **Custody finalizer (#24), fixed in 61972e1:** the record used to be written before `@custody_upload` finished, so a finalizer 503 could replace a designed response after its record existed. Now `designed_refusal_outcome`, the innermost layer, captures the handler's own response or exception, and `records_designed_refusals`, outside `custody_upload`, writes the record only if the final outcome is that same object and is a 503. A finalizer-replaced 503 stays unrecorded and counts (regression test included). **Logging path:** the `utils/sync/designed_refusal.py` logger propagates to the root handler that `main.py:27` installs through `configure_logging(K_SERVICE, default_format='text', …)`. That handler writes INFO to stdout as `INFO utils.sync.designed_refusal: sync_upload_refused uid=… status=503 reason=… trace=<32 hex>`. Cloud Run ingests stdout as `textPayload` in `run.googleapis.com%2Fstdout` and labels it with `resource.labels.revision_name`. The trace comes from the `X-Cloud-Trace-Context` header the handler already declares. It is the trace id Cloud Run writes into the request log's `trace` field. No PII is added beyond the existing `uid=` pattern. ## Composition and order - This PR touches no guard files, so it has no conflict with #26438 (`lane/holdback-wiring`). The guard change is a separate PR stacked on #26438: #26459. The workspace copy is Git-on-my-level/omi-workspace #586. - **Order:** this PR should be serving on backend-sync before either guard change scores Sync. Before that, a revision's old `backfill_day_cap` record carries no `trace=`, and the guard holds (`INSUFFICIENT_DATA refusal_records_unparseable_record`) on any window where that revision logged one. The first comparison against a pre-trace inverse can therefore hold once. - Rollback: revert this PR. The records are log-only; responses and behavior are unchanged. ## Verification Run with `omi-heavy run -- timeout 1800 bash test.sh …` (local, hermetic): - `test_sync_designed_refusal_record.py`: 19 passed. - `test_sync_backfill_day_cap_upload.py` 11, `test_logging_entrypoint_guard.py` 51, `test_sync_ledger_fence_cutover.py` 14, `test_sync_capture_time_skew.py` 160: all passed. - The other suites that touch `sync_local_files_v2` (future-early parity, schema inventory, legacy dark, fair use, mobile standard batch, batch language router, cloud tasks, assignment recovery, `test_sync_v2`, batch intake outcome, custody admission privacy): 14, 15, 48, 30, 27, 31, 40, 210, 13, 51 and 193 passed. The new tests cover: - the record format and trace parsing, and the guard parser reading the shared text format; - a raised designed 503, which is recorded once and still raised; - a mark made without the outer recorder, which writes nothing; - **custody finish failing after a designed refusal**, which gives the finalizer's 503 and no record; a clean finish records once; - a wrapper replacing the response, which writes no record; - the decorator order: recorder, then custody, then observe, then capture, then handler; - **an explicit `standby` fence, which is recorded; an invalid setting (`stanby`, `on`) gives the same 503 with no record and logs `invalid_config`**; - a real over-cap upload, which writes exactly one traced record; - an AST check that the seven marks each sit directly before a designed 503. Not proven here: that production records carry the trace id. That needs this PR serving, then a READBACK that `sync_upload_refused … trace=` lines match request-log traces on the same revision. Line-Count-Exception: backend/routers/sync.py | 4393 -> 4405 | seven designed-refusal marks, the explicit-standby guard and two decorator lines; the mechanism lives in utils/sync/designed_refusal.py ## Product invariants affected none 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Summary by Entelligence.AI
DeviceSettingsfrom the app bar inconnect.dartanddevice.dart.DeviceSettingsbased on device connection status for improved user experience.phone_recorder_mixin.dartto enhance WebSocket handling.firmware_update.dartfor better user understanding.support.dartto replace direct URL launches, improving user interaction.