Repository navigation
feat: gate hidden mobile Standard capture onto lossless upload-and-batch - #21479
Git-on-my-level merged 9 commits into
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d6e95254e9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| await phone.addExternalWal(wal, admittedGeneration: phone.sessionGeneration); | ||
| if (wal.ownerUid != SharedPreferencesUtil().uid || | ||
| !await phone.hasDurableWal(wal, admittedGeneration: phone.sessionGeneration)) { |
There was a problem hiding this comment.
Bind batch publication to its capture generation
When sign-out occurs with an open batch, clearAllUserState seals it before SyncProvider.clearUserData advances the phone WAL generation, while preferences still expose the retiring UID. The queued callback can therefore pass the owner check but read the successor sessionGeneration here and admit an old-owner WAL into the successor _wals; the later owner check only throws after that mutation/persistence. Bind the phone generation to the WAL when the batch starts or seals, then reuse that token for both calls so the completion is retired rather than exposed or uploaded after the next login.
AGENTS.md reference: app/AGENTS.md:L108-L108
Useful? React with 👍 / 👎.
| deletion owns the prefix. Enhanced protection encrypts the unchanged bytes. | ||
| Ordinary legacy sync uploads remain unchanged. | ||
| """ | ||
| selected = [p for p in paths if Path(p).name.startswith('audio_omimobilebatch')] |
There was a problem hiding this comment.
Validate batch claims before permanent archival
On /v2/sync-local-files, any authenticated caller can select this path solely by naming a part audio_omimobilebatch...; the route permits parts up to 200 MiB and declares no whole-request limit. Because this runs before decode, arbitrary or malformed bytes are permanently stored with no TTL, and varying the content produces a fresh digest each time; read_bytes() plus enhanced encryption also materializes full-size heap copies before validation. Check the fixed WAL framing and the legitimate 60-second mobile size bound before archiving, while preserving accepted bytes unchanged.
AGENTS.md reference: backend/AGENTS.md:L205-L205
Useful? React with 👍 / 👎.
| (_writer == null && _files >= maxFiles) || | ||
| uid.isEmpty || | ||
| !codec.isOpusSupported() || | ||
| _bytes + payload.length + 4 > maxBytes) { |
There was a problem hiding this comment.
Refresh retained quotas after WAL deletion
When synced batch WALs are removed by the existing auto-remove or user cleanup paths, _bytes and _files remain at their initialization-plus-cumulative-write values because this buffer never observes deletions. Continuous hidden capture therefore reaches the 256 MiB threshold after roughly nine audio-hours and rejects every later packet for the rest of the process even if all prior files have been deleted and disk is empty, forcing the cohort back to live streaming and skewing the battery/network experiment. Recompute retained usage before rejecting, or decrement it from the WAL deletion path.
Useful? React with 👍 / 👎.
Hidden Standard pendant capture now uses local Silero VAD, a durable journal in the existing Opus WAL format, and the existing sync upload/batch pipeline. Showing the transcript or starting a realtime consumer resumes streaming at the packet boundary without replaying batched audio. The lane defaults off and needs an expiring server capability; old servers keep new clients streaming.
ListenClientState, LocalWalSync, RecordingTransferCoordinator, sync job polling/content dedupe, and backend temporal conversation assignment. Batch files retain recording origin and cannot mix with streamed safety copies in one upload.MOBILE_STANDARD_BATCH_ENABLED/MOBILE_STANDARD_BATCH_PERCENT/MOBILE_STANDARD_BATCH_UIDS: defaults false/0/empty. Private-cloud sync and no enabled apps, audio webhook, developer realtime-transcript webhook or custom STT are required. Deploy backend-sync archive support before listen authorization. First ramp ≤5% for ≥12h; rollback disables authorization and keeps processing pending files.Validation:
All 11 workflow groups passed on final head d6e9525, including iOS compile, Android compile/JVM/emulator lifecycle acceptance, seeded journeys, full Flutter tests, backend six-shard unit/guardrails and hermetic stack gauntlets.
Physical iOS/Android suspension, noisy-speech recall and power qualification belong to the lead's ramp and workspace
battery-hillclimbtask. Native capture with a suspended/absent Flutter engine retains its existing route. No PR merge, release, deployment or submission performed.Implementation, parity finding, benchmarks and release/rollback procedure:
app/docs/mobile-standard-batch.md.UI-Evidence: none
No UI widgets or user-facing strings change; routing uses the existing visibility signal.
Product invariants affected
Line-Count-Exception: app/lib/services/capture/capture_controller.dart | 4384 -> 4437 | Only constructor/lifetime, server authorization, session invalidation, packet routing and intentional watchdog handoff hooks live in this owner; journal, VAD and batch policy are separate primitives. Avoids an unrelated capture ownership migration.
Line-Count-Exception: backend/routers/listen/receiver.py | 2510 -> 2520 | Ten-line opt-in client-state capability renewal in the existing control dispatch; admission logic is owned by the runtime and pure cohort helper.
Line-Count-Exception: backend/routers/sync.py | 2646 -> 2651 | One sync-admission-executor archive call at the existing acceptance boundary, before cache/202; the storage primitive owns byte fidelity and encryption; admission does not queue behind background storage saturation.
Line-Count-Exception: backend/utils/other/storage.py | 2049 -> 2075 | One narrowly scoped original-WAL archive primitive plus registration with the existing owner purge; reuses the established bucket, encryption and deletion fence.
Failure-Class: none
Corrects executor placement, recovery/handoff quota accounting and fractional upload bounds in this unshipped, default-off feature; the existing sync-fast-path regression from #7372 is retained and passed locally (204 tests). No deployed incident or new guard is introduced.