Repository navigation
fix(app): align orphan audio recovery and reclaim with the 60-day sync lookback - #25687
Merged
Merged
Conversation
…c lookback The server sync lookback rises to 60 days in production (#25677). Orphan auto-recovery stopped at 28 days and reclaim deleted unreferenced orphans over 45 days, so 28-60-day orphans were admissible but never recovered and 45-60-day orphans were deleted while the server would still accept them. Derive both from one constant, serverSyncLookbackSeconds (60 days): recovery window 58 days (two days inside), reclaim age 67 days (lookback plus the retention contract's 7-day margin_days, strict). A test fails if the reclaim age is not strictly beyond recovery plus margin. The too-old copy no longer names a day count. Kill switch semantics unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
|
@kodjima33 UI changes involving Git-on-my-level require your approval. Review the current diff, then comment |
Git-on-my-level
added a commit
that referenced
this pull request
Nov 18, 2026
…e-drain class (#25689) ## What changed and why Registry-only prose update to `FC-offline-drain-newest-first-starves-recovery-deadline`: its violated-contract text says the server lookback is 30 days. Production is 60 days after #25677 (dev and the code default stay 30). Split out of #25687 because the failure-class protocol forbids registry edits in an instance-fix PR. No status, family, scope or canonical-prevention change. ## Product invariants affected none ## How it was verified `scripts/pr-preflight --pr-body-file` on this body. JSON-only change. ## Tests No test change: registry prose only. ## UI evidence UI-Evidence: none -- registry text only ## Failure class (fixes) Failure-Class: none 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/25689?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="View guided diff" src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a> <a href="https://www.cubic.dev/action/auto-fix/pr/BasedHardware/omi/25689?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F25689&source=description" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"><img alt="Turn on auto-fix" src="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
Member
Author
|
/approve-ui 9bff7f1 |
This was referenced Nov 19, 2026
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.
What changed and why
The production offline-sync lookback (
SYNC_BACKFILL_MAX_AGE_SECONDS) rises from 30 to 60 days in #25677. The phone's orphan-audio handling (#25604, #25573) was built around 30 days: auto-recovery stopped at 28 days, and stranded-orphan reclaim deleted unreferenced orphans once both clocks passed 45 days. Under a 60-day server window, orphans 28 to 60 days old would be admissible but never auto-recovered, and orphans 45 to 60 days old would be deleted while the server would still transcribe them.All three ages now derive from one constant in
app/lib/services/wals/orphan_audio_classifier.dart, so they cannot drift apart again:serverSyncLookbackSecondsSYNC_BACKFILL_MAX_AGE_SECONDSafter #25677orphanRecoveryWindowSecondsorphanReclaimMarginSecondsmargin_daysinbackend/deploy/storage-lifecycle/retention_contract.json: a Delete is at least the longest hold plus the marginorphanReclaimAgeSeconds<=→ too young), i.e. "over 67 days". The margin also absorbs phone/server clock skew at the boundaryOther changes:
syncTooOldExplanation("This recording is over 30 days old…") now reads "This recording is older than Omi's sync window, so Omi can't transcribe it. …", naming no number, because the window is 60 days in prod and 30 on dev. Changed throughscripts/l10n.py setin all 49 locales; every locale already carried the English string, so they still do.sync_upload_batch.dart,local_wal_sync.dart,wal_orphan_reclaim.dart),CUSTODY.md, the INV-CAP-1 exception text and heading, theorphan_audio_reclaim_offregistry note inconfig/feature-flags.yaml. TheFC-offline-drain-newest-first-starves-recovery-deadlinetext also says 30 days; the failure-class protocol forbids registry edits in an instance-fix PR, so that one-line prose update goes in a separate registry-only PR.orphan_audio_reclaim_offkill switch (only a resolvedfalsepermits reclaim; true, unknown or unreadable retains everything), census completeness, reference checks, tombstones and batching. The orphan census telemetry age buckets (0_7…over_45) keep their keys, so dashboards don't break; they are descriptive only.The authority is David's 2026-11-18 decision (item 2 of the support-packet decisions in the workspace record): reclaim above the new lookback plus margin (>67 days), auto-recovery about 58 days. It replaces the 2026-11-17 orphan ruling's "server refuses >30-day uploads" premise.
Rollout
orphan_audio_reclaim_offramp reaches anyone whose unreferenced orphans are 45 to 67 days old; until it ships, builds containing fix(custody): reclaim stranded orphan audio older than 45 days #25604 still use the 45-day age wherever the flag resolves false.backfill_lookback_exceeded. That is fine: the row is persisted asoutsideRecoveryWindow, stays held and visible, and every byte is retained. Reclaim is unaffected on dev (it only gets later). The only cost is a refused request.Product invariants affected
INV-CAP-1 (
product/invariants/pendant-audio-retention.md): the explicit stranded-orphan exception moves from "older than 45 days" to "older than 67 days" (narrower deletion). Anchor link inCUSTODY.mdupdated.How it was verified
Written test-first. With the new constants introduced at the old values (30-day lookback, 45-day reclaim), the new tests failed for the right reasons: a 40-day orphan classified
expiredinstead ofrecoverable, a 50-day orphan was deleted, and the constants test failed. With the real values:flutter test test/unit/wal_orphan_reclaim_test.dart test/unit/wal_orphan_recovery_test.dart test/unit/local_wal_sync_test.dart test/pages/conversations/ test/unit/sync_status_privacy_contract_test.dart: 510 passed.python3 scripts/l10n.py check: ok, 49 locales.Layer: unit and widget tests only; not exercised on a device.
Tests
wal_orphan_reclaim_test.dart: new invariant test (reclaim age strictly greater than recovery window + margin, ≥ lookback + margin, recovery inside lookback, lookback 60 days); retention cases for an orphan at 50 days (both clocks), capture at 61 days, exactly 67 days (filename, fractional filename, mtime); deletion one second past 67 days.wal_orphan_recovery_test.dart: the inclusive boundary is now the 58-day window, and a 40-day orphan is recoverable; the manual-upload refusal test now crosses the 60-day lookback.offline_sync_recording_blocks_test.dart: asserts the new copy and that no locale'ssyncTooOldExplanationcontains a digit.UI evidence
Rendered by the existing
offline_sync_recording_blocks_test.dartrender cases (OFFLINE_SYNC_RENDER_OUTPUT), iOS, dark.Failure class (fixes)
Routine cleanup (an age timer) would destroy audio that was still recoverable.
Failure-Class: FC-audio-cleanup-before-durable-custody
🤖 Generated with Claude Code