Skip to content

fix(sync): accept recordings stamped with a future date as unknown-date uploads instead of refusing them - #25401

Merged
Git-on-my-level merged 42 commits into
BasedHardware:mainfrom
Git-on-my-level:lane/q12-future-recover
Nov 15, 2026
Merged

Git-on-my-level merged 42 commits into
BasedHardware:mainfrom
Git-on-my-level:lane/q12-future-recover

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Nov 15, 2026 •

Copy link
Copy Markdown
Member

Recover future-dated WAL audio with explicitly unknown chronology

Failure-Class: FC-sync-capture-time-zero-tolerance

UI-Evidence: none -- Client changes are regenerated wire DTOs for an optional metadata field; no screen, view, widget or navigation behavior changes

Pendant recordings stamped in 2032, 2037 or 2038 currently receive typed invalid_capture_time and remain on the phone. Recover their original uploads through durable V2 admission, including unmarked old-app WALs and WALs carrying a stale conversation_id. Before ignoring that temporal target, transactionally check its conversation and tombstone only under the uploader account. A deleted source receives the existing ID-free HTTP 200 all-success deletion ACK with no admission; other privacy locks retain typed 409. A live same-owner source is retained only as capture_source_conversation_id, a privacy fence through admission, artifact access, CPU compute authorization, writes, projection and status; it never becomes a temporal target. Missing or foreign IDs disclose nothing and recover separately. Exact retained content receipts without a supplied ID still apply their original deletion fences. An unmarked source's decoded interval ends at its immutable first receipt. Marked future device/run files retain relative order with a frozen offset. Nonfuture clke estimates retain the client's estimate while remaining untrusted and isolated.

Original names/timestamp tokens, bytes, canonical content IDs, frame maps and custody proofs remain unchanged. WorkItems and API rows persist capture_time_trust=untrusted and clock=imported. Each admitted PCM unit/VAD part has a distinct stable source-derived row ID, so disconnected speech never overwrites another part; the same source in a changed bundle retains identity and receipt normalization after its timestamp falls below the recovery threshold. Exact missing-input reuploads select the original recovery decoder and compare stored normalized boundaries. No temporal merge, absorption, episode attachment, canonical episode attachment or temporal duplicate group may use unknown chronology. Exact same-source frame/custody proof remains valid for coverage; synthetic time cannot cover another source.

Deployment and same-day ramp

Owner ruling, 2026-11-15: SYNC_FUTURE_CAPTURE_CLAMP_ENABLED defaults OFF in code and all twelve dev/prod declarations (ten runtime overlays plus two listener chart values). This is a required temporary reader-compatibility gate, classified rollout in both the flag catalog and runtime env; its machine-readable ramp and review deadline are 2026-11-15, owned by the quality lead. It avoids needing operators to set env everywhere before the image rollout.

Keep false while upgrading AND draining every reader and admitter: Cloud Run backend, backend-sync, backend-sync-backfill (including the CPU-guard-pinned image), backend-integration; GKE backend-listen; tagged/traffic/task-target revisions, terminating workers, and every operator job/checkout that reads these rows. Unset OMI_ROLE mounts both API and workers; no service may be presumed reader-only. Every reachable reader must serve an image containing this change before enablement. GPU compute/merge retains full job maps and needs no image change; existing source compatibility is covered locally.

Ramp owner: quality lead. Target: the same day as image rollout. As soon as every reader and admitter is qualified, enable ON for EVERYONE in ONE config change of the twelve bindings, regenerate runtime env, and verify active revision/pod/task-target image and env readback. No David-only steady-state cohort and no overnight unexpanded gate.

Metrics that must stay clean after enablement: zero new conversations from untrusted sources sharing an episode or duplicate group with a trusted one; zero invalid_capture_time 400s for recoverable files. Capacity/funding 503s remain separate. Qualify the running OMI_BACKEND_RELEASE_SHA/source image, actual traffic percentages, task URLs and GKE pod imageIDs.

At base b23851a, old WorkItem readers discard unknown trust, and old projection.py:322-327 generates an ordinary time identity without the source partition. New already-projected rows carry sync_clock_run=, which base live_overlap.py:36-42 compares, but this cannot protect a new job processed by an old projector or old episode/duplicate reader. An unknown WorkItem discriminator would also reject work on the unchanged GPU image, so this patch does not claim an order-independent capability belt. Complete reader rollout is mandatory.

Rollback: false stops new recovery admissions. Retain upgraded readers while admitted jobs OR persisted untrusted conversations remain reachable; never remove accepted anchors, identities, staged audio or custody proof.

Phone and Home acceptance

A successful 202 supplies the existing nonempty job_id, queued status and polling fields. The old app marks the WAL uploaded and clears the refusal; completed polling marks synced and drains Pending. The inspected old general Sync honors persisted refusal due dates, while single-row Sync skips uploadRejected, so eligible scheduled retries can drain after enablement. Build 1563 retries invalid_capture_time after one day from the last persisted attempt while the first refusal is younger than seven days, then after seven days from the last attempt indefinitely (unless its recovery kill switch is compiled on). Nov 10 first refusals remain daily until the corresponding Nov 17 time; Nov 14 first refusals until Nov 21. This is eligibility at a real drain, not a timer or immediate Manual Sync promise; the 25-refused-batch-per-drain cap can spread recovery over passes. Q12-AC's final handoff explicitly contains no existing-file requeue; Manual Sync does not bypass this eligibility in the inspected app. Immediate drain of non-due or abandoned rows needs additional client requeue work. The server cannot fetch a retained file an older build has stopped retrying.

After readers are upgraded, the switch is enabled, and the phone actually resends, Home shows standalone receipt-dated recordings after processing, with optional API capture_time_trust=untrusted/clock=imported. No app badge/UI is added; the old app does not display a new date-unknown label. The start is receipt minus duration, so a recording can cross the previous local day. Existing cohorts, processing funding and backfill capacity still apply and were not measured in production.

For N files normally expect N standalone conversations, with more when decoded units or disconnected speech split a file. Requests allow at most 20 files / 64 MiB / 3,600 seconds / 360,000 frames. Lower bound: max(ceil(N/20), ceil(B/64MiB), ceil(D/3600), ceil(F/360000)); packing can require more. About 20 hours requires at least 20 requests. Actual retained file sizes/counts were not read. At one-to-three minutes per file, about 20 hours means 400–1,200 standalone entries (more for disconnected speech), at least 20–60 requests, and normally one logical notes workflow per meaningful part. Short-clip floors do not eliminate ordinary one-to-three-minute speech; they retain audio/transcripts even when notes are minimized. Recommend a separate owner-scoped recovered-recordings collection card referencing unchanged children, with explicit Home child visibility and receipt-order labeling. This can span requests without assuming a pendant timeline; grouping alone does not reduce STT or notes spend. It requires a follow-up API/Home design and is not built. Per-request grouping is simpler but still creates at least 20–60 entries; raw timestamp adjacency is insufficient run proof for unmarked sources. Existing deleted/noise/duplicate/discarded fields must not be repurposed to hide valid audio.

Tuning disclosure

Recovery threshold restored to MORE THAN 24 HOURS ahead. Normal skew remains 600 seconds by default; the band above 600 seconds through exactly 24 hours stays refused. This confines the change to clearly broken clocks and preserves ordinary moderately-fast-device chronology. Retained recovery provenance is checked even when a previously admitted file moves into that band. No broader trusted band is invented.

max_seconds before: 3600 seconds with a 7200-second hard ceiling; after: 3600 seconds with the same 7200-second ceiling. The serving provider ceiling remains unchanged. Upload limits, queue/capacity/fair-use budgets, provider/GPU allocation and test timing allowances are unchanged. Provenance classification adds a bounded owner-scoped metadata BatchGet for candidate source anchors. No new collection, historical mutation or production access is introduced.

INV-MEM-4: capture recovery introduces no Long-term-memory promotion authority; canonical consolidation remains the sole authority.

Validation: review regressions were written before fixes; final affected-file suites, explicit slow guards, inventories, typecheck and installed pre-push results are recorded in the review handoff. Hosted CI and production/device acceptance remain unverified by this lane. No push or deploy by this lane.

Line-Count-Exception: backend/routers/sync.py | 3945 -> 4113 | Preserve the existing hook or transaction seam while enforcing recovery provenance and isolation.
Line-Count-Exception: backend/utils/batch_pipeline/projection.py | 1778 -> 1794 | Preserve the existing hook or transaction seam while enforcing recovery provenance and isolation.
Line-Count-Exception: backend/utils/sync/assignment.py | 1580 -> 1582 | Preserve the existing hook or transaction seam while enforcing recovery provenance and isolation.

Line-Count-Exception: backend/utils/sync/pipeline.py | 4041 -> 4046 | Preserve the existing hook or transaction seam while enforcing recovery provenance and isolation.

Line-Count-Exception: backend/utils/episodes/service.py | 2243 -> 2249 | Preserve the existing hook or transaction seam while enforcing recovery provenance and isolation.

🤖 Generated with Claude Code

Git-on-my-level and others added 30 commits November 15, 2026 04:33
Failure-Class: FC-sync-capture-time-zero-tolerance
Failure-Class: FC-sync-capture-time-zero-tolerance
…overy off

Persist immutable owner/device/clock-run receipt offsets for new identified early and future captures. Keep full-decode anchors through coverage and VAD, preserve policy in durable tasks and workers, and pin dev/prod admissions off until all readers are compatible.

Failure-Class: FC-sync-capture-time-zero-tolerance
…indings

Keep the device offset immutable while using trusted processing time to release pending spans on retries carrying the original receipt. Classify the staged-off Helm binding as public configuration.

Failure-Class: FC-sync-capture-time-zero-tolerance
…olicy

Restore main collision normalization and parsing, remove the abandoned collision switch, and verify that future-clock recovery keeps the canonical content identity main computes. Register the future flag with the cohost gate and complete typed scope checks.

Failure-Class: FC-sync-capture-time-zero-tolerance
Preserve deployed admissions off, retain both runtime contract suites, and restore main normalization contracts after collision change withdrawal.

Failure-Class: FC-sync-capture-time-zero-tolerance
Failure-Class: FC-sync-capture-time-zero-tolerance
…locks

Restore main early placement and serialized admission documents; restrict future recovery to identified, marked batch uploads. Bound fixed spans by account creation, refuse discontinuities, and return retryable anchor failures before staging or acknowledgement.

Failure-Class: FC-sync-capture-time-zero-tolerance
Failure-Class: FC-sync-capture-time-zero-tolerance
Failure-Class: FC-sync-capture-time-zero-tolerance
…check boundary

Extract the unchanged completed-content response block to reduce intake control-flow complexity; preserve the existing unit-item builder and early document parity.

Failure-Class: FC-sync-capture-time-zero-tolerance
Move declared-language selection unchanged into a subroutine so future error handling does not exceed the canonical analyzer flow limit.

Failure-Class: FC-sync-capture-time-zero-tolerance
…llout

Omit absent future trust from coalescing and lease envelopes while preserving existing null fields; compare main and candidate documents and old readers. Keep early receipt placement unmarked. Extract unchanged unit staging to bound intake control flow.

Failure-Class: FC-sync-capture-time-zero-tolerance
…ror responses

Keep the original exception graph, language selection and unit staging; translate future-only refusals in the existing error response seam. This removes the prior exploratory helper extractions from the final diff.

Failure-Class: FC-sync-capture-time-zero-tolerance
The merged inventory contains 287 names including future capture recovery. Correct its declared count without changing the budget or any binding.

Failure-Class: FC-sync-capture-time-zero-tolerance
…ntities

Failure-Class: FC-sync-capture-time-zero-tolerance

Recover unmarked sources at immutable server receipt time and retain marked run offsets. Keep chronology untrusted, fence temporal merges and coverage, preserve original audio and retry identity, and enable the admission kill switch by default after CPU reader qualification.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Failure-Class: FC-sync-capture-time-zero-tolerance

Exercise 547 synthetic files in batches within the existing twenty-file limit without changing production capacity.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Failure-Class: FC-sync-capture-time-zero-tolerance

Replace the inherited HTTP fixture content-id stub so all 547 distinct synthetic files exercise actual content-ledger ownership.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
…fences

Failure-Class: FC-sync-capture-time-zero-tolerance

Exercise per-unit trust instead of whole-upload trust, render default-on configuration in runtime fixtures, and prove older job constructors require reader-first deployment while existing row partitions isolate recovered sources.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
…amping

Failure-Class: FC-sync-capture-time-zero-tolerance

Do not upgrade receipt-placed rows to estimated-device time during assignment. Classify the API trust marker as server-authored metadata and test the real recorded-span writer.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Failure-Class: FC-sync-capture-time-zero-tolerance

Keep the new direct getenv reader as an owned budget exception, preserving the existing helper-only inventory contract and seeded budget.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Failure-Class: FC-sync-capture-time-zero-tolerance

The steady-state manifest is enabled. Reader rollout must retain a temporary false admission value until all CPU readers qualify; the ordinary full-manifest deploy cannot serve as phase one.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Failure-Class: FC-sync-capture-time-zero-tolerance

Render the registry from final call-site wiring and keep the generated runtime environment checked.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Failure-Class: FC-sync-capture-time-zero-tolerance

Exercise the estimated-time-plus-token Q12-AC wire contract, issue all 547 synthetic timestamp refusals individually, and disable the real decode memo using its existing test flag.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
… off-state guards

Failure-Class: FC-sync-capture-time-zero-tolerance

Regenerate the app-client OpenAPI and its Dart, Swift and TypeScript DTOs for optional untrusted capture provenance. Keep legacy strict-refusal unit cases explicit about the recovery kill switch being off. No app UI or request requirement changes.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
…ovenance

Failure-Class: FC-sync-capture-time-zero-tolerance

Run the fresh-main GPU scheduler with its old WorkItem class, then prove completion retains trust and source identity for the upgraded CPU projector without changing the GPU image.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
…tion

Failure-Class: FC-sync-capture-time-zero-tolerance

The span patch still returns only its four recorded-time metadata keys and cannot clear bridge latches or deadlines. Refresh the source fingerprint and assert that invariant for untrusted receipt placement.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Failure-Class: FC-sync-capture-time-zero-tolerance

Untargeted clke estimates retain their supplied timestamp while using per-source untrusted identities and backfill routing. This prevents Q12-AC retiming from entering the ordinary temporal merge path. Normal unmarked and early-clock behavior remains unchanged, and the same kill switch preserves old-reader rollout safety.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Reject explicit conversation binding for estimated clocks and retain local custody when an isolated batch route is unavailable. Keep router behavior fixtures within the real lookback window as their old fixed date expired at 2026-11-15T12:00Z.

Failure-Class: FC-sync-capture-time-zero-tolerance

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Failure-Class: FC-sync-capture-time-zero-tolerance

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@mintlify

mintlify Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Preview approval required

This pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit 06b77b2.

Approve preview

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-15T13:34:58.926214Z 0c8cda6 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0c8cda6c0f

ℹ️ 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".

Comment on lines +335 to +336
incoming['id'] = item.conversation_id or incoming['id']
incoming['sync_clock_run'] = incoming['id']

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Prevent disconnected recovery parts from overwriting each other

When a recovered future/estimated file contains speech regions separated by at least 120 seconds, split_result emits disconnected projection parts but preserves the same WorkItem.conversation_id on each. This override therefore gives every part the same row ID. In assign_in_transaction, the existing row fails interval_matches, so the planner treats that ID as a new conversation and executes transaction.set, replacing the earlier transcript with the later part while both parts receive completion receipts. Use stable identities for disconnected parts, or explicitly handle same-source appends without overwriting an existing row.

Useful? React with 👍 / 👎.

uid,
{**(intake_context or {}), 'client_device_id': client_device_id},
decoder=decode_units,
decoder=upload_decoder(uid, client_device_id, intake_context),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Carry receipt-clock normalization into missing-input repairs

If a recovered upload's staged audio becomes missing and the client resends the exact original bundle, _repair_prior_upload calls artifact_reupload.restore_upload(..., decode=None) before reaching this decoder selection. Repair consequently uses ordinary decode_units, and _original_unit compares the raw filename timestamp against the job's receipt-normalized capture_at. A 2038 recording admitted at receipt time therefore always fails with re-upload capture boundaries changed, producing repeated 503 responses without repairing the original job. Integrate the recovery policy into repair decoding and compare the normalized stored_capture_at when checking the original unit boundaries.

Useful? React with 👍 / 👎.



def decode_future_units(paths, *, uid, device_id, received_at, max_seconds=3600, coverage_context=None):
future = [p for p in paths if is_implausible_future_capture_time(get_timestamp_from_path(p), now=received_at)]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Retain recovery provenance after the future-skew window clears

For an unmarked WAL initially stamped 601 seconds ahead, the first upload gets a frozen receipt anchor and a receipt-... identity. If the same bytes are retried in a different bundle 700 seconds later, this predicate now classifies that source as ordinary, so it loses both recovery_id and its untrusted-time marker. The batch ledger cannot re-ACK a changed bundle, and assignment cannot match the original receipt-partitioned row, allowing a second conversation to be created using the raw timestamp as trusted chronology. Consult retained per-source recovery provenance before reclassifying a previously anchored file.

AGENTS.md reference: backend/AGENTS.md:L151-L151

Useful? React with 👍 / 👎.

Git-on-my-level and others added 11 commits November 15, 2026 21:18
Retain source provenance across clock-window changes, isolate disconnected parts, ignore stale WAL targets, and exclude unknown chronology from episodes and temporal duplicate groups. Restore the 24-hour threshold and default-off reader rollout required by the quality lead.

Failure-Class: FC-sync-capture-time-zero-tolerance

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Failure-Class: FC-sync-capture-time-zero-tolerance

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Failure-Class: FC-sync-capture-time-zero-tolerance

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Exercise the real Firestore SDK request guard offline and align StrictFirestore BatchGet with its optional transaction contract.

Failure-Class: FC-sync-capture-time-zero-tolerance

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Keep every admission binding off and register the quality lead ramp to all users on the image rollout day. No operational-kill default exemption is used.

Failure-Class: FC-sync-capture-time-zero-tolerance

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Resolve router fixture conflicts with main's injected-clock timestamps. Freeze the recovery HTTP fixture receive clock alongside its receipt anchor so fixed synthetic dates cannot expire as the calendar moves. Regenerate composed runtime env and flag registry with both lanes retained.

Failure-Class: FC-sync-capture-time-zero-tolerance

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Keep explicit old-app 2032/2037/2038 cases on their injected receipt clock; let ordinary future-window fixtures advance with wall time instead of crossing their own skew/retention boundaries.

Failure-Class: FC-sync-capture-time-zero-tolerance

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The final merged-head pre-push type check caught four missing parameter annotations on the new helper. Declare its existing paths, owner, optional device and receipt-time contract without changing runtime behavior.

Failure-Class: FC-sync-capture-time-zero-tolerance

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Failure-Class: FC-sync-capture-time-zero-tolerance

Check supplied recovery source IDs only under the uploader account before isolation. Retain live original IDs as privacy-only fences through admission, artifacts, compute and projection; acknowledge deleted sources using the existing terminal deletion contract. Cover owner scope, deleted content replay, staging races and unchanged GPU compute admission.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Failure-Class: FC-sync-capture-time-zero-tolerance

Refresh the reviewed recovery branch before the final deletion-authority gates.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Failure-Class: FC-sync-capture-time-zero-tolerance

Keep ordinary module imports free of the new database authority so legacy fixture stubs and older ordinary WorkItems retain their established behavior. The recovery source check still uses live uploader-scoped transactional privacy authority.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@Git-on-my-level
Git-on-my-level merged commit fa4a99a into BasedHardware:main Nov 15, 2026
68 of 69 checks passed
Git-on-my-level added a commit that referenced this pull request Nov 15, 2026
…one proof; recover bad capture dates; storage inventory in Diagnostics (#25405)

# Drain pendant safety copies only after exact phone custody is durable

Failure-Class: new

Main PR #25415 already delivered bounded 2,700-record reads, credit
before the next READ, live-tail avoidance, shared clock continuity
across windows, lost-ADVANCE acknowledgement settlement through INFO,
and batched index validation with spent-proof retirement. Its firmware
status-poll/buffering changes are also already on main. This PR uses
that windowed reader as its base; it adds the missing phone-custody
safeguards, interrupted-tail recovery, batch-route proof, bad-date
import guard and read-only Diagnostics inventory. Base: origin/main
`9c93fa0b2d85fb1232f31fe3f5b88a19a4c406e7`; combined head:
`4958743c0142ed8e86d510bcceb9d5de13ec07c0`. Both merges were normal,
explicitly reconciled in the two services and custody contract. There is
no firmware or executable server diff against this main.

Pinned main still accepts unscoped foreign-owner references, corrupted
indexed rows, same-length replacement bytes and empty proof lists
without files/indexes. A hermetic probe using its exact custody module
produced five expected safety failures (including positive-memo
revocation) and one passing changed-ring control. The fixes here retain
nonempty owner/device-scoped, content-bound exact coordinates and reject
those cases. Main's positive whole-window file-result memo is replaced
by index-row reuse with fresh overlapping byte checks before every skip
and ADVANCE; its index-load and retirement bounds remain tested.

One reader owner covers the entire bounded-window pass through
source-connection STOP, queued notifications, indexed persistence and
final acknowledgement. Immutable downloaded ranges survive reconnect and
restart; exact indexed receipts replay before READ, including an
interrupted partial tail, without creating a second recording file.
ACKed proof candidates are retired from subsequent ADVANCE work; only
freshly revalidated released live refs remain eligible for an in-flight
duplicate skip. Download receipt journals remain until fresh INFO
confirms the read pointer. Progressing recovery-ON windows have no fixed
5/30-minute completion cap; silence and a separate 45-second
persistence-progress deadline stop stalls. Firmware without app-owned
reclaim keeps main's single unbounded READ and anonymous completion ACK.
The app follows main's window/credit pacing; no additional
live-dependent per-chunk sleep is added. Historical unmapped live copies
still cannot be reclaimed by inference.

Batch capture preserves the original live session/ring identity and
contiguous ordinals only for packets it accepts. Its fsynced checkpoint
journal survives restart; publication waits for the exact file prefix
and persisted WAL index. Declined packets take the ordinary capture path
once. Muting, packet gaps/reordering, new epochs, old firmware and disk
failures never widen proof.

R16 corrections require nonempty owner/device-scoped, content-bound
references for replay, ADVANCE and duplicate suppression.
Ownerless/legacy/hashless proofs, foreign accounts, corrupted WAL rows,
missing indexes and changed bytes fail closed. SHA-256 uses the existing
upload content-digest scheme. Empty packed records have a canonical
fsynced, indexed zero-duration marker before reclaim; an empty reference
list cannot authorize a range. The persistence deadline remains active
after DATA/DONE and only completed indexed progress renews
persistence/coordinator progress. A truly stuck OS write retains
ownership until it settles or the process restarts. Previously
duplicated audio files are preserved; different filenames are not
assumed to receive generic server deduplication.

R16b correction: valid decoded ring audio is persisted even when the
phone clock or unread-duration estimate is unusable (including a
zero-duration estimate). Estimate construction and the flush
plausibility check now downgrade only metadata to explicit unknown time
(`timerStart = 0` plus the existing clock-run token). They cannot reject
a file/index write. The original bytes, owner/device scope, digest and
exact ring coordinates still authorize reclaim. Unknown time is not a
claim about a calendar capture date or successful server processing.
Clock-switch OFF retains the old estimate arithmetic and elapsed
offsets.

R16b bounded validation: each owned READ window takes one
persisted-index snapshot and refreshes it after its own indexed write.
DATA checks only proof ranges overlapping its complete record interval;
it does not parse the full index or hash unrelated proof files.
Same-operation references are deduplicated; positive file hashes are
never cached between notifications or ADVANCE decisions. Every
production index writer, including the worker, recovery and clear paths,
revokes prior snapshots before mutation. A revoked snapshot cannot
suppress or acknowledge audio; it does not erase the existing receipt.
Independent account, epoch and content fences stay in force. Tests use
10,002 index rows and a 10,001-row fake-pendant READ to count index
loads/hashes, verify fresh replacement-byte rejection, and ensure only
the gap creates a file.

Q12-AC's guard admits device dates from 2024-01-01 through phone now
+24h inclusive. New ring, LittleFS and Dart Limitless imports outside
that window receive an estimated time and explicit clock-run token when
the phone is a plausible reference. Raw clock resets remain separate
runs. Estimates affect import grouping/naming but never substitute for
device/ring/session/sequence/ordinal proof keys or indexed byte custody.
Existing WALs are not renamed or migrated. Native Limitless writers and
the pendant's original clock-error generator remain outside this fix.

The existing Diagnostics JSON gains bounded ring state, RTC
observations, protocol history and a local recording inventory:
active/retired/foreign memory buckets, raw
indexes/backups/quarantines/temporary files, batch journals, ownership
receipt counts, loader outcomes, file totals, missing references and
uncertain orphans. Large aggregation runs off the UI isolate. It invokes
no loader, repair, migration, custody validation or ADVANCE and reads no
audio. The export marks unavailable/concurrent sources incomplete and
does not export WAL names, paths, owner values or audio bodies. Existing
outer device diagnostics identifiers remain; bounded ring coordinates
and eight-byte record prefixes are diagnostic metadata.

## Safety and failure classification

INV-CAP-1: `product/invariants/pendant-audio-retention.md`; custody
contracts: `app/lib/services/wals/CUSTODY.md` and
`app/lib/services/wals/PENDANT_RING_CUSTODY.md`. File fsync AND
persisted index precede exact-range validation and ADVANCE.
Retry/account fences remain. Invalid or partial proof retains the
pendant copy for re-download. Timestamp estimates and clock-run tokens
never authorize reclaim.

This range adds exactly one registry definition,
FC-phone-durable-pendant-proof. Its batch, interrupted-download and R16
tests are the prevention artifacts. AC's importer work is also an
instance of the existing FC-sync-capture-time-zero-tolerance; that
definition is unchanged. The installed protocol permits only one
Failure-Class declaration, so the single `new` declaration covers the
added definition and this paragraph records the existing class. Both
classes remain represented in the individual commit trailers.

## Validation

Main's window/cost suite passes 26 tests, including four new
window-boundary metadata cases. AA reader/receipt suites pass 62 with
two skips; the broader custody/live/batch/coordinator/diagnostics suites
pass 154. Capture-clock-OFF passes 88 with two skips; all three switches
OFF passes 28 with 13 intentional skips. Changed-service/window-test
analysis is clean. The foreign legacy downloaded-receipt test from fork
commit `ce0364da11afbc98b664c86a1366a735a19fef68` is retained: it tests
downloaded `ring_ranges`, distinct from the ownerless `live_ranges`
checkpoint case, and its complete file passed formatting and execution.

The final committed head is qualified with the full app suite, all
journeys, standalone preflight and the installed pre-push hook. Terminal
results, exact head/body hashes, the reconciliation table and
pinned-main red-probe evidence are recorded in `q12-aa-ring-proof.md`
and `evidence/q12-aa/main-reconciliation/`. Commands: `cd app && bash
test.sh --concurrency=4`; `make mobile-verify ARGS="fast --all"`; `make
preflight`; `OMI_PR_BODY_FILE=<this body>
BACKEND_UNIT_FILE_BUDGET_SECONDS=900 "$(git rev-parse --git-path
hooks/pre-push)" origin "$(git remote get-url origin)" </dev/null`,
through omi-heavy. These are local hermetic checks, not CI or
installed-device acceptance. Earlier green heads and failed
integration/control attempts are retained as historical evidence and do
not certify this head.

UI-Evidence: none -- The diff against merged origin/main changes no
widget, layout or user-facing string; device_diagnostics.dart only adds
a section to the existing shared JSON. The evidence gate scans all
app/lib Dart paths and explicitly accepts this truthful no-visual-change
declaration; no screenshot or evidence manifest is needed.

## Device acceptance

Install the combined artifact while preserving app data; do not
uninstall, clear storage or reset the ring. Use firmware 3.0.24, all
three repair switches ON, adequate phone disk, charging and a foreground
connected app. Keep pendant recording live. At baseline, +2 minutes and
+10 minutes (extend for UI rounding), record Device Storage
used/total/free/percent and these Offline Sync numbers: Waiting on your
Omi duration and MB; Waiting on this phone duration; Transcribing on Omi
duration; Downloading from your Omi done/total and fraction. Export
Settings → device → Diagnostics → Share at the same points and record
phone UTC, ring identity, read_seq/write_seq, dropped count,
capacity/used and persistence grant.

PASS requires Device Storage used to FALL while connected AND recording;
within the same ring, read_seq must gain faster than write_seq, dropped
count must not rise, saved audio must play, and new live capture must
continue. Faster draining only while recording is paused does not pass.
Reconnect/cancel during persistence and restart after
index-before-receipt must replay the known prefix before READ without
making a second audio file. Missing index, changed/corrupted file,
foreign owner, wrong ring, ownerless legacy proof and unknown prefix
must retain audio. Verify empty markers are indexed control metadata,
never uploaded as audio. Physical RF/background/power-loss/disk-pressure
behavior, digest cost, owner export, live Home display of estimated
dates and sustained drain remain unverified here. Firmware 3.0.24 broad
rollout remains gated on the live-recording storage decrease.

## Rollout and rollback

RELEASE ORDER: A build containing the bad-date guard MUST NOT go to the
App Store before server recovery PR #25401
(#25401) is serving with its
recovery switch ON and its readers qualified. Until then an
impossible-date import carries an estimated time that the server treats
as an ordinary date. Verify the serving revision and switch before
releasing this app; local tests do not establish that prerequisite.
Qualify how Home presents untrusted display time separately.

All three repairs are ON by default. Rebuild with
`--dart-define=OMI_RING_DRAIN_RECOVERY_OFF=true` to restore main's
windowed-reader behavior without AA indexed-tail reconstruction,
exit-path recovery or downloaded-span suppression;
`--dart-define=OMI_BATCH_RING_PROOF_OFF=true` to restore the prior batch
proof behavior; `--dart-define=OMI_DEVICE_CAPTURE_CLOCK_REPAIR_OFF=true`
to restore previous new-import timestamp predicates and naming. Use all
three for a full behavior rollback. Conservative proof validation
remains enforced. Already-reclaimed pendant copies cannot be restored by
a flag; their indexed phone files must be preserved. Existing estimated
runs and old files are not rewritten. Keep compatible server readers for
estimates already admitted.

No remote lease was added: the existing flags path can return an
unbounded last-known-good ON value and exposes no server-validation age.
A fresh HTTP read cannot establish a fresh grant. A fail-closed remote
switch needs a bounded server grant/cache-freshness contract and client
lease checks, beyond a configuration-key change; this follows the lead's
exception. The three compile-time switches remain the available rollback
controls.

## File growth

Counts below are actual origin/main → combined-head source counts.
Declarations for files below the 1,500-line threshold also document the
requested integration boundaries; the ratchet may report those as
unnecessary.

Line-Count-Exception: app/lib/services/capture/capture_controller.dart |
4941 -> 4944 | Preserve original packet coordinates at the existing
batch routing boundary without introducing another capture owner.

Line-Count-Exception: app/lib/services/wals/local_wal_sync.dart | 2789
-> 2864 | Publish owner-scoped indexed content proofs and expose
primitive inventory observations at the existing WAL owner.

Line-Count-Exception: app/lib/services/wals/pendant_ring_custody.dart |
1102 -> 1743 | Keep exact receipt replay, account/content validation and
contiguous ADVANCE decisions in the single custody authority; retain
immutable diagnostics getters.

Line-Count-Exception: app/lib/services/wals/ring_storage_sync.dart |
1230 -> 1551 | Keep streaming read ownership, persistence deadlines,
empty-record markers, exit acknowledgement and timestamp normalization
beside the existing parser.

Line-Count-Exception:
app/lib/services/devices/connectors/omi_connection.dart | 1498 -> 1580 |
Observe bounded read-only protocol events beside connector operations
without altering protocol authority.

Line-Count-Exception: app/lib/pages/settings/device_diagnostics.dart |
1091 -> 1094 | Add one JSON export section to the existing diagnostic
builder without changing presentation.

Line-Count-Exception: app/lib/services/wals/wal.dart | 1204 -> 1303 |
Persist exact source coordinates and the existing SHA-256 content
identity with the WAL serialization that owns indexed custody.


🤖 Generated with [Claude Code](https://claude.com/claude-code)
Git-on-my-level added a commit that referenced this pull request Nov 22, 2026
…6025)

## What
Turns `SYNC_FUTURE_CAPTURE_CLAMP_ENABLED` on in prod: one key, every
surface that declares it. Dev stays off.

WAL recordings dated more than 24 h ahead are then recovered (the
capture time is clamped) instead of refused with `invalid_capture_time`.

## Rendered diff: one key per surface
| Surface | Before | After |
|---|---|---|
| gke/backend-listen (overlay and `prod_omi_backend_listen_values.yaml`)
| false | true |
| cloud_run backend | false | true |
| cloud_run backend-sync | false | true |
| cloud_run backend-integration | false | true |
| cloud_run backend-sync-backfill | false | true |
| cloud_run backend-projection-pump | false | true |

Changes:
- `backend/deploy/runtime_env.yaml`, regenerated with
`compose_runtime_env.py`: 6 prod lines, value only, category still
`rollout`.
- `backend/docs/feature-flag-registry.md`, regenerated.
- The validator test now asserts on for all 6 prod readers and the
listen chart, and off for all 5 dev readers.

Also in this PR, after panel review:
- the flag-budget entry is renewed to 2026-11-29 with the enablement
reason; it expired today and would have failed `test_flag_budget.py` on
every branch from 11-23;
- the registry row summary and notes now state prod on and dev off;
- the future-capture change note now records the prod-only scope;
- the test renders each host's real manifest entry.

No other key changes.

## Why now
David's 2026-11-21 decision (Shipping, survey item 17): turn it on for
all users in one change, once every reader and admitter serves clamp
code. That gate was verified on SCA-3501 at 06:11–06:14Z:
- The four Cloud Run services each serve one 100% revision with no
traffic tags, built from clamp-qualified sources `a1a8b2d`, `d9be505`,
`b45a0c9` and `fb6048c`.
- Listen runs 22 Ready pods on `96f0631`, and the batch workers run
clamp code.
- backend-projection-pump, the fifth Cloud Run reader:
`backend-projection-pump-e13f6a6-44936391941-1` takes 100% of traffic
with no tags, image `sha256:8e3445476bdac812…`, source `e13f6a68b34f`.
Read on ro-prod at 06:35Z.
- Ancestry: #25401 (merged as `fa4a99af`) is an ancestor of all five
Cloud Run sources (`a1a8b2d`, `d9be505`, `b45a0c9`, `fb6048c`,
`e13f6a6`), checked with `git merge-base --is-ancestor`.
- The provider-STT queue was inventoried in full: 360,358 tasks, all
aimed at backend-integration, with no URI override.
- The pre-clamp epoch-3 redrive is dormant, with a recorded relaunch
restriction.

The go-ahead is on SCA-1819 and expires 2026-11-23T00:00Z.

## Kill switch and rollback
Set `'false'` on the same lines (overlay and listen chart) in one config
train. Recordings already admitted are kept after rollback;
`test_sync_receipt_clock_anchor` covers that.

## Readback (SCA-3501)
`invalid_capture_time` refusals per hour before and after, target about
0, and no new sync 5xx. A 24 h guard is run by Release.

## Verification
- `pytest tests/unit/test_backend_runtime_env_validator.py
tests/unit/test_flag_budget.py`: 327 passed.
- `scripts/check_feature_flag_registry.py`: OK.

Runtime-manifest change: INV-MEM-4 (the manifest is the source of
serving env; overlay and chart both carry the value).

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant