Repository navigation
Conversation
|
Strong work on the data-safety invariants here — this is clearly the right direction for backlog reliability. The advance gate is defensively correct: A few things I'd want a human maintainer to confirm before this leaves draft:
Leaving as a positive signal — not a formal approval, since this is a draft touching data-durability and background recovery. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
9981ef2 to
9e8da57
Compare
Buffer out-of-order flash pages and advance the pendant's cumulative delete watermark only across a contiguous, fsynced prefix. Failure-Class: none
Validate the full announced record range, flush and register local WALs, and send ADVANCE only after a successful DONE. A partial notification stream or process-visible file write is no longer enough to discard pendant records. Failure-Class: none
Failure-Class: new
Failure-Class: new
Failure-Class: new
Use O(1) queue drains and one typed output buffer while preserving the exact little-endian WAL format and durable ADVANCE ordering. Verified: bash app/test.sh (983 tests); app/scripts/analyze_ratchet.sh; physical 3,996,000-byte CV1 ring read with matching CRC.
Allow exactly the native device-connected wake to resume durable backlog recovery while Android Background Mode and automatic upload are both opted in. Keep all other background wakes suppressed and retain failed work for the next foreground retry without a background timer. Failure-Class: none
9e8da57 to
9ed4a58
Compare
|
This is a strong, well-scoped reliability pass — the transactional data-safety model is the right design for both the CV1 ring and the Limitless pendant. Thanks for the careful work and the accompanying unit coverage. What I verified and liked:
Two things worth a human maintainer's eye before this leaves draft:
No security, dependency, CI/workflow, or agent-instruction surfaces are touched. The shared durable-sync layer's inclusion is justified by the PR's own note that it owns the app-side acknowledgment contract for both platforms. Keeping the existing by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
b874787 to
de6ffc6
Compare
Persist device/session page identity only after durable audio, recover an interrupted append by truncating to its recorded offset, and advance cumulative pendant deletion only after the BLE write callback succeeds.\n\nFailure-Class: none Co-authored-by: multica-agent <[email protected]>
de6ffc6 to
b76f241
Compare
|
The latest commit (b76f241 — "make Limitless drain ACK idempotent") directly addresses the ambiguous-ACK → duplicate-append hazard called out earlier: the pendant-deletion watermark now advances only from a successful BLE write callback, and page appends are retry-idempotent via per-device/session watermarks. What checks out in the new idempotency layer:
One thing worth a quick maintainer sanity check: the sticky The Limitless idempotency JVM tests (failed-ACK + redrain, interrupted-append rollback, in-flight ACK) cover the key fault paths. Still leaving this as a positive signal rather than formal approval — draft status, the broad scope across Kotlin/Dart data-durability surfaces, and the existing by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
|
Thanks for this thorough rework — the transactional recovery model is well-structured and the test coverage is strong. Observations from the diff: GattOperationQueue / OmiBleManager.kt — The serialized one-operation-at-a-time queue with identity-keyed callback completion (GattOperationKey) is the right fix for stale-callback-after-reconnect. The isActiveGatt(gatt) guard on every callback path correctly rejects callbacks from retired GATT objects. Worth verifying on hardware: requestMtu now completes via the queue rather than the old listener-swap in requestMtuThenNotifyReady — onMtuChanged was removed from BleConnectionListener, so confirm no other consumer depends on it. LimitlessAckCommitGate / LimitlessFlashDrainEngine.kt — Advancing the pendant-deletion watermark only from the successful BLE write callback (not after write() returns) is the correct fix for duplicate-append-after-ambiguous-ACK. The BLOCKED state on fsync failure is appropriately conservative. The pendingFinishReason deferral so the drain doesn't complete before an in-flight ACK settles is a good detail. ContiguousFlashPageLedger — Correctly prevents ACKing past a gap. The 64-page BUFFER_LIMIT_REACHED guard bounds memory during a persistent gap. LimitlessBatchAudioWriter.kt — The checkpoint/rollback pattern (checkpointLocked then write then rollbackLocked on failure) with synchronous SharedPreferences.commit() for the per-device/session watermark is sound. recoverPendingAppendLocked() truncation on restart handles interrupted appends. ring_storage_sync.dart — Bounded-range transactions (each range independently durable before CMD_RING_ADVANCE) is a significant improvement over the single cumulative ADVANCE. RingProtocol.canAdvance() combining reachedDone, doneOk, receivedCompleteRange, protocolError, and crcVerified is thorough. The immutable sourceId (ring_{start}_{end}) with file-collision check is a good idempotency boundary. wal_file_manager.dart — Temp-file-then-rename atomic write with serialized _saveBarrier correctly prevents torn writes and ordering violations under concurrent saves. Backup fallback on corruption is a good resilience improvement. ble_packet_continuity.dart — Modular-arity duplicate/gap detection with exact-adjacent-duplicate suppression is well-reasoned. Forwarding reused-ID packets with different payloads (reset disposition) is the safe default. Background recovery — The backgroundDeviceRecoveryEnabled gate (Android + Background Mode + auto-upload, only for WakeTrigger.deviceConnected) is appropriately restrictive; tests confirm other wakes remain foreground-only. The needs-tests label appears stale given the extensive JVM and Dart test additions across all new components. Leaving for human maintainer to clear along with security/privacy review of the pendant-deletion and WAL persistence semantics. Review by glm-5.2 (automated). Leaving for human maintainer review — the data-loss-sensitive pendant-deletion and WAL-persistence transactional model needs maintainer sign-off on the acknowledgment contract before merge. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
|
Closing this experimental CV1/storage-first branch. The only firmware reliability change being carried forward is #11578; this PR is not part of that release candidate. |
|
Hey @axAilotl 👋 Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request. After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:
Before your next PR, please skim:
If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing. Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out. Thank you for being part of the Omi community! |
Summary
deviceConnectedwake to resume backlog recovery in the backgroundWhy
The old Android path mixed concurrent GATT operations, accepted stale callbacks after reconnect, treated notification arrival as implicit continuity, and allowed multiple sync observers to race. A partial or failed drain could therefore look successful, while a busy or screen-off phone could leave a large pendant backlog retrying inefficiently.
Limitless flash recovery also advanced its local deletion watermark immediately after starting an asynchronous BLE ACK. If the audio fsync succeeded but the ACK failed or the connection became ambiguous, the pendant retained the page and the next drain appended the same durable audio again. The writer now records an append checkpoint before writing, fsyncs audio, and atomically replaces that checkpoint with a device/session page watermark. A restart truncates an interrupted append, while a completed page is skipped on redrain. Pendant deletion advances only from a successful GATT completion callback.
Behavior and rollout
ADVANCECandidate testing on the Galaxy reached 98.7 KiB/s during CV1 backlog transfer. The shared durable-sync layer is intentionally included here because it owns the app-side acknowledgment contract used by both mobile platforms.
Validation
make preflight: deterministic manifest, hygiene, architecture, and invariant checks passed; local worktree PR-metadata discovery is unavailable because the task branch differs from the existing fork PR branchb76f2415eaa811ad5bd703faa078664df7005e47bash app/test.sh, Android BLE/Limitless unit tests, analyzer ratchet, focused continuity/ring/WAL/background-policy tests, integrated Galaxy/CV1 testing, and preflightFailure-Class: none