Repository navigation
SCA-561: establish single-owner capture coordination - #18946
Merged
Merged
Conversation
Route ownership-changing capture events through a single coordinator so competing sources cannot independently claim the microphone. Save a draft checkpoint while stress and conformance gates are still in progress. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The ownership migration is intended to preserve user-visible capture behavior and therefore carries no release-note copy. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Bring the foundation onto the newest capture wedge and socket recovery contracts while retaining both injectable monitors and coordinator ports. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
… owners Prevent a phone finish during a call from restarting the pendant, mint recording IDs only once, and fail closed when a transition cannot safely activate hardware. Add seeded and real-controller regression coverage. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Keep synchronous device and socket observations for existing callers while routing capture effects through the coordinator, and restore explicit phone restart and global mute admission semantics. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Keep batch handoff, suspended resume intent, unowned stop and deferred batch behavior explicit alongside the seeded coordinator gate. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Preserve pending pendant intent through onboarding and calls, fence stale BLE/socket completions, and make failure recovery and recording IDs agree with the coordinator's committed source. Exercise the real controller and seeded faulty ports before advancing the architecture for review. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Restore the reviewed C1 spine contract without allowing its legacy fixture to reopen hardware or roll sessions synchronously in production. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Preserve upstream capture UI copy and generated localization changes alongside the ownership review fixes so the PR can pass its synthetic-merge gate. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The Pacific/Kiritimati shard exposed a fixture race: an event-loop pump could finish before WAL setup reached the held fake native start. Synchronize on the fake host's actual entry point instead of test-runner scheduling. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Git-on-my-level
marked this pull request as ready for review
September 25, 2026 23:21
…ff failures Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Itaxh1
added a commit
to Itaxh1/omi
that referenced
this pull request
Sep 26, 2026
Brings in BasedHardware#18946 (capture coordinator); the 01:00 work carried onto it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CaptureCoordinatorwith explicit capture phases, an immutable state/reducer, ordered effect ports, pendant suspension debt, persisted snapshots, and a committed UI read model.CaptureControllerAPIs and callbacks through the coordinator. Keep composite legacyRunStagebodies explicitly staged, with admission guards; the native per-source writer gate remains an interface without a native implementation.Decisions and invariants
awaitingPhoneResumeand preserves the suspension through call start and call end until an explicit phone start/stop, finish, or disconnect resolves it..bin; only the hypothetical mismatched unmuted mute fails physically closed, remutes after the deny, runs skipped session cleanup, and preserves phone debt or a latched call. Other effect failures fail closed to idle.GLM/Grok review disposition
PhoneStop(false)loses pendantawaitingPhoneResumedebt, named[device-start, phone-start, interim-stop, phone-start, phone-stop] → pendantLiveregression. A call starting over the hold only flagscallActive— the debt survives call start and call end, and device starts refresh identity without resuming; only an explicit phone start/stop (or a phone stop during the call, which still converts it to call debt) resolves it (20k-soak counterexampleseed=6080350fixed).readModel; only staged internals readstagedReadModel. A held real native start asserts public getters remain idle until commit.OmiFeedback.infoinstead of starting/navigating; widget test asserts feedback and zero phone starts.ResumeDeviceTailStageor open BLE/socket.recordingState=pauseuntil policy write is confirmed unsuperseded.BleStreamStart,WalFinalize,WalSessionRollare defined but never emitted; architecture doc names their real staged owners.KeepAliveTick(testingProbe:true)requests join the first probe's future; the second caller observes that first request's outcome. Production keepalive is not coalesced this way.CAPTURE_ARCHITECTURE.md: native mic state callbacks,_setCaptureMuted, profile changes, manual offline cut, dispose, system-audio keepalive, background mode,recordingStatereads, remainingonClosedsync flags and stage-internal socket/BLE/WAL. OnConnected's direct state write moved into the queued stage.Verification-round disposition (GLM N1–N5 / Grok 1–5)
awaitingPhoneResume; identity refresh during the hold does not open BLE. An explicit later phone start/stop resumes exactly one pendant. Named fake-port and real-controller denied-retry episodes assert no early stream.true;streamRecordingthrows on refused/denied/absorbed failure. Home handles failure with localized feedback and logs/navigates only after the committed phone source exists; speech-profile disposal handles the rejected resume without an unhandled Future.CheckPhonePermissionprecedesBatchModeStage; denial leaves the old recording, flag, ID and physical mic untouched._run'sfinally, including denied and abandoned transitions; its fake-port regression asserts a denied grant is cleared before the next start.Second verification-round disposition (Grok 1–3 / GLM 1–3)
true → false → true, mic/BLE closed and debt retained.StopPhoneBatchStageand target snapshot, retaining pendant debt or converting it into a latched call's suspension. Hypothetical unmuted admission triggers physical deny, remute and stage cleanup, preserving debt for explicit retry. The batch-card Stop awaits and handles rejection with localized feedback.pendantBatchPaused, recording ID and.binuntouched. A matching unmuted policy continues the resume; a still-muted superseded mute on call start/disconnect executesSuspendPendantStageorStopDeviceSessionStageplus telemetry before committing.Logger.errorbefore returning from the asynchronous dispose resume.result: false); preserve the existing call-suspension takeover behavior outside a hold. Port regression checks call flag, mute and debt through call end._closeBleStream. No new-socket traffic leaks.Targeted verification disposition (paused-batch policy supersede)
.bin, identity, debt and call unchanged; no physical deny, remute, stage or snapshot. A thrown post-write environment read reports the error without tearing down the safe pause.simulateOpenAdmissionOnSupersedeexplicitly labels the hypothetical open fault. Effect-port fault injection includes paused-batch stop, disconnect and call start; both live pause controls log phone-mic resume only after the effective policy is unmuted.Migration plan
Now: phone/pendant start, stop, pause, finish and handoff; Omi call suspend/resume; native interruption/stall; socket listeners/keepalive; batch/settings/onboarding; launch marker recovery. Next: extract device/phone stage bodies into primitive effects (BLE open, WAL finalize/roll, socket open), migrate remaining native-callback mirrors and reconnect inputs, implement the native per-source writer gate, retire the restore marker after verified snapshot migration, then finish UI read-model adoption. The current direct exceptions and rationale are enumerated in
app/lib/services/capture/CAPTURE_ARCHITECTURE.md; the staged bodies are not represented as already-migrated ports.File-size review exceptions
Line-Count-Exception: app/lib/services/capture/capture_controller.dart | 3509 -> 3753 | Migration temporarily retains legacy composite stage bodies beside the coordinator adapter and adds a monotonic display-identity revision fence and stale-attempt teardown for same-ID BLE ABA during awaited codec/socket opens; the next extraction removes bodies rather than hiding behavior.
Line-Count-Exception: app/lib/services/capture/capture_coordinator.dart | 0 -> 2828 | Explicit event/state/effect types, pure reducer, serialized executor and snapshot are together during the compatibility and stress gate; split at proved port seams after migration.
Failure classes
Failure-Class: FC-unowned-session-mutation-tears-down-live-capture
Addresses
FC-split-mutation-authority,FC-concurrent-capture-contention, andFC-unowned-session-mutation-tears-down-live-capture. This is a staged foundation, not a claim that native writers, every legacy mirror, or everyRunStageis already under primitive port control.Verification
c1_composition_test.dartremains unchanged and its pre-coordinatoridle+ manually attesteddeviceRecordABA fixture is supported only byKeepAliveTick(testingProbe:true); while that explicit probe is in flight under idle, generation retirement is eager solely to preserve the spine'sisCurrent(before)==falseassertion. Production keepalive and actual owners never use the exception.capture_socket_generation_test.dartnow starts a real pendant session through the production public API and preserves the stale-open and positive-control assertions; the same-ID ABA race it found is fenced by a synchronous, non-ownership identity revision while its generation roll stays queued.capture_provider_test.dart's reconnect assertion now starts a real phone session and awaitspendingSourceSwitchinstead of expecting a synchronous socket callback.transcription_paused_warning_test.dartisolates the widget's source projection behind a view fixture; real controller mute/recording-ID coverage remains in coordinator tests. The visual-audit capture fake supplies the new pendant-batch getter. No assertion or protected check was skipped to turn red into green.python3 scripts/l10n.py check: passed locally after review fixes.0x5ca561. Effect-port budget: 128 sequences of 50–119 events with seeded holds and snapshot/socket/policy/native-start faults, now including production-reachable still-muted supersession on paused phone stop, pendant disconnect and call start. The simulated open-admission stop is a named defensive regression, not a claim about a production-reachable superseded mute. Earlier soaks foundseed=6080350and the exposed batch writer atseed=6071672; this round'sOMI_CAPTURE_SOAK_SEQUENCES=20000 flutter test --no-pub test/services/capture/capture_coordinator_test.dartpassed 74/74 coordinator tests with the 20,000-sequence pure-model soak and 128-sequence effect fuzz.bash app/test.shpassed 138 spine and 3,246 main tests (five skipped). Analyzer ratchet, localization (49 locales, 3,389 keys),scripts/pr-preflight --pr-body-file pr-body-capture-coordinator.md(22 checks) andmake preflight(22 checks) passed. Final head6127506ccb5c5331e39744105ce0dc021c956d87: all seven expected workflows passed. Mobile App Checks includes Dart Analyze & Tests, Pacific/Kiritimati Dart tests, Seeded Journeys, Android JVM Unit Tests, Android Compile Smoke, Generated Files and Mobile Release Eligibility. Repo Checks, Backend Checks, Backend Hermetic E2E, Web Checks, Desktop Checks, and Desktop Swift CI succeeded (unaffected jobs intentionally skipped).6b34d423ecexposed a test-harness timing assumption in the Pacific/Kiritimati shard: the held native-start regression inspectedstartCallsbefore async WAL setup reached the fake host. The fake host now signals entry; both held-start regressions await it instead of a fixed event-loop pump. On prior headc4f8b88869, targetedTZ=Pacific/KiritimatiandTZ=Pacific/Pago_Pagocoordinator tests each passed 65/65. This was a fixture timing issue, not a capture behavior failure. The PR remains open and unmerged pending targeted review and David's decision.Generated with Devin