Repository navigation
fix(app): avoid synced UI when WALs remain pending (#7240) - #11085
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
5 issues found across 3 files
Confidence score: 1/5
- In
.github/workflows/solve_issue.yml, untrustedrepository_dispatchfields are interpolated into Bash, which can allow arbitrary command execution and full workflow-token abuse if a payload is crafted — treat inputs as untrusted, validate/whitelist them, and pass values safely (no direct shell interpolation). - In
.github/workflows/solve_issue.yml, successful runs can open PRs with onlyai_fix.txtbecause the real fixer step is commented out, so automation may create misleading “fix” PRs and churn reviewer time — re-enable the agent step and add a guard that fails when no substantive code change is produced. - In
app/lib/providers/sync_provider.dart, the sync check can return true when WAL indexing is actually missing ifconversationIdis null, so users may see conversations as synced when they are not — ensure downloaded WALs get aconversationIdor make the null-path fail the synced check until indexing is confirmed. - In
.github/workflows/solve_issue.yml, repeated dispatches for the same issue can race on branch/PR creation and runs are non-reproducible due to unpinnedaider-chat, which can cause flaky or conflicting automation outcomes — add issue-keyed workflow concurrency and pin the agent version.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name=".github/workflows/solve_issue.yml">
<violation number="1" location=".github/workflows/solve_issue.yml:30">
P2: Agent setup is non-reproducible because `pip install aider-chat` pulls whatever version is latest at runtime. Pin an explicit version (or lockfile/hash) so runs stay stable and auditable.</violation>
<violation number="2" location=".github/workflows/solve_issue.yml:40">
P1: Successful runs currently open pull requests containing only the placeholder `ai_fix.txt`, not an AI-generated issue fix: the only agent operation is an `echo` and the aider command remains commented out. The workflow should either invoke and validate the configured agent before committing, or avoid creating a success PR until a real change has been produced.</violation>
<violation number="3" location=".github/workflows/solve_issue.yml:44">
P0: A crafted `repository_dispatch` payload can execute arbitrary shell commands because `issue_number` and `chat_id` are interpolated directly into Bash source. This is especially dangerous here because the workflow has repository/PR write permissions and exposes `ANTHROPIC_API_KEY`; passing payload values through step `env` variables and using quoted parameter expansions (with numeric validation for `issue_number`) would prevent payload text from becoming shell syntax.</violation>
<violation number="4" location=".github/workflows/solve_issue.yml:50">
P2: Multiple `solve_issue` dispatches for the same issue can collide on branch push and PR creation because this workflow has no concurrency guard. A workflow-level concurrency group keyed by issue number would serialize runs and avoid race-driven failures.</violation>
</file>
<file name="app/lib/providers/sync_provider.dart">
<violation number="1" location="app/lib/providers/sync_provider.dart:709">
P1: A conversation can still be shown as synced when its WAL is not indexed because `conversationId` is null. Device-download WALs are created without that field, so `walsForConversation` is empty and the `return true` branch bypasses their `uploaded`/pending status. The filter needs a reliable WAL-to-conversation mapping (or must conservatively handle unlinked WALs) before treating the lookup as proof that no local WALs exist.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
|
|
||
| git config --global user.name "AI Agent" | ||
| git config --global user.email "[email protected]" | ||
| git checkout -b fix-issue-${{ github.event.client_payload.issue_number }} |
There was a problem hiding this comment.
P0: A crafted repository_dispatch payload can execute arbitrary shell commands because issue_number and chat_id are interpolated directly into Bash source. This is especially dangerous here because the workflow has repository/PR write permissions and exposes ANTHROPIC_API_KEY; passing payload values through step env variables and using quoted parameter expansions (with numeric validation for issue_number) would prevent payload text from becoming shell syntax.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/workflows/solve_issue.yml, line 44:
<comment>A crafted `repository_dispatch` payload can execute arbitrary shell commands because `issue_number` and `chat_id` are interpolated directly into Bash source. This is especially dangerous here because the workflow has repository/PR write permissions and exposes `ANTHROPIC_API_KEY`; passing payload values through step `env` variables and using quoted parameter expansions (with numeric validation for `issue_number`) would prevent payload text from becoming shell syntax.</comment>
<file context>
@@ -0,0 +1,71 @@
+
+ git config --global user.name "AI Agent"
+ git config --global user.email "[email protected]"
+ git checkout -b fix-issue-${{ github.event.client_payload.issue_number }}
+
+ # Dummy change
</file context>
| run: | | ||
| # Dummy script for demonstration purposes. In reality, you'd run aider here: | ||
| # aider --message "Fix issue #${{ github.event.client_payload.issue_number }}" | ||
| echo "AI Agent is solving issue #${{ github.event.client_payload.issue_number }}" |
There was a problem hiding this comment.
P1: Successful runs currently open pull requests containing only the placeholder ai_fix.txt, not an AI-generated issue fix: the only agent operation is an echo and the aider command remains commented out. The workflow should either invoke and validate the configured agent before committing, or avoid creating a success PR until a real change has been produced.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/workflows/solve_issue.yml, line 40:
<comment>Successful runs currently open pull requests containing only the placeholder `ai_fix.txt`, not an AI-generated issue fix: the only agent operation is an `echo` and the aider command remains commented out. The workflow should either invoke and validate the configured agent before committing, or avoid creating a success PR until a real change has been produced.</comment>
<file context>
@@ -0,0 +1,71 @@
+ run: |
+ # Dummy script for demonstration purposes. In reality, you'd run aider here:
+ # aider --message "Fix issue #${{ github.event.client_payload.issue_number }}"
+ echo "AI Agent is solving issue #${{ github.event.client_payload.issue_number }}"
+
+ git config --global user.name "AI Agent"
</file context>
|
|
||
| bool isFullySynced(SyncedConversationPointer pointer) { | ||
| final walsForConversation = byConversationId[pointer.conversation.id] ?? const <Wal>[]; | ||
| if (walsForConversation.isEmpty) return true; // No local WALs → nothing pending. |
There was a problem hiding this comment.
P1: A conversation can still be shown as synced when its WAL is not indexed because conversationId is null. Device-download WALs are created without that field, so walsForConversation is empty and the return true branch bypasses their uploaded/pending status. The filter needs a reliable WAL-to-conversation mapping (or must conservatively handle unlinked WALs) before treating the lookup as proof that no local WALs exist.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At app/lib/providers/sync_provider.dart, line 709:
<comment>A conversation can still be shown as synced when its WAL is not indexed because `conversationId` is null. Device-download WALs are created without that field, so `walsForConversation` is empty and the `return true` branch bypasses their `uploaded`/pending status. The filter needs a reliable WAL-to-conversation mapping (or must conservatively handle unlinked WALs) before treating the lookup as proof that no local WALs exist.</comment>
<file context>
@@ -676,9 +680,37 @@ class SyncProvider extends ChangeNotifier implements IWalServiceListener, IWalSy
+
+ bool isFullySynced(SyncedConversationPointer pointer) {
+ final walsForConversation = byConversationId[pointer.conversation.id] ?? const <Wal>[];
+ if (walsForConversation.isEmpty) return true; // No local WALs → nothing pending.
+ return walsForConversation.every((w) => w.status == WalStatus.synced);
+ }
</file context>
|
|
||
| - name: Install AI Agent (Sweep / Aider) | ||
| run: | | ||
| pip install aider-chat |
There was a problem hiding this comment.
P2: Agent setup is non-reproducible because pip install aider-chat pulls whatever version is latest at runtime. Pin an explicit version (or lockfile/hash) so runs stay stable and auditable.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/workflows/solve_issue.yml, line 30:
<comment>Agent setup is non-reproducible because `pip install aider-chat` pulls whatever version is latest at runtime. Pin an explicit version (or lockfile/hash) so runs stay stable and auditable.</comment>
<file context>
@@ -0,0 +1,71 @@
+
+ - name: Install AI Agent (Sweep / Aider)
+ run: |
+ pip install aider-chat
+ # If using Aider, you can configure it here.
+ # For a real implementation, you'd pass the Anthropic/OpenAI keys as secrets.
</file context>
| echo "Fix for issue #${{ github.event.client_payload.issue_number }}" >> ai_fix.txt | ||
| git add ai_fix.txt | ||
| git commit -m "fix: resolve issue #${{ github.event.client_payload.issue_number }}" | ||
| git push origin fix-issue-${{ github.event.client_payload.issue_number }} |
There was a problem hiding this comment.
P2: Multiple solve_issue dispatches for the same issue can collide on branch push and PR creation because this workflow has no concurrency guard. A workflow-level concurrency group keyed by issue number would serialize runs and avoid race-driven failures.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/workflows/solve_issue.yml, line 50:
<comment>Multiple `solve_issue` dispatches for the same issue can collide on branch push and PR creation because this workflow has no concurrency guard. A workflow-level concurrency group keyed by issue number would serialize runs and avoid race-driven failures.</comment>
<file context>
@@ -0,0 +1,71 @@
+ echo "Fix for issue #${{ github.event.client_payload.issue_number }}" >> ai_fix.txt
+ git add ai_fix.txt
+ git commit -m "fix: resolve issue #${{ github.event.client_payload.issue_number }}"
+ git push origin fix-issue-${{ github.event.client_payload.issue_number }}
+
+ - name: Create Pull Request
</file context>
Failure-Class: none Co-authored-by: Cursor <[email protected]>
080cbdc to
dffe61e
Compare
|
Thanks @aryanorastar — this is a clean, well-scoped fix for #7240. Filtering synced-conversation pointers to only those whose WALs are fully One edge worth a look before merge: by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
kodjima33
left a comment
There was a problem hiding this comment.
Conversations were marked synced while their WALs were still pending; SyncProvider now refreshes WAL state and only counts fully-synced conversations. Regression test included. 5/5 - merging.
#11134) ## Summary Reverts #11084 (`75e4e1789d`), which added `CaptureController.onRecordingDeviceDisconnected()` and the `DeviceProvider` hook that starts a **phone-mic batch recording whenever the wearable disconnects mid-session**. ## Why **This behaviour was already reviewed and rejected.** #11066 proposed the same phone-side fallback and received `CHANGES_REQUESTED` from the app maintainer: > The tagged issue actually means recording on the device offline when not connected to bluetooth. Right now it does record offline but it breaks sometimes. This PR is not the right fix for this #11066 was closed, and #11078 was opened specifically so a phone-side fallback could be scoped on its own merits. **#11078 is still open and unapproved.** **The PR description did not match its diff.** #11084 is titled "preserve on-device offline batch across BLE disconnect" and its body states it "prevents the phone-mic fallback from triggering". Before #11084 there was no such fallback to prevent: `onRecordingDeviceDisconnected` did not exist and nothing called it, and `_startPhoneMicBatch` was reachable only from user-initiated paths. The PR introduced the feature together with a guard for it; the Implementation section listed neither the new method nor the `device_provider.dart` call site. **The guard does not cover Omi hardware.** It reads: ```dart final bool isOnDeviceOfflineBatchActive = SharedPreferencesUtil().batchModeEnabled && _recordingDevice != null && (_recordingDevice!.type == DeviceType.limitless || _offlineSessionStartSeconds != 0); ``` It consults `batchModeEnabled`, but ring-buffer capture is keyed on firmware (`WalSyncs.isRingBufferFirmware`, 3.0.20+) and is independent of that pref. With batch mode off, an Omi on 3.0.20+ keeps writing to its on-device ring while the phone starts its own mic batch — the same interval is captured twice and syncs as duplicate conversations, plus an unrequested mic activation and the battery cost. #11084 did address the technical review notes from #11066 (`deviceRecord` state, awaited stop hand-off, `deviceSupportsTranscribeLater`). The product objection was not addressed. ## Scope Revert only. #11064 and #11085 from the same batch are left in place — #11064 is a genuine sort fix, and #11085 needs a real fix rather than a revert (its `filterFullySyncedConversations` never releases a WAL retired to `WalStatus.outsideRecoveryWindow` by #10995, so those conversations stay filtered out of the synced list; tracked separately). #7194 remains open on its actual subject: on-device offline recording that works but is flaky across disconnects. ## Verification ``` flutter analyze lib/services/capture/capture_controller.dart lib/utils/batch_recording.dart \ lib/providers/device_provider.dart test/unit/batch_recording_phone_test.dart -> 1 info (unnecessary_import at device_provider.dart:4), confirmed pre-existing on main; 0 new flutter test test/unit/batch_recording_phone_test.dart test/providers/capture_provider_test.dart \ test/providers/sync_provider_fully_synced_conversations_test.dart \ test/unit/synced_conversation_pointer_order_test.dart -> 89 tests, all passed grep shouldFallbackToPhoneOnDeviceDisconnect | onRecordingDeviceDisconnected | isRecordingDuringDeviceDisconnect | _phoneMicBatchStopCompleter -> no matches remain under app/ make preflight -> 11 checks passed ``` Clean revert: no later commit touched `capture_controller.dart`, `batch_recording.dart`, `device_provider.dart`, or `batch_recording_phone_test.dart` between #11084 and `84e4c1828b`. ## Product invariants affected none ## Failure class (fixes) No `fix:` commits; no declaration required. <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/11134?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
Summary
Fixes #7240 where the app can mark recordings/conversations as synced even though some associated WALs are still left in an uploaded/pending state.
What changed
SyncProvidernow refreshes WAL state before updatingsyncState.completed.syncedConversations.WalStatus.synced.Regression test
flutter test test/providers/sync_provider_fully_synced_conversations_test.dartProduct invariants affected
none
Failure class (fixes)
Failure-Class: none