Skip to content

Home redesign: recordings and conversations (v3) - #25500

Merged
Git-on-my-level merged 57 commits into
mainfrom
feat/conversations-v3
Nov 16, 2026
Merged

Git-on-my-level merged 57 commits into
mainfrom
feat/conversations-v3

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

Home redesign: recordings and conversations (v3)

Failure-Class: none

Today an all-day wearer's Home shows episodes and day-parts. Hours of unrelated talk get glued into one
row ("Math Skills, Export Finance, and Miko… · 3h 39m"), and 10-second fragments get filed as rows. A
live recording can also block a closed episode's summary.

This PR replaces that model with two layers:

  • Recordings are the pendant/phone capture documents, now hidden from every product reader.
  • Conversations are transcript windows over those recordings, one row per real conversation. A
    window is cut at 5 minutes of silence, a change of subject, a manual end, or 2 hours.

Episodes are retired for v3 accounts. One PR carries the server, the app and a graceful switch, with a
clear point at which the episode code can be deleted.

What a v3 user sees

  • Home is one flat list of conversations under day labels.
    • Each row is today's slim row.
    • The conversation in progress leads Today from the first speech.
    • Past days show Yesterday ›, which opens the day summary; Today has no chevron.
  • The tile shows where the pipeline is:
    • breathing dot: live;
    • spinner: transcribing;
    • pen: writing the summary;
    • emoji: done;
    • warning mark: failed, with the existing "Summary failed · Retry" control. Retry reprocesses that
      conversation's own window.
  • Some conversations are hidden from Home only. These are short ones (under 300 words) and TV, media
    or background talk. They stay in the day summary, search, the activity page and agent/MCP access.
    Hiding follows two rules:
    • A manual end is intent (David's ruling): a conversation the user ends themselves always gets a
      row if it has any speech. An end with no speech makes no row.
    • When the wearer's voice is not recognised, the conversation is shown, not hidden. "Background"
      hides a conversation only when the wearer is positively recognised in its recordings.
  • Opening a live or unsummarised conversation shows the pen and "Writing your summary…" over a
    skeleton. The summary then streams in section by section. It is rewritten in full after 5 or more
    minutes of new talk.
  • Audio plays and exports exactly the conversation's window, on released builds too. The server
    builds one window-exact file, and clients poll while it is pending. Covering recordings are never
    handed out.

v3 Home, writing your summary, summary streaming, light Home

These are widget-test renders. The test engine has no emoji font, so emoji draw as boxes.

The switch and released apps

  • conversations_v3 is a per-user switch. CONVERSATIONS_V3_STAGE takes cohort|beta|all and ships
    as beta. beta means accounts carrying the sticky TestFlight client_seen marker.
    CONVERSATIONS_V3=off is the kill switch for new intake; already-marked work still drains.
  • One stage source. backend/deploy/runtime_env/_base.yaml fans out to every creator, finalizer and
    reader service (API, listen/pusher, sync, backfill, integration and jobs).
  • Released builds keep working for v3 users.
    • Episode routes answer enabled:false.
    • The plain conversation list carries the new rows.
    • Capture keeps its recording ids.
    • Audio comes from the window-exact artifact.
    • No minimum-version gate is added.
  • The new app asks GET /v1/conversations/live ({"v3": bool, "conversation": …}).
    • The answer is remembered per account (<uid>:1|0).
    • Until the first answer, the app makes no episode or Home-feed calls. A first-answer 5xx falls back to
      today's Home.
    • Accounts that are not v3 see today's Home unchanged.

App (Flutter)

  • ConversationsV3Provider (switch and live row) gates EpisodeProvider and HomeFeedProvider.
  • v3 Home is built in conversations_page.dart.
  • New widgets: ConversationStateTile (live / transcribing / writing / done / failed), DaySummaryHeader
    and LiveSummarySection.
    • LiveSummarySection consumes /summary/stream (chat SSE framing). It polls every 2 s for up to 60 s
      on a 409 summary_in_progress, and shows Try Again on failure.
  • The live row cannot be swiped, long-pressed, merged or selected.
  • An unreadable live row never leaves the switch unanswered.
  • One new string, "Writing your summary…", in all 49 locales.

Backend

  • Builder.

    • reconcile(uid) builds conversation windows from pending recordings under a lease.
    • It is triggered by named Cloud Tasks on the dedicated conversations-v3 queue, plus a sweeper.
    • It works in bounded 32-recording pages, keeping continuous windows across pages.
    • Leases are renewed and bounded, with retry budgets per content fingerprint, so a malformed output
      or a failure never re-bills forever.
  • Outline. One model call names each window: title, one line, sections, people and kind.

    • Short context: profile, bound people and today's earlier titles, with a default-on kill switch
      CONVERSATIONS_V3_OUTLINE_CONTEXT.
    • The cache is keyed by the effective prompt.
  • Notes.

    • Notes reuse process_conversation and the existing notes prompt (one shot, Luna/low).
    • Background summaries run on Flex first, with Standard as the fallback; on-open summaries use Standard.
    • The summary keeps today's personal context: the composer's bounded profile, goals, people and
      memories pack, capped at 2,000 tokens per summary and 320 per outline (about 108 / 46 on a synthetic
      example).
    • Short (20–299 words) conversations get tasks and memories without a summary call. Media and
      background get no processing.
    • The prompt version is bumped to notes-6. Output for non-v3 conversations is unchanged, so notes-5
      checkpoints stay reusable.
  • Readers. The two read paths (lists and by-id) hide recordings, and 491 reader references are
    classified by backend/scripts/check_conversation_readers.py. The MCP, developer, People, Home-feed,
    entity and episode-member field masks carry recording / home_hidden. Merge, reprocess and Joan
    reject recording ids.

  • Deletion. Deleting a conversation releases its claims. A recording is purged once nothing claims
    it, including after a deletion during capture.

  • Counts. Counts use aggregate queries. The generated index manifest totals 304 composite indexes.

  • New endpoints:

    • /v1/conversations/live;
    • /v1/conversations/{id}/summary/stream.

    The OpenAPI changes are additive only, and the Dart/TS/Swift types are regenerated.

Contracts and per-round decisions: backend/docs/listen_pusher_pipeline/changes/2026-11-16-conversations-v3.md
and backend/docs/runbooks/conversations-v3.md. The per-round test logs are kept outside the repository
to stay under GitHub's 300-file compare limit.

Review

The backend was reviewed in four rounds: 11 parallel reviews (DeepSeek lanes plus Luna, read-only), each
followed by fixes and a verification pass of those fixes. The app had five parallel reviews.

The Quality lead mapped this week's support complaints against the design. Two of their risks are fixed
here:

  • failed conversations now show as failed;
  • when the wearer is not recognised, a conversation is shown rather than hidden.

The overlapping Quality fixes (#25462, #25463, #25466, #25467, #25481) are on main and merged into this
branch.

Verification (combined branch, after merging current main)

Rollout (owner: lead2): all TestFlight users, then production within 12 hours

  1. Before admission:
    • provision the dedicated conversations-v3 queue and the declared indexes;
    • make sure every creator, finalizer and reader service serves this code with the same stage;
    • keep CONVERSATIONS_V3=off until then.
  2. Set CONVERSATIONS_V3_FIRST_APP_BUILD from the first TestFlight build containing this PR. Until
    then, the episode-call counter buckets every build as unknown.
  3. Dev check: named accounts through live capture, sync and late audio, plus released-app fallback
    (audio, share, delete).
  4. Stage beta (TestFlight).
  5. Stage all within 12 hours, if these stay clean:
    • visibility and summary latency;
    • per-user-day conversations, model calls and cost;
    • share, delete and processing errors;
    • pending age and stuck items;
    • late-rewrite cost share ≤5%;
    • the uncertain-recognition and terminal-failure counters.

Rollback: set the stage back, or CONVERSATIONS_V3=off. This affects new intake only.

When the episode code can be deleted

Delete it in a follow-up only when all of these hold:

  • stage all has run for 14 days;
  • the kill switch has been unused for 7 days;
  • episode calls are below 1% of active mobile sessions by build bucket;
  • the 30-day backfill is complete and sample-verified for every active pendant owner.

The backfill ships off and needs V3-BACKFILL-30D-PARTITIONS first.

Follow-ups outside this PR

  • V3-BACKFILL-30D-PARTITIONS: resumable 30-day backfill partitions with a completion receipt.
  • MCP long-conversation reads: the 500-segment cap bites sooner with up-to-2-hour conversations. This
    should be owned before stage all.
  • V3-MOMENT-MARKERS: a user-set marker as a cut or section (third double-tap action, voice).
  • V3-SECTION-START-TIMES.
  • REVIEW-BACKGROUND-FREE-TEXT.
  • Participant person ids.
  • A capture-screen redesign (cancel an accidental start, a clear way back to Home).

Product invariants affected

  • INV-DATA-1: app/lib/main.dart only registers ConversationsV3Provider and wires the episode/feed suppression; no routing, environment or data-plane authority changes.
  • INV-MEM-3: recordings never extract or index memories; derived windows use the existing admission.
  • INV-MEM-4: copied transcripts and claims fence deletion and late rewrites.
  • INV-TASK-2: task extraction and candidate authority are unchanged; no recording tasks or historical
    task notifications.

Line-Count-Exception: app/lib/providers/conversation_provider.dart | 2340 -> 2343 | Exclude a live v3 row from merge eligibility; the switch and Home logic live in conversations_v3_provider.dart.
Line-Count-Exception: backend/database/conversations.py | 5110 -> 5225 | Add visibility opt-ins, atomically owe builder work at existing transcript writers and re-arm it when audio lands on a settled recording; policy and builder stay in v3 modules.
Line-Count-Exception: backend/database/firestore_index_registry.py | 2349 -> 2396 | Declare additive v3 collection/window/sweep indexes in the owning registry.
Line-Count-Exception: backend/routers/conversations.py | 2713 -> 2827 | Add capability, summary stream and existing capture/read projection seams; implementation lives in v3 modules.
Line-Count-Exception: backend/routers/developer.py | 2870 -> 2874 | Apply the shared post-read recording guard to existing developer by-id seams.
Line-Count-Exception: backend/utils/conversations/process_conversation.py | 3463 -> 3508 | Delegate recording, manual-intent, retry, personal context and audio fences without rewriting the Q12-owned notes prompt or sync merge.
Line-Count-Exception: backend/utils/episodes/composer.py | 2118 -> 2133 | Meter composes and suppress v3 owners while preserving legacy composition.
Line-Count-Exception: backend/utils/episodes/service.py | 2314 -> 2330 | Apply owner admission at episode write/read hooks and reject recordings as episode members.
Line-Count-Exception: backend/utils/sync/assignment.py | 1606 -> 1610 | Mark v3 sources at existing intake and enqueue the durable builder obligation; merge algorithm stays owned by Q12-AU.
Line-Count-Exception: backend/routers/sync.py | 4123 -> 4135 | Delegate v3 window-exact artifact assembly to the playback owner.

🤖 Generated with Claude Code

Git-on-my-level and others added 30 commits November 16, 2026 13:55
Reads the per-account switch and the conversation in progress from
GET /v1/conversations/live, and adds the audio-manifest and summary-stream
clients. A v3 account makes no episode or Home-feed calls: both providers
take a suppression hook, so the server episode-call counter that gates
deleting the old code only counts released builds.

Failure-Class: new

Co-Authored-By: Claude Opus 5.5 <[email protected]>
For an account on recordings and conversations (v3):
- Home is one flat list of conversations under day labels. The conversation
  in progress is the top row, from the live read.
- A row tile shows where the conversation is: the breathing dot while it is
  going, a spinner while its transcript arrives, a pen while its summary is
  written, then the emoji.
- A finished day label carries a chevron and opens that day summary; Today
  has none.
- Opening a conversation in progress writes its summary and streams it in,
  with a pen and "Writing your summary…" over a skeleton; another writer
  falls back to re-reading every 2 s for up to 60 s.

Accounts not on v3 see today Home unchanged (tested).

Failure-Class: new

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The live row length reads the app clock, the live summary section takes a
test stream, and the Home v3 test renders Home, the writing state and the
streamed summary.

Failure-Class: new

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- The switch has an unknown state: until its first answer the app makes no
  episode or Home-feed read, so a v3 account never makes one; a first-answer
  server error runs today Home. Both answers are remembered per account.
- The feed and episode providers re-check the switch on every read and drop
  cached episodes when it turns on; wrap-up, dismiss and open are gated.
- Capture events refresh the list on a stable key (ids, statuses, steps), at
  most every 10 s; object identities caused a refresh loop.
- The live row leads its day, honours the delete tombstone and home_hidden,
  cannot be selected for merge or bulk delete, and counts from created_at
  when started_at is missing. Recordings delivered by the socket never show.
- The live poll skips ticks while a page covers Home; one read in flight per
  account switch.
- The live summary keeps its streamed sections when the follow-up read fails,
  and polls one read at a time.

Failure-Class: new

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Tile states, the live row and the on-open summary apply only to an account
  on v3: an account rolled back keeps today Home whatever old documents say.
- Day header: 44 pt tap target and the recap recovery action failure copy.
- The tile pen reads "Writing your summary…".
- Tests: polling window asserts its exact read count, unwatch stops the poll,
  failure copy is asserted, v3-off Home asserts the live episode row; light
  theme evidence.

Failure-Class: new

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- A summary that arrives whole in the done frame stays up when the
  follow-up read fails.
- Polling has a wall-clock 60 s deadline, each read bounded by the time
  left; running out with nothing stored offers Try Again.
- The stored summary no longer flashes for a frame beside the writing state.

Failure-Class: new

Co-Authored-By: Claude Opus 5.5 <[email protected]>
One PR carries the backend and the app for v3.

Failure-Class: new

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…d pieces

Sol's generated wire decoder rejects a recording piece missing a required
field, so the round-trip test no longer feeds one through the whole
conversation; the piece reader's own drop is tested directly.

Failure-Class: new

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Failure-Class: audio-window-isolation
Relocate additive declarations so newer owner changes integrate without replacing their code. Cover the post-cleanup title fence and align the outside-query witness with cached admission.

Failure-Class: none
Declare stage and first capable build as public runtime configuration and pin their regular environment bindings across all Cloud Run services.

Failure-Class: none
…moji

Quality review: tile_state had no failed value, so a conversation whose
transcription or summary failed read as finished on v3 Home.

Failure-Class: new

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Record the 651-test component run, scope limitations and repository verification repairs. Freeze the worktree for the required full preflight.

Failure-Class: none
The compact live row from conversations/live omits finished_at, which the
generated decoder requires, so the whole read failed. On a first launch that
left the switch unresolved and held back both Homes. The switch now resolves
from the v3 flag alone; an unreadable row is no live row.

Failure-Class: new

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Git-on-my-level and others added 2 commits November 17, 2026 01:30
…s; re-arm on late audio

- has_recording_pieces: the Conversation model defaults recording_pieces to None, so ordinary
  rows written through it carry the key; only a list (even empty) selects v3 playback, in /urls,
  the artifact task and builder, and plugin backup.
- Late merges into a finished copy drop same-text lines only when they overlap the stored line
  in time; a repeated sentence a few seconds later is kept.
- update_conversation re-arms the v3 builder when audio_files land on a settled recording (sync
  finalize, merges, projection repair), so the conversation gains its recording pieces.
- The lifecycle writer inventory lists the planner's uses_custom_stt sibling field.

Failure-Class: new

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

@kodjima33 UI changes involving Git-on-my-level require your approval. Review the current diff, then comment /approve-ui 945cba1abd4574f9f0adf9a8d99b5c2e835ea8e2. Each new head needs a fresh approval. To withdraw it, comment /reject-ui <full head SHA>. Non-UI work and unrelated access are unaffected.

@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: 945cba1abd

ℹ️ 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 +161 to +162
'source': first.get('source', 'omi'),
'language': first.get('language'),

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 Preserve captured geolocation in derived conversations

For v3 recordings with a captured location, this projection copies source and language but never copies geolocation. The listen creation path still stores request.geolocation on the recording, but product readers now exclude recordings, and neither reconciliation nor summary processing restores that field on the derived row. Consequently, these conversations lose their location in detail views and Places search/counts; backfill also removes previously located conversations from those surfaces. Carry the applicable source location into the derived conversation while preserving any existing location.

Useful? React with 👍 / 👎.

Comment on lines +49 to +50
with generated_compute_scope(uid), models.notes_mode(uid, foreground=True, emit=emit):
structured, _discarded = _get_structured(uid, row.get('language') or 'en', Conversation(**row))

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 Apply the custom-STT processing allowance before streaming notes

For a custom-STT conversation whose processing credits are exhausted, opening /summary/stream calls _get_structured directly, bypassing the should_skip_omi_paid_postprocessing guard in process_conversation. When batch execution admission is disabled, the generated-compute checks explicitly return allowed, so this endpoint still purchases and persists managed summaries that normal processing refuses. Fresh evidence beyond the earlier provenance issue is this direct foreground call: retaining uses_custom_stt on the derived row does not enforce the allowance here. Apply the same custom-STT allowance check before starting foreground model work.

Useful? React with 👍 / 👎.

Comment on lines +91 to +96
owned = [line for line in lines if line['conversation_id'] == rid]
left, right = min(l['start'] for l in owned), max(l['end'] for l in owned)
for af in recording.get('audio_files') or []:
origin = playback_origin(af, recording)
duration = float(af.get('duration') or 0)
a, b = max(0.0, (left - origin).total_seconds()), min(duration, (right - origin).total_seconds())

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 Preserve disjoint audio windows when rebuilding a finished merge

When a user merges two nonadjacent conversations from the same recording, subsequent reconciliation collapses their separately claimed intervals into this single minimum-to-maximum audio window. For example, merging windows at 0–2 and 20–22 seconds produces a new piece covering 0–22 seconds, even when the conversation at 10–12 seconds belongs to another surviving item. The finished-row preservation loop then also retains the original two pieces, and audio.build_artifact concatenates all three without removing overlap. Playback/export therefore includes the unmerged conversation and repeats the selected speech. Build pieces from the separate claimed intervals and reconcile them with existing pieces without adding overlapping coverage.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Agreed this is real, but it needs a rare path (merging two non-adjacent windows of one recording, then a rebuild). Fixing it properly means building pieces from the separate claimed intervals and reconciling them with stored pieces without overlap, so it is tracked as a follow-up before v3 ramps beyond TestFlight rather than in this PR.

@Git-on-my-level

Copy link
Copy Markdown
Member Author

/approve-ui 945cba1

@Git-on-my-level
Git-on-my-level merged commit 0123298 into main Nov 16, 2026
75 of 80 checks passed
@Git-on-my-level
Git-on-my-level deleted the feat/conversations-v3 branch November 16, 2026 19:43
Git-on-my-level added a commit to Git-on-my-level/omi that referenced this pull request Nov 16, 2026
Git-on-my-level added a commit that referenced this pull request Nov 16, 2026
…e on open, keep location (#25529)

# Conversations v3 follow-up: stub-proof playback check, custom-STT
allowance on open, keep location

Failure-Class: none

Three small fixes, plus a regenerated-client catch-up, that came after
#25500 was approved. #25500 merged at its approved head, and this PR
lands them on top.

- **Backend unit shard 5 is green again.** #25500 imported a shared
`has_recording_pieces` helper from
`utils/conversations/layer.py` into the playback, sync and
plugin-backup-audio paths. Shard 5 replaces
`utils.conversations` with a stub in `sys.modules`, so that import
failed with
`ModuleNotFoundError: utils.conversations.layer`. Each caller now checks
`conversation.get('recording_pieces') is not None` itself, and the
shared helper is removed.
- **On-open summaries respect the custom-STT allowance.** A derived
conversation whose recordings used
custom STT now goes through the same
`should_skip_omi_paid_postprocessing` check as the background
path before `/summary/stream` writes notes. Before this fix, opening the
conversation could bill a
  summary that the background path had refused.
- **Derived conversations keep their location.** `planner.build()`
copies `geolocation` from the
existing row, or else from the first contributing recording, so a v3 row
keeps the place shown on its
  recordings.
- **Generated API clients are current again.** #25500 and #25524 landed
together, and main's TypeScript and
Swift clients still counted 553 methods instead of 554, which failed the
OpenAPI check on every push.
They are regenerated in a separate commit; only the total lines change.

## Verification

- `tests/unit/test_conversations_v3_engine.py` and
`tests/unit/test_conversations_v3_stream.py` have new
  cases for the location and the custom-STT refusal.
- The shard-5 file set and the full pre-push backend unit suite ran on
push.

UI-Evidence: none -- backend only

🤖 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/25529?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/25529?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F25529&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. -->
Git-on-my-level added a commit to Git-on-my-level/omi that referenced this pull request Nov 16, 2026
…5500 and BasedHardware#25524 landed together

Main's generated TypeScript and Swift clients counted 553 methods; the merged routes make 554.
Regenerated with backend/scripts/generate_ts_openapi_types.py and generate_swift_openapi_types.py;
only the total lines change.

Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>
kodjima33 added a commit that referenced this pull request Nov 16, 2026
…t windows (#25540)

A five-minute recorded-speech gap now remains a hard conversation
boundary even when the outline asks to resume the previous topic.
Continuous speech spread across short capture/reconnect pieces stays one
canonical conversation. Speaker selection is limited to the opened v3
window, and an explicit Stop cannot be swallowed by a completed live
task with the same owner-minute name.

Failure-Class: FC-textual-merge-without-chronological-precondition

## Verification

- Authoritative backend `test.sh`: 223 passed across engine, contract,
review and recording-speaker suites.
- Exactly two hours across 120 capture pieces remains one window under
reordered/reconnect input; a prior family conversation across a
15-minute gap stays separate.
- Read-only replay of the reported production timestamps verifies the
gap fence with adversarial resume output. This replay uses deterministic
outline output, not a live model or acoustic-silence proof.
- iPhone 17 Pro / iOS 26.4 simulator replay: three Home → normal detail
→ Summary/Transcript → Select → Export → Back cycles passed with
synthetic speech at the recorded timestamps; zero episode/feed calls.
Final readable captures and a 51.7-second native recording were
inspected. Native sharing is intercepted; physical hardware and live
processing latency are unverified.

- Overlapping turns cannot evade the two-hour cap by hiding a later end
behind a shorter last line; both ordinary and resumed-outline
regressions failed before and passed after the fix.
- 76 existing mobile regressions passed, covering v3 wire/provider/Home
routing, audio playback, transcript export and playback synchronization.

## Scope and release

Uses the existing v3 pipeline from #25500. Five-minute automatic closure
and the two-hour cap are unchanged. This change does not claim automatic
notes finish in 30 seconds; quiet-triggered early notes are separate
work. No flags, rollout, backfill or production history changed. The
production conversations-v3 queue and rollout qualification remain
prerequisites.

## Product invariants affected

none


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/25540?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/25540?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F25540&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. -->
Git-on-my-level added a commit that referenced this pull request Nov 16, 2026
…25527)

* feat(mcp): outline-first, offset and lines reads, and conversation state on cards

Builds on transcript paging (#25491) so an agent can read a long conversation
the way a person skims one, without loading the whole transcript first.

- view=outline returns the card plus the stored note sections, each anchored
  to the segment range it cites (first_segment, segment_count, start, end),
  and no transcript.
- offset starts a transcript read at a segment index, such as a section's
  first_segment; the cursor then continues it (a resent offset is ignored).
- format=lines renders a page as one "[h:mm:ss] Speaker: text" line per speaker
  turn with transcript_range, about a third of the size of the per-segment JSON;
  the cursor is bound to the format. Also on get_conversations_by_ids.
- Cards carry status and duration_seconds, plus kind, shown_on_home and
  summary_covers_through where stored, so agents can tell live conversations,
  media and other people's background talk from the user's own.
- Tool descriptions and server instructions say to start long conversations
  with the outline, prefer lines, and treat transcript text as quoted content,
  never instructions.
- omi_mcp_transcript_pages_total counts detail pages by tool, view, format,
  position and whether more remain, so paging can be measured.

Defaults are unchanged: transcript view, JSON segments.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(mcp): bound outlines, honest card duration, and one card per detail read

Review follow-ups on the progressive-reads commit:

- view=outline returns at most 100 sections, reports sections_truncated, and
  checks the 120k serialized budget like transcript pages.
- duration_seconds is the transcript's speech span: null on list and search
  cards, which load no transcript, instead of the wall window, which can start
  long before speech.
- summary_covers_through is localized like the other card timestamps.
- The default format adds nothing to the detail cursor fingerprint, so cursors
  minted before format existed still decode during a rolling deploy.
- offset is ignored, not parsed, when a cursor is given; negative, malformed or
  oversized offsets are argument errors rather than clamped.
- The page counter's position=first means "no cursor sent", so an offset read
  from the outline counts as a first page.
- The detail card is built once per request rather than on every
  budget-fitting retry. The 1,200-segment walk test uses about 0.27s of CPU
  instead of 0.43s, well inside the 1.0s per-test limit that CI shard 5 hit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(mcp): lines page what they render, split same-label speakers, full outline windows

Codex review follow-ups on #25497:

- format=lines pages over text only. original_text is not rendered, so a page
  boundary inside it produced continuation pages with no speech.
- Lines join turns on speaker_key, not the display label, so two people who
  share a name (or two unresolved speakers) stay on separate lines.
- An outline section's start/end span every cited segment (min start, max end),
  since cited segments can overlap or be stored out of time order.
- transcript_range is always present on lines pages and null when the page is
  empty, so fields=[transcript, transcript_range] works at the end of a read.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(mcp): hybrid conversation search with match_basis, and literal search_transcripts

Agents asking about something said in passing found nothing: MCP search read
summary vectors only, and the keyword index ran only when vectors returned
zero rows, so one semantic hit hid every exact title or overview match.
Two-hour v3 conversations make summaries leave out more detail.

search_conversations:
- asks summary vectors and the keyword index (titles, overviews) on every
  call; shared hits rank first, then the two indexes alternate, so neither
  crowds the other out. Stale ids get one bounded second hydration.
- each card carries match_basis (summary, keyword, transcript); only
  match_snippets quote the transcript, and each snippet carries segment_index,
  the get_conversation_by_id offset to read around it.
- search_coverage names what actually ran (summary_vectors_and_keyword,
  summary_vectors_only, keyword_only) plus unavailable_indexes; one index
  down still answers. No hits with the keyword index down stays a 503.

search_transcripts (new, conversations.read):
- literal words or a short phrase in saved transcripts, newest first, over
  the bounded owner/query-bound scan chat transcript recall already uses (no
  derived index, 50 records and 4s per call, signed cursor resuming after the
  last record examined).
- optional conversation_id finds where something was said in one long
  conversation; hits carry segment_index, speaker and time.
- locked, discarded, deferred and unreadable records are never quoted;
  misses are never presented as absence.

The developer search route reports the same truthful coverage.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(mcp): lines join turns only when speaker key and label both match

A segment-only speaker correction leaves adjacent rows with one diarization
key but different resolved labels; joining on the key alone attributed an
unassigned speaker's words to the user.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(mcp): transcript-free detail records keep their wall-window duration

A loaded detail with no transcript (a photo-only capture) reported a null
duration; use the shared conversation_duration_seconds wherever the
transcript is loaded, and keep list cards null.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(mcp): task-shaped agent journeys across the read tools

Four journeys chain real tool calls the way an agent would (search ->
outline -> section in lines; literal transcript hit -> read around it; a
whole long conversation by cursor; a day listing that tells media from
conversation, then a batch read) and validate every response against its
output schema and the serialized budget, so a tool that stops leading to the
next one breaks a journey.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(mcp): type the transcript hit card's structured dict for pyright

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(mcp): search fallbacks and literal matching per panel review

A summary-vector index still building is one index down: keyword search
still answers, and the index error returns only when both are down.
search_transcripts rejects dates with conversation_id (it searches the whole
conversation). A one-letter query word must appear as a word in the segment.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(mcp): bound search_transcripts by serialized size; count keyword-down fallbacks

A page of large (or escaped CJK) hits stops before the 120000-character
serialized budget and resumes at the first conversation it left out.
Keyword or vector index loss now records the degraded fallback even when
other hits survive.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* chore(openapi): regenerate client method totals after #25524 and #25500

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(mcp): full stale-id backfill, deferred check on scoped reads, legacy segment index

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(mcp): transcript search deadline, unreadable fallback, all-words snippet window

Matching gets 2s after the 4s scan (chat's 6s overall) and resumes after the
last finished record; unreadable records record a degraded fallback; a long
segment is clipped around the shortest stretch holding every query word.
Developer changelog entries for #25497, #25524 and this PR.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(mcp): report an unconfigured vector index and unreadable records as partial coverage

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Git-on-my-level added a commit that referenced this pull request Nov 16, 2026
…5534)

## Problem and change
Short pendant BLE links currently mint a new client recording at every
connect. Keep one coordinator-owned recording for 120 seconds after a
classified connection timeout or remote termination, and restore it only
for the same device strictly before the deadline. Preserve transport and
pause intent; manual stop/disconnect, source/mode/device/account changes
and process restart retire reuse.

Link loss reaches capture before the provider's 500 ms UI debounce.
Physical teardown, WAL tail finalization and normal ingress restart
remain in place. Early post-reconnect orphan frames still enter the
safety WAL before the provider publishes its device mirror; account
identity is checked as well as device identity; competing
provider/recovery starts join the same owner. Existing Recording
Observation telemetry distinguishes `reconnect_resumed` from
`reconnect_grace_expired_fresh` without claiming gap audio recovery or
another Recording Started.

Panel follow-ups bind the active recording to its original account
before any disconnect, make duplicate starts a true no-op, emit
call-deferred reconnect observations only at capture restoration, clear
stale success diagnostics, and fence automatic policy restoration
against the live call state after an awaited marker write.
Manual-disconnect markers now belong only to a connected episode:
already-down actions retire capture without poisoning the next
connection, live markers survive metadata refresh, and ID casing is
normalized. Refused phone handoffs retain the existing grace through the
original admission reducer instead of retiring it before rejection. The
final follow-up rechecks live call ownership after every awaited
reconnect effect, invalidates pending physical setup and fences BLE
callbacks while a call is active, and revokes native ingress
immediately; expiry retires stale automatic-pause markers while
preserving manual mute. Regression cases reproduced the reported
failures before the fixes.

## Server and v3 compatibility
Live listen continuation already resolves the retained origin/client ID
with source/device/lifecycle checks. For `batch_live_v1`, main's
flag-off `resumable_after_drop` path commits the archive tail and
retains an eligible mobile row when committed audio and a durable
quiet-check owner exist. Existing tests prove teardown plus a same-ID
reconnect at 35 seconds. Source at David's supplied serving SHA
`235baea` also contains this legacy runtime branch and the live
resolver; this was checked from Git without production access.
Empty/uncommitted, terminal, privacy-fenced or quiet-owner-unavailable
rows can still create a new server conversation: client identity reuse
does not override those boundaries.

`LISTEN_BATCH_RECONNECT_ENABLED=true` is not required for this existing
batch continuation path. Do not activate its stronger producer-grace
protocol without Release's mandatory all-old-listeners-and-sockets drain
gate. In-repo activation inputs are
`backend/deploy/runtime_env/prod.overlay.yaml`: GKE `backend-listen.env`
and Cloud Run `backend-sync.env`, followed by `python3
backend/deploy/compose_runtime_env.py` and Release's train. Use `{value:
'true', category: rollout}`; default grace is already 120s. Ramp, clean
metrics, owner, November 20 review and false/drain/zero-marked-row
rollback live in `config/feature-flags.yaml` and
`backend/docs/listen_pusher_pipeline/changes/2026-11-16-batch-reconnect-grace.md`.
This PR changes no server code or env and makes no fleet-drain claim.

Read PR #25500's full diff. No touched capture/device files overlap. Its
v3 projection folds recording IDs and time-range pieces, including
multiple pieces from one recording; the preserved identity keeps that
input contract. Did not alter its branch. Cross-PR rendered/device
integration remains a Release acceptance item.

## Verification
All heavy commands run through
`/Users/dazheng/workspace/omi/bin/omi-heavy run --`.

- Before coordinator changes, the new short-reconnect regression failed:
expected `pendant_live_1`, got `pendant_live_2`; the existing tests
passed.
- Pinned Flutter 3.44.5: `flutter test
test/services/capture/capture_coordinator_test.dart
test/services/capture/tiered_capture_test.dart
test/services/capture/resume_sync_fence_test.dart
test/providers/device_provider_disconnect_telemetry_test.dart
test/services/bridges/ble_bridge_test.dart
test/unit/recording_lifecycle_telemetry_test.dart` — 217 passed across
coordinator, retention/sync-fence, provider classification, bridge and
lifecycle suites. Includes exact/after expiry, same/wrong device, manual
stops, mute/unmute, duplicates, calls, account reset, permission
refusal, snapshot/launch and actual controller/WAL/socket identity.
- Pinned `flutter analyze` on all 12 touched Dart files — no issues;
`dart format -l 120` with pinned SDK — clean.
- `env PYTHONPATH=backend backend/.venv/bin/python -m pytest -q
backend/tests/unit/test_listen_reconnect_continuity.py
backend/tests/unit/test_mobile_batch_disconnect.py
backend/tests/unit/test_listen_batch_reconnect_grace.py` — 110 passed
(17 existing async-mock warnings).
- `env PYTHONPATH=backend backend/.venv/bin/python -m pytest -q
backend/tests/unit/test_conversations_v3_engine.py` — 37 passed,
including repeated speech within one recording, long recording splits
and playback-piece trims. Fresh #25500 head
`945cba1abd4574f9f0adf9a8d99b5c2e835ea8e2` has zero touched-file
overlap.
- `ruby app/ios/test/omi_ble_connection_policy_test.rb` — 2 tests, 4
assertions passed, including the production manager callback with manual
precedence.
- Android `:app:testDevDebugUnitTest --tests
com.friend.ios.ble.DeviceDiagnosticsContractTest --no-daemon` using
cached Gradle 8.14.2 and JDK 21 — passed (JDK 21, Gradle 8.14.2, full
app/test Kotlin compilation; build successful in 10m57s).
- `make preflight`, `scripts/pr-preflight --suggest` and
`scripts/pr-preflight --pr-body-file
/Volumes/Ephemeral/scratch/lane-b-pr-body.md` — both local and PR-body
gates passed all 35 selected checks (53s / 57s).

No production account data/config was read or changed; GCP tier: none.
No device build, production deployment, lost-frame recovery or measured
reduction in conversation amplification is claimed. Genuine setup
exceptions keep the existing tested fail-closed retirement semantics;
this change does not hide failed setup by automatically retrying it.
Remaining risk: platform/device acceptance and v3 integration; server
finalization boundaries can still split conversations.

Failure-Class: FC-transport-drop-terminalizes-resumable-capture
UI-Evidence: none

## Product invariants affected

- INV-CAP-1 — preserve teardown/WAL custody and post-reconnect orphan
persistence; both named guard suites run. Identity continuity is not gap
recovery.

Line-Count-Exception: app/lib/providers/device_provider.dart | 1734 ->
1754 | Forward capture link loss before the UI debounce using the
existing provider connection callbacks.

Line-Count-Exception: app/lib/services/capture/capture_controller.dart |
4969 -> 5030 | Wire typed coordinator grace to the existing lifetime
timer and recording telemetry ports.

Line-Count-Exception: app/lib/services/capture/capture_coordinator.dart
| 3026 -> 3258 | Keep reconnect identity and its deadline in the
existing typed state and serialized reducers alongside call suspension.

## Review provenance

Full panel `review-20261116t205911-a99e` reviewed `db907642d4a`: all
eight findings triaged (seven accepted and addressed; clean/nil-error
expansion rejected as outside the requested cause scope, already
documented). Follow-up `review-20261116t212210-5d11` reviewed
`3f9ab5dc0e6`: all six findings accepted and addressed. Delta panel
`review-20261116t214804-68ba` reviewed `78436be0b067`: all three
findings accepted and addressed, covering call preemption during awaited
reconnect setup, expired manual pause versus stale automatic resume, and
stale diagnostic clearing. Its DeepSeek member failed without an answer
and is not counted as approval. Panel `review-20261116t222543-d1e4`
found an additional installed-listener call admission gap, reproduced by
a real-controller held-registration regression (expected zero frames,
got one). The follow-up fences that callback with live call state and
immediately revokes native ingress. A later delta review found that a
permanent callback revision could strand initial audio after a
fast-failing call; a new held-registration test reproduced it, and the
permanent revision fence was removed while retaining live-call admission
and reconnect setup invalidation. The two-member panel completed: its
listener finding was accepted and fixed; its diagnostic-only test nit
was rejected as duplicating a straightforward assignment rather than
discriminating the asynchronous behavior at risk. Both findings are
triaged. Delta panel `review-20261116t223502-ad11` has a GLM
SHIP-with-minor result: the fast-call listener finding is fixed with a
failing-before regression; its optional native authorization harness nit
remains an explicit coverage gap. Both findings are triaged; its
outstanding Luna member was cancelled after the target was superseded,
so that panel is incomplete and does not count as SHIP. Panel
`review-20261116t224745-74c9` completed on `8822c421198`: Luna SHIP; GLM
identified the reconnect fast-call failure plus its missing regression.
Both findings are accepted and fixed in `b52f7d5268e`. A further
real-controller probe reproduced a call that starts and ends during
reconnect setup dropping the original recording ID to null. A typed
environment call epoch now preserves that interruption through the await
and enters ordinary call suspension/release, restoring the same ID. Its
failing-before regression now passes. Exact-head delta panel
`review-20261116t225138-7c67` completed on `b52f7d5268e`: GLM SHIP, Luna
FIX-FIRST on retaining identity after a genuine setup exception. F1 is
rejected and triaged: the existing real-controller setup-failure tests
require fail-closed retirement; no causal path from ordinary call
notification to that exception was established, and automatic retry of
failed setup changes that safety boundary. Successful-return fast-call
interruption is independently checked and covered. The raw panel verdict
is mixed; this is not unanimous approval. Hardware/native-channel
acceptance remains unverified. No initial failed/aborted panel is
counted as approval.
Git-on-my-level added a commit that referenced this pull request Nov 17, 2026
…name__

#25500 declared six conversations composite indexes without a trailing
__name__ field. Firestore creates them with __name__ appended, and the
readiness checker only aliases an implicit __name__ for historic
signatures, so it reported all six MISSING even once they were READY.
Every pusher dev qualification failed at "Verify serving Firestore
indexes" because of this, and the next prod backend deploy would too.

Declare __name__ explicitly and regenerate firestore.indexes.json.

Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Git-on-my-level added a commit that referenced this pull request Nov 17, 2026
…name__ (#25551)

## Summary
#25500 declared six `conversations` composite indexes in
`backend/database/firestore_index_registry.py` without a trailing
`__name__`:

- `conversations_v3_pending_capture_continuation`
- `conversations_v3_pending_oldest_page`
- `conversations_v3_active_legacy_meter`
- `conversations_v3_derived_window`
- `conversations_v3_geolocation_count`
- `conversations_v3_day_count`

Firestore stores each of them with `__name__` appended. The readiness
checker (`reconcile_firestore_indexes.py --check-only`) does an exact
signature match and only aliases an implicit `__name__` for
`HISTORIC_IMPLICIT_DOCUMENT_ID_SIGNATURES`. So it reported all six as
MISSING even after they were READY in dev.

This blocked every pusher dev qualification at "Verify serving Firestore
indexes" (runs 43954955756 and 43981331203). It will block the next prod
backend deploy as well.

This PR adds `_asc('__name__')` to those six entries and regenerates
`firestore.indexes.json` with `generate_firestore_indexes.py --write`.

## Verification
- `reconcile_firestore_indexes.py --check-only` against
based-hardware-dev with this manifest: "Firestore index readiness
passed: 304 composite indexes and 29 field overrides READY".
- `pytest tests/unit/test_firestore_query_shapes.py`: 607 passed.
- Unit tests that reference the registry, manifest or reconcile script
also pass.

## CI unblock (test-only)
Shard 3 failed twice on CPU-guard tests in files this PR does not touch:
-
`test_conversation_terminal_family.py::test_retry_triggers_never_replace_explicit_restore_authority[False-server_recovery]`:
1.05s, then 1.42s. The first case paid the module imports. They now load
at collection, and the case measures 0.06-0.13s.
-
`test_mcp_conversation_detail_paging.py::test_walk_1200_segments_once_with_one_existing_read_per_page`:
1.02-1.07s on CI against about 0.3s locally. This is real paging work,
so it is allowlisted with that evidence.

## Rollout note
Prod still lacks these six indexes. They have to be applied with
`gcp_firestore_indexes.yml` (prod, composite-indexes) before this
manifest lets a prod deploy pass readiness.

Failure-Class: none

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Git-on-my-level added a commit that referenced this pull request Nov 17, 2026
Fix the conflicting pending-audio amounts and disconnect diagnostics.
One pending WAL display view applies the existing stale-handle deadline
and device-copy folding across On the Way, Sync details, Offline Sync
and the device Catching up contribution. Server-reported work has a
separate On the Way section. Uploaded audio is labelled "Uploaded,
awaiting server" rather than inferred to be transcribing.

Expired upload handles show "Transcription unavailable" in both Offline
Sync implementations, with a direct details route that remains reachable
from Device Settings even when nothing active remains. The provider
schedules an expiry notification for mounted screens and cancels it on
disposal. This includes over-window captures, while preserving every WAL
status, file, retry and audio custody decision. Recent server
confirmation can restore the pending display. The banner keeps its
documented active-run progress snapshot.

Diagnostics count every non-manual disconnect within the retained
window, including rows without a reconnect time or a native window
anchor. UI and export share the window predicate, including the
future-row exclusion; lifetime reconnections remain separate. Reconnect
latency excludes manual, failed-connect and audio-recovery events. iOS
reads the disconnect clock once and both platforms persist the event
timestamp separately from audio-outage accounting and retain connection
history across restart. Lifetime history is correctly labelled
reconnections. The bounded seven-day native ring grows from 500 to 4096
rows. Dated synthetic macOS serialization evidence is in
`app/docs/evidence/2026-11-17-sync-ring-serialization.json`; phone
event-loop latency is not measured.

Failure-Class: FC-same-subject-counted-once-per-evidence-source
UI-Evidence:
.agent-artifacts/ui-evidence/sync-display-truth/evidence.json

## Product invariants affected

- INV-CAP-1: derived display expiry never mutates WAL/audio custody or
deletion rights.
- INV-UI-1: shared neutral UI primitives and existing attention styling.
- INV-UI-3: existing settings groups, rows, sheet and navigation
primitives.
- INV-PERF-1: pending inventory is memoized with mutation and deadline
invalidation.

## Validation

Local verification: the 186-test/17-file focused suite passed at the
full product-review head; the final follow-up passes 46 tests across
four files. Analyzer is clean on the latest four affected Dart files and
the two fixture files. The render tests, 10-test expiry rollback run,
native Swift harnesses, localization check, and 17 Android diagnostics
tests pass. The final Android key-retirement rerun reports zero
failures/errors/skips.


- Failing-first: focused regressions run with original production Dart
files at 695bf22. Stale pending inventory, over-window upload
presentation and unrecovered drop expectations fail; the same focused
tests pass with the fix.
- `omi-heavy run -- flutter analyze --no-pub <touched Dart files>`:
clean.
- `omi-heavy run -- dart format -l 120 <touched Dart files>`.
- `omi-heavy run -- flutter test --no-pub --timeout 90s
test/unit/wal_derived_views_test.dart
test/unit/catch_up_seconds_test.dart
test/widgets/on_the_way_days_test.dart
test/widgets/device_diagnostics_window_test.dart
test/widgets/device_catching_up_test.dart
test/widgets/sync_completion_truth_test.dart`.
- `omi-heavy run -- flutter test --no-pub
test/widgets/home_pending_row_test.dart
test/pages/conversations/offline_sync_recording_blocks_test.dart
test/widgets/offline_sync_storage_contrast_test.dart
test/widgets/sync_edge_throttle_render_test.dart`.
- `omi-heavy run -- flutter test --no-pub
--dart-define=OMI_CATCH_UP_STALE_HANDLE_OFF=true
test/unit/catch_up_seconds_test.dart`: rollback behavior.
- `omi-heavy run -- flutter test --no-pub --timeout 90s
--dart-define=OMI_SYNC_UI_EVIDENCE_DIR=../.agent-artifacts/ui-evidence/sync-display-truth
test/widgets/sync_display_truth_render_test.dart`: real widgets, SF Pro
fonts, iOS metrics, synthetic data; screenshots visually inspected.
- `omi-heavy run -- ruby app/ios/test/device_health_store_test.rb`:
compiled Swift assertions exercise persisted connection history, the row
timestamp differing from the audio marker, exact backfill and
retirement. `omi-heavy run -- ruby
app/ios/test/omi_ble_energy_policy_test.rb`: 6 runs, 12 assertions, zero
failures. No Xcode unit-test target is present in
app/ios/Runner.xcodeproj/project.pbxproj; these regressions use the
existing Ruby-to-swiftc native test harnesses.
- `omi-heavy run -- <cached Gradle 8.14.2>/bin/gradle -p app/android
:app:testDevDebugUnitTest --tests '*DeviceDiagnosticsContractTest'
--tests '*FeedbackDiagnosticsServiceParityTest'`: BUILD SUCCESSFUL; 17
tests, zero failures/skips. The fresh worktree has no gradlew, so this
uses the cached exact version in gradle-wrapper.properties. The
corrected consent-scope tests were rerun with --no-daemon: BUILD
SUCCESSFUL.
- `python3 app/scripts/l10n.py check`: all locale translations and
generated freshness checked through the app localization workflow.
- `OMI_PR_BODY_FILE=/tmp/lane-g-body.md omi-heavy run -- make
preflight`: 38 selected checks passed. The normal bounded pre-push gate
also passed on the pushed head, including formatting and generated
localization output.
- `omi-heavy run -- flutter test --no-pub
test/unit/offline_processing_display_test.dart
test/providers/sync_provider_derived_views_test.dart
test/perf/sync_indicator_isolation_test.dart
test/pages/conversations/sync_attention_evidence_test.dart`: 27 tests
passed. Active upload fixtures explicitly stamp uploadedAt; stale
unstamped handles are covered separately.

## Scope and remaining limits

Re-read PR #25500's current diff without modifying it or its branch.
Overlap is limited to localization ARBs and generated localizations;
only the stage label, lifetime footer and one server-work section label
change there. No backend source changed. No production account data was
read or changed. GCP tier: none.

Backend follow-up: pending_conversations has no general capture-age
bound; the optional Home projection applies separate deadlines.
Server-only rows can still be old until the backend owner settles them.
Existing lost lifetime reconnects/evicted rows cannot be reconstructed,
and event storms beyond 4096 retained rows can still truncate the week.
The first three-member panel review at 5e1763c returned 19
findings; all were accepted and triaged with omi-panel, and the
corrections are included for re-review. This PR establishes local
automated and render evidence; physical iOS/Android pendant acceptance
and production telemetry reconciliation remain unverified.

## Render evidence

Synthetic widget captures use SF Pro and iOS metrics. In the Device
Settings capture, the widget engine leaves the device illustration area
blank; the changed details row is visible.


![On the
Way](https://raw.githubusercontent.com/BasedHardware/omi/c5b499af466f02e0a104fd777731a8fc6edb64c0/.agent-artifacts/ui-evidence/sync-display-truth/001-mobile-ios-pending-work-truth.png)

![Sync
details](https://raw.githubusercontent.com/BasedHardware/omi/c5b499af466f02e0a104fd777731a8fc6edb64c0/.agent-artifacts/ui-evidence/sync-display-truth/002-mobile-ios-sync-details-truth.png)

![Offline
Sync](https://raw.githubusercontent.com/BasedHardware/omi/c5b499af466f02e0a104fd777731a8fc6edb64c0/.agent-artifacts/ui-evidence/sync-display-truth/003-mobile-ios-sync-banner-truth.png)


![Stalled upload
details](https://raw.githubusercontent.com/BasedHardware/omi/c5b499af466f02e0a104fd777731a8fc6edb64c0/.agent-artifacts/ui-evidence/sync-display-truth/004-mobile-ios-stalled-upload-details.png)

## Review disposition

Correction panel `review-20261117t090048-8c0b`: Luna, DeepSeek and GLM
Flash all returned SHIP at `c5b499af466f02e0a104fd777731a8fc6edb64c0`;
no blocking findings. Every finding was triaged through `omi-panel
triage`. The stale-body statement identified in the review packet has
been removed from this PR body.

Nonblocking follow-ups remain: the legacy zero-duration stage label;
upper bounds for future-dated failed-connection verdict rows; test-only
mixed-clock API consistency; one iOS test assertion and one stale field
comment. The support bundle retains the legacy
`reconnection_count_window` name while its value follows the window's
drop predicate; lifetime `reconnection_count` is a separate reconnect
counter. Phone-side ring latency remains an explicit qualification gap.
The suggestion to add uncertain server durations back into the WAL tile
was rejected because this lane requires one WAL amount and separately
labelled server work.

Final validation target: `f2a34d8f3a4c7a198cedd8bbbf736d1651d3c75d`.
Ready recordings retain their primary Sync action when expired uploads
coexist; the stale rows remain visible and unchanged in custody. Both
new regressions fail before the banner reorder and pass afterward.
Android identity retirement now directly asserts deletion of both
persisted keys. Support export tests pin null window anchors while
counting retained unrecovered drops. The original uploadedAt and Home
Transcript fixture corrections remain minimal.

Follow-up commands: `omi-heavy run -- flutter test --no-pub
test/widgets/sync_completion_truth_test.dart
test/widgets/device_diagnostics_send_support_test.dart
test/widgets/home_row_contract_render_test.dart
test/providers/sync_provider_background_admission_test.dart` (46
passed); `omi-heavy run -- flutter analyze --no-pub
lib/pages/conversations/auto_sync_page.dart
lib/pages/conversations/sync_page.dart
test/widgets/sync_completion_truth_test.dart
test/widgets/device_diagnostics_send_support_test.dart` (clean); `dart
format -l 120` on those files. The selected Android17 diagnostics tests
pass with the stronger key-retirement checks. New real-widget renders
were visually inspected on both Offline Sync implementations.

The c5 full correction panel returned three SHIP reviews. The
intermediate test-only c0d panel returned two SHIP reviews and no
findings; its third reviewer failed before launch with `journal_busy`,
which is not counted as a review. All six findings from the intervening
panel were triaged: the midnight fixture variants were removed,
retirement/unknown-anchor assertions strengthened and ready-action
priority corrected; the restoration overcount and vanished-legacy-row
claims were rejected with current code/test evidence. The final priority
follow-up is awaiting its exact-head panel and technical CI. The PR
remains unmerged; UI author approval awaits David or Nik.

![Automatic ready action with a stalled
upload](https://raw.githubusercontent.com/BasedHardware/omi/f2a34d8f3a4c7a198cedd8bbbf736d1651d3c75d/.agent-artifacts/ui-evidence/sync-display-truth/005-mobile-ios-sync-ready-with-stalled-upload.png)

![Legacy ready action with a stalled
upload](https://raw.githubusercontent.com/BasedHardware/omi/f2a34d8f3a4c7a198cedd8bbbf736d1651d3c75d/.agent-artifacts/ui-evidence/sync-display-truth/006-mobile-ios-legacy-ready-with-stalled-upload.png)


## Final panel follow-up (aca1fea)

Panel `review-20261117t104923-1d55` at `f2a34d8f3a` returned SHIP
(DeepSeek, GLM Flash; Luna failed to launch). All 12 findings were
triaged:
- **Accepted and fixed:**
  - legacy banner zero-length title (F1);
- native disconnect history capped at 1024 rows, about one week at p90
fleet drop rates, which bounds the synchronous per-disconnect rewrite
(F2/F3);
  - Android test renamed to what it actually pins (F4);
  - Catching up doc (F5);
- manual disconnects no longer seed reconnect markers on iOS/Android
(F6);
  - stalled uploads no longer also listed as server work (F7);
- pending-work expiry scheduled in the caller's timebase with a 1 s
floor (F9);
  - portable benchmark path (F10);
  - two unused strings removed from 49 locales (F11);
  - comment (F12).
- **Rejected:** F8. The backend validator branches on `schema_version ==
3`, and the window field's meaning is documented.
- **Tests:**
- New regression: `an injected past clock never re-arms a zero-delay
expiry loop` fails on the old code (3 notifications vs 0) and passes.
- Focused suite: 84 passed, including
`local_wal_live_custody_test.dart`. That test failed once in CI on
`f2a34d8` (#20376); it is known-flaky and untouched here.
- `flutter analyze` is clean, and `l10n.py check` reports 49 locales OK.
Git-on-my-level added a commit that referenced this pull request Nov 17, 2026
…5573)

With single-owner proof, recover eligible unindexed phone audio into
`miss`, oldest first. David's 2026-11-17 ruling permits automatic upload
only when no current/backup/tmp/quarantined generation or
live/retired/foreign bucket shows local-only/held history, and the
account permits cloud upload. Otherwise the recovered row is held for
explicit user action. Unknown ownership remains retained and
unpublished. **This PR never deletes or rewrites audio.**

Failure-Class: FC-phone-durable-pendant-proof
UI-Evidence: none
Line-Count-Exception: app/lib/services/wals/local_wal_sync.dart | 2909
-> 2947 | Wire ledger-owned recovery, paced foreground wakes and
read-only inventory policy flags; recovery/classification remain
separate parts.
Line-Count-Exception: app/lib/services/wals/wal.dart | 1324 -> 1345 |
Persist a recovered-orphan marker and stable filename-hash identity so
same-second files do not share playback/share caches; existing ids and
source filenames stay unchanged.

## Product invariants affected

- INV-CAP-1 — retain unconfirmed bytes; uncertain ownership, consent or
references cannot grant automatic adoption/upload.
- INV-PERF-1 — census JSON/framing stays off the capture queue/off UI;
final metadata checks are bounded.
- `app/lib/services/wals/CUSTODY.md` — one ledger/uploader, held
explicit actions, no orphan deletion here.

## Behavior

- Read-only census covers every index generation, active/retired/foreign
memory, ring checkpoints/download receipts, batch journals, native owner
receipts, legacy pending-file/job preferences and capture-committed
journal owners. Every observed owner must be current, with at least one
index/memory witness. Receipts alone or ownerless legacy inputs do not
prove ownership.
- Carry local-only/held flags from every generation and memory bucket.
Optional legacy flags retain Wal.fromJson's defined false defaults;
non-null malformed flags hold. Read raw preferences, never repairing
getters: offline auto-sync off, Custom STT/on-device choice,
malformed/non-string/quarantined policy,
keep-everything/save-live-hours/overflow or selected local route all
hold. Recheck raw custody inputs, consent and memory after budget I/O
before publication.
- Unknown storage enums, malformed paths, missing/empty disk paths and
malformed custody preferences prevent complete census. Strict ring
schema covers persisted version 1, ranges, refs, batch sessions and
download receipts; ownerless valid refs still reserve files. Unreadable
quarantined indexes intentionally defer adoption until repair; do not
prune custody evidence to manufacture certainty.
- Classify working (.part/.torn/omibatch/omimobilebatch), unparseable,
recoverable, expired and owner_unknown. Admission requires known mono
producer naming, plausible clock and strict complete frames. Preserve
supported fractional/collision/clock-run suffixes, original basename,
device and time. New rows persist recovered_orphan=true and use stable
basename-hash ids so distinct same-second files have separate audio
caches/upload attempts. Existing ids remain unchanged.
- Caps: 200 oldest/pass, 400/rolling 24h, 720 pending across buckets.
Fsync UID-scoped device-local reservations before publication;
uncertain/unused spend remains reserved. One batched index save. Failed
saves roll back only unpublished same-generation rows, retaining audio
and reservation. A successful same-owner save publishes the view
revision despite a late background/admission transition; changed
generation fences the successor account.
- Commit rechecks flag, raw preferences, all references/owners, source
stamps, file type/size/mtime/ctime, age and pressure. More than 512
sources/four directories defers bounded commit. Configured files outside
Documents are classified but retained, filtered before budget
reservation.
- No startup discovery or second uploader/timer. Existing resume/timer
wakes coalesce at 15 minutes; headless, stopped/background,
admission-pending and changed UID/generation fence the pass. Positive
framing cache requires unchanged path/size/mtime/ctime, prunes to
current corpus, retries zero/error reads, clears on stop/reset and is
reused by support export while references refresh.
- orphan_audio_recovery_off=true stops new adoption, including a
response settling during budget I/O. Unknown/false keeps non-destructive
recovery on. Held rows stay out of every automatic drain, refused-upload
retries and shared clock-recovery budget. Existing Process now/confirmed
Delete act explicitly. Server expiry/refusal persists failure and
retains bytes.
- One typed aggregate Orphan Audio Recovery event/pass: class/age counts
and bytes, admissions/skips and bounded result. No paths, filenames,
owner IDs or per-file details enter exported diagnostics/events.

## Validation

Head `b6a9647bcb18f63f38f36ca38c2f5ce3a0b44666`: **180 focused tests
pass; final two-file analyzer clean, with the other 13 PR-changed Dart
files unchanged since all 15 were clean; format/diff checks pass; all 34
preflight checks pass (139.78s); normal pre-push/generated-output gate
passes.** Hermetic fixtures only, pinned Flutter 3.44.5 / Dart 3.12.2.
Heavy commands run through `/Users/dazheng/workspace/omi/bin/omi-heavy
run --`.

```sh
# app/, pinned SDK on PATH
flutter test --no-pub test/unit/wal_orphan_recovery_test.dart test/unit/orphan_inventory_contract_test.dart test/unit/recording_inventory_test.dart test/unit/ring_custody_diagnostics_test.dart test/unit/wal_startup_admission_test.dart test/unit/local_recordings_auto_upload_test.dart test/unit/sync_recording_share_drain_test.dart --reporter expanded
flutter test --no-pub test/unit/wal_orphan_recovery_test.dart test/unit/sync_recording_share_drain_test.dart --reporter expanded
flutter analyze --no-pub lib/providers/sync_provider.dart lib/services/experiments/orphan_audio_recovery.dart lib/services/wals/local_wal_sync.dart lib/services/wals/orphan_audio_classifier.dart lib/services/wals/recording_inventory.dart lib/services/wals/recording_inventory_sources.dart lib/services/wals/ring_custody_export.dart lib/services/wals/wal.dart lib/services/wals/wal_orphan_recovery.dart lib/services/wals/wal_policy.dart lib/utils/analytics/registry/events.g.dart test/unit/orphan_inventory_contract_test.dart test/unit/recording_inventory_test.dart test/unit/sync_recording_share_drain_test.dart test/unit/wal_orphan_recovery_test.dart
# root
# dart format -l 120 was run on changed Dart files; no remaining changes
git diff --check
OMI_PR_BODY_FILE=/Volumes/Ephemeral/scratch/lane-f-ruling-body.md make preflight
```

Regressions failed before their fixes: clean-phone automatic policy;
durable/malformed STT choices; malformed legacy/ring inputs; seven
ambiguous WAL-reference schemas; distinct same-second recovered ids
(five files had three ids). Actual index reload now preserves five
distinct ids and legacy id stability. Removing the held-budget guard
makes its persisted-counter test fail (35 becomes36); the mutation was
restored and guard suite passes. Tests also cover all
generations/buckets, consent/reference races, real persisted ring
envelope, actual delta-worker failure/rollback/durable retry,
save/background publication, caps, startup no-discovery, retained bytes
and 3,000-file framing-cache reuse.

## Reviews

Every returned finding is CLI-triaged. Fresh exact-head review
`review-20261117t124527-9387` is running on `7229be5`; CI is separate
and running on that head. Do not merge.

- Original panels `review-20261117t054947-82dc`,
`review-20261117t074637-8215`, `review-20261117t082949-9e51`: accepted
fixes for consent/ownership, framing cache/outside-root filtering,
producer suffixes/fresh age.
- `review-20261117t085532-dc2c`: SHIP; rollback/export fixes accepted;
resetting other-owner reservations rejected.
- `review-20261117t093651-83d9`: explicit manual retry was pre-existing,
event spelling was style-only; rejected with source evidence.
- `review-20261117t102334-0a22`: raw consent, strict ring, raw legacy
completeness/revalidation, publication and privacy guards fixed.
Resetting unknown/spent quota and treating invalid clocks as expiry
rejected.
- `review-20261117t110240-5324`: accepted real
delta-failure/local-route/ring-store guards and documented archive
bound. Legacy optional-false defaults and actual saveJson version
envelope verified; phone-wide pacing, cold-I/O and conservative quota
retained.
- `review-20261117t114059-3f6b`: returned storage/path finding
accepted/fixed; second member hit its 35-minute deadline and was
cancelled by execution ID. Partial coverage disclosed.
- `review-20261117t121258-b3e9`: both answers collected. F3/F4
accepted/fixed (durable per-file id; held budget guard). F1 pruning
unknown archives rejected as unsafe; F2 unproven-owner adoption rejected
against David's retained single-owner rule; F5 rejected with source
lines 468-470, already including active/retired/foreign witnesses. No
finding untriaged.

Adoption scope `scope-20261117t094122-0ab7` found durable STT consent,
fixed. Reclaim scope `scope-20261117t094355-77d5` is complete for the
separate stacked PR; deletion is not included here.

## Risk and rollback

Original-phone acceptance, device-scale timing/cache memory and actual
uploads/storage outcomes are unmeasured. Cold/malformed framing costs
I/O. Unknown index archives/schemas/preferences can defer or hold
recovery; >512 sources defers commit. Malformed budget requires repair;
spent reservations age out without zero-reset. Existing
preference-quarantine pruning removes archives after seven days, then
defined current defaults apply; this creates no permanent
unknown-consent marker. Unknown clocks and old/outside-root files remain
retained.

Set orphan_audio_recovery_off=true or revert to stop new adoption.
Already-admitted rows keep their hold/automatic policy; normal
confirmation/retention still governs bytes. No production account read,
GCP tier, deployment, merge or physical-device/reclaimed-space claim. PR
#25500 untouched.

Latest raw-STT fix tree: 35 additional malformed Omi-config cases failed
before this fix. Validate the complete current serialized shape
(including nullable text, port, request kind, string maps and response
schema); unknown fields or malformed structured data hold rather than
granting cloud consent. Valid complete/default Omi configs still
auto-adopt. All 180 focused tests pass; final two-file analyzer clean.
This accepted finding came from review-20261117t124527-9387; remaining
answer/CLI triage and final exact-head re-review follow.

Review review-20261117t124527-9387 completed with both answers; sole F1
raw-config finding accepted and fixed with 35 before-failing regressions
and two canonical positive fixtures. CLI triage has no missing findings.
Latest pushed head b6a9647; No merge or
production access.



## Final review (lead takeover)

Panel `review-20261117t132116-87a5` reviewed `b6a9647`. Luna returned
one blocking finding: the automatic-upload hold could miss on-device
overflow retention during the window before its preference write landed.
It was accepted and fixed: the hold now also checks
`OnDeviceTranscriptionController.instance.shouldKeepAudioLocal`, the
same pattern the ledger uses at `local_wal_sync.dart:2058`. The change
is fail-closed, since it can only hold more files, never upload more. No
new unit test was added: the controller is a process singleton with no
injection seam in this suite. The DeepSeek member exited with code 2, so
there was no review from it.

Focused suite (wal_orphan_recovery, wal_startup_admission,
recording_inventory): 142 passed. Analyzer clean. This is the ninth
panel round on this PR; every finding is triaged.
Git-on-my-level added a commit that referenced this pull request Nov 17, 2026
Automatically reclaim stranded Documents audio only with a complete
#25573 census, no reference in any index generation, memory bucket,
ring, batch journal, owner receipt or held row, and both filename
capture time and mtime strictly older than 45 days. Working files stay
retained. David’s 2026-11-17 ruling item 2 explicitly permits
multi-account phones.

Depends on #25573 (merged 2026-11-17 at 14:12 UTC). This lane started
from its exact head 80bd311 and targets
main. Do not merge this PR.

Failure-Class: FC-phone-durable-pendant-proof
UI-Evidence: none
Line-Count-Exception: app/lib/services/wals/local_wal_sync.dart | 2947
-> 2959 | Wire ledger-owned reclaim test seams and part; deletion
remains in its separate part.
Line-Count-Exception: app/lib/services/wals/recording_inventory.dart |
519 -> 520 | Import the canonical capture-committed receipt parser for
strict off-UI census validation in its existing part.

## Product invariants affected

- INV-CAP-1 — add the dated ruling’s explicit aged, entirely
unreferenced orphan exception; indexed/held/foreign files remain
protected.
- INV-PERF-1 — census stays outside capture queue, capped 200/pass with
five-file queue turns and yields; bounded synchronous metadata/unlinks
close the race, with durable batch checkpoints outside the capture
queue.
- INV-UI-3 — no UI changes or alarming user flow; aggregate diagnostics
only.
- `app/lib/services/wals/CUSTODY.md` — one ledger owns deletion,
session/admission/foreground fences, tombstone lifecycle.

## Behavior and durability

Reuses census/classifier reference proof independently of recovery’s
single-owner gate. After durable batch intent and a resolved flag read,
rechecks generation, UID, admission, headless/lifecycle, raw legacy
preferences, every source/directory stamp, current memory and legacy
basename references, file type/size/mtime/ctime and precise age
immediately before each delete. No await crosses that fence and unlink.
Unknown clocks, symlinks, outside-Documents and changed/incomplete
sources retain. More than 512 sources/four directories defer.

A non-blocking device-local OS lease serializes reclaim writers. A
flushed atomic tombstone ring keeps 200 recent attempts;
malformed/oversized state stops reclaim. Pending intent is never replay
authority: a restart needs a fresh census and metadata/reference proof.
Batch intent is flushed before entering the queue; sidecar precedes
audio unlink, with no await from final fences through unlink. Completion
is flushed off the queue. Only our synchronous unlink advances the
Documents stamp. Aggregate event reports files/bytes deleted, skip
reasons and result, with no identifiers.

## Ramp and rollback

`orphan_audio_reclaim_off` follows destructive `watch_copy_dedupe`: only
resolved false permits deletion. True, unknown and unreadable retain, so
this defaults to no deletion until the rollout row resolves false.

- Cohorts: David’s device first, then the whole fleet within one week,
by **2026-11-24**.
- Metrics: census unreferenced count falls by exactly deleted count;
missing-recording reports do not rise.
- Owner/expander: **mobile custody lead**. The lead enables David’s
cohort first and expands by that date after clean evidence.
- Rollback: set the kill switch true; deleted bytes cannot be restored.
No PostHog configuration is created or enabled by this PR.

## Validation

Pinned Flutter 3.44.5 / Dart 3.12.2; hermetic fixtures only; heavy
commands run through `/Users/dazheng/workspace/omi/bin/omi-heavy run --`
in app/ unless stated.

```sh
flutter test --no-pub test/unit/wal_orphan_reclaim_test.dart --reporter expanded
flutter test --no-pub test/unit/wal_orphan_reclaim_test.dart test/unit/wal_orphan_recovery_test.dart test/unit/orphan_inventory_contract_test.dart test/unit/recording_inventory_test.dart test/unit/wal_startup_admission_test.dart test/unit/local_recordings_auto_upload_test.dart --reporter expanded
flutter analyze --no-pub lib/services/wals/local_wal_sync.dart lib/services/wals/orphan_audio_classifier.dart lib/services/wals/wal_orphan_reclaim.dart lib/services/wals/wal_orphan_recovery.dart lib/services/experiments/orphan_audio_reclaim.dart test/unit/wal_orphan_reclaim_test.dart
flutter analyze --no-pub lib/services/wals/orphan_audio_classifier.dart lib/services/wals/wal_orphan_reclaim.dart test/unit/wal_orphan_reclaim_test.dart
flutter test --no-pub test/unit/wal_orphan_reclaim_test.dart --plain-name 'legacy Limitless' --reporter expanded
flutter test --no-pub test/unit/wal_orphan_reclaim_test.dart --plain-name 'later successful batch' --reporter expanded
flutter analyze --no-pub lib/services/wals/local_wal_sync.dart lib/services/wals/orphan_audio_classifier.dart lib/services/wals/recording_inventory.dart lib/services/wals/recording_inventory_sources.dart lib/services/wals/wal_orphan_reclaim.dart lib/services/wals/wal_orphan_recovery.dart lib/services/experiments/orphan_audio_reclaim.dart lib/utils/analytics/registry/events.g.dart test/unit/wal_orphan_reclaim_test.dart
# root
# dart format -l 120 run on all Lane H Dart source/test files
python3 scripts/check_event_registry.py --write
python3 scripts/render_feature_flag_registry.py
git diff --check
OMI_PR_BODY_FILE=/Volumes/Ephemeral/scratch/lane-h-body.md make preflight
scripts/pr-preflight --pr-body-file /Volumes/Ephemeral/scratch/lane-h-body.md
```

**Final focused suite: 223 passed. All nine changed Dart files
(including generated event output) analyze clean (23.1s).** Format/diff
checks pass. Initial committed-tree preflight passed all 35 checks;
normal push/preflight/codegen/format gates passed on the first two
heads. **Final follow-up head 0a129dd
passed the normal push gate: 35 shared preflight checks (38.73s),
generated-output validation, and Dart formatting with zero changes.**

Before implementation the reclaim suite failed to compile on #25573
because reclaim did not exist. Eight unsafe predicate/order mutations
caused runtime assertion failures and were restored. After moving
journal fsync outside the queue, removing the asynchronous intent
checkpoint again failed three durability tests. Additional
before-failing regressions proved that a legacy pending path through a
directory alias could lose audio, that malformed capture-committed lists
were wrongly complete (three cases), that reclaim did not publish its
frame cache, and that an exception plus stop was mislabeled background.
Fixed with a precomputed off-UI conservative legacy basename fence,
canonical receipt parsing/unknown-field rejection, generation-fenced
cache refresh, and honest failure results. The accepted legacy Limitless
regression failed before its fix (old unreferenced file retained), and
the telemetry regression failed with expected sources_changed / actual
completed before its fix. Five legacy-format cases now cover successful
reclaim plus capture/mtime/reference/working exclusions. Tests also
cover every reference generation/bucket/source, incomplete or
missing-memory census, admission/headless/background,
unknown/throwing/closing flag, changed/re-referenced files, generation
changes, pass cap/census-count delta, outside-Documents files, symlinks,
tombstone persistence failures, both crash windows and
replacement/new-reference retries.

## Reviews and remaining risk

Single scope panel **scope-20261117t134503-0e28** completed with three
members. Applied: missing-memory-snapshot fence, independent
multi-account/age predicate, separate destructive flag and event,
own-directory mutation accounting, bounded queue turns/journal and crash
tests. Pending intent never grants replay authority, so a new/replaced
file requires a new census; sidecar-first unlink prevents an
absent-audio sidecar replay. Retained existing conservative treatment of
corrupt sources; rejected suggestions to reset unreadable state, impose
single-owner deletion or lengthen the ruling’s age by owner. A
separately refreshed census after recovery avoids using reference proof
invalidated by adoption; this can repeat cold I/O, and timing remains a
device gate. No new daily budget: the requested batch cap/paced wake
bounds work without another durable scheduler. Scope reports have no
F-number finding IDs; decisions are recorded here. Review round 1:
**review-20261117t140935-ff77** on
20d0d1d. Luna and GLM completed;
DeepSeek failed with empty_terminal_result and supplied no review. Every
finding is CLI-triaged, none missing: F1 accept/fixed (known legacy
Limitless timestamp format for reclaim only); F2 accept/fixed
(source-fence result cannot reset to completed on later batches); F3
reject (inherited #25573 future-clock recovery-budget hold is deliberate
fail-closed availability behavior, outside reclaim scope and unaffected
by deletion). Final second panel **review-20261117t144634-ab53**
reviewed **a7a7447d6874bd43248c773480be7460e258ca12** and reported
**SHIP**, with GLM and DeepSeek answers collected (the latter completed
after the collection deadline, before cleanup; no new execution was
launched). Luna could not launch because agentctl journal access was
busy. All F1–F8 are CLI-triaged, none missing:

- F1 accept/fixed: an actual in-pass exception always reports failed,
even with a lifecycle fence.
- F2 reject: stop synchronously cancels the timer; no await crosses each
final foreground fence/unlink. A stop-inside-batch test retains all
eight files. Generation changes must not invalidate the existing final
capture flush.
- F3 accept/fixed: validate each capture-committed row with the
canonical parser and reject unknown fields; valid/empty foreign journals
still permit multi-account reclaim.
- F4 reject: pinned Dart documents exclusive/shared as non-blocking;
blockingExclusive/blockingShared are distinct modes. Clarified advisory
process scope; OS locks do not serialize isolates in one process.
- F5 accept/fixed: publish the census framing cache after the
session/complete fences, including when recovery is off.
- F6 accept/fixed: remove duplicate source validation, retaining one
complete source check immediately before every unlink, as the ruling
requires. No source-check hoist across multiple unlinks; device queue
latency remains unmeasured.
- F7 accept/fixed: assert the actual kill-switch result and zero census
calls, plus a complete actual outside-Documents census and its skip
reason.
- F8 reject: inherited #25573 uniform held-row drain defense is
unchanged and outside reclaim scope.

Additional implementer finding accepted/fixed: the alias-reference
fixture lost audio before the final conservative basename fence. Names
are computed once off UI, with O(1) lookup per unlink. This can retain
extra same-basename files in other directories, which is intentional
uncertainty retention.

**Exactly two review rounds. No third review of these final follow-up
fixes**, per the requested process limit. Review SHIP applies to
a7a7447..., not the final follow-up commit; final changes are covered
by the before-failing regressions and clean local validation.

Initial-head CI was terminal green. On a7a7447..., Android JVM job
134121342891 in run 44106684811 failed dependency resolution before
tests: Maven Central returned HTTP 429 for androidx.test:runner
metadata. GitHub refused a targeted job rerun while the parent workflow
was still active. Final source head
**0a129ddf3473c7f98ac00b4ed57298ddb2d4f66f** starts fresh CI; **pending
at handoff**, watched by a bounded ci-wait 25604 monitor plus heartbeat
outside the worktree. The monitor verifies the head, exits on first
failure/terminal state, and stops its heartbeat when finished. No CI
gate was bypassed.

Physical-device acceptance, native multi-engine timing, final
stat/unlink queue latency and actual reclaimed space/ramp metrics are
unmeasured. Journal fsync now occurs before entering/after leaving the
capture queue, one checkpoint per five-file batch; final revalidation
and unlinks have no await. Recovery retains its existing future-clock
budget hold. First-round review coverage is partial because one member
failed. This records source/test evidence, not a device or storage
outcome. No production account data, GCP tier, deploy or merge. PR
#25500 and its branch untouched.


## Final handoff

Ready PR, base main, head **0a129ddf3473c7f98ac00b4ed57298ddb2d4f66f**.
**223 focused tests pass; nine-file analyzer clean; formatting, all 35
preflight checks and normal generated-output/pre-push gate pass.** The
final alias/receipt/cache/telemetry/test-strengthening fixes were not
sent through a third review, as requested. All returned findings from
both rounds are CLI-triaged with no missing calls. No merge, deploy,
production account data, GCP tier or flag enablement. Worktree clean.
Source-only result: device acceptance, actual reclaimed storage and ramp
metrics remain unmeasured. CI is pending with a bounded monitored
waiter; its later outcome does not change the recorded local evidence.


## Final review (lead takeover)

Panel `review-20261117t153802-6ffd` reviewed `0a129dd`. Luna and GLM
completed. DeepSeek returned an empty result, so it contributed no
review.
- **F1 (blocking), accepted and fixed:** a reference that differs only
in case is now reserved by its case-folded basename, both when building
candidates (`recording_inventory.dart`) and in the final pre-unlink
check (`wal_orphan_reclaim.dart`). The new regression test `an index
reference differing only in case retains the audio` fails before the fix
and passes after.
- **F2, rejected:** census work is already bounded. It runs in the
foreground only, at most once per 15-minute coalesced wake, off the UI
isolate. Framing is cached by path, size and mtime, so only the stat
walk repeats; #25525 measured that walk at 2.9 s for 164k files.
- **F3, accepted and fixed:** torn tombstone JSON reports
`journal_unavailable`. The new test fails before the fix and passes
after.

**Added ramp gate:** before expanding past David's device, measure
foreground census and reclaim pass duration there (the `Orphan Audio
Reclaim` event plus the debug log).

**Verification:** focused suite (wal_orphan_reclaim,
wal_orphan_recovery, recording_inventory, wal_startup_admission) 207
passed; analyzer clean.


Panel `review-20261117t155959-13cf` (on `00b2683`, Luna and GLM;
DeepSeek returned an empty result). All five findings were accepted and
fixed:
- **F1:** frames are read only for owned files inside the 28-day
recovery window, so unowned and expired files cost no audio reads.
Reclaim needs only age and references. Unparseable results are cached
for 24 h.
- **F2:** `duration_ms` is added to the reclaim event and its analytics
contract, so the ramp gate can be measured.
- **F3:** the commit-time reference check in recovery is case-folded.
- **F4:** recovery reports actual failures as `failed`.
- **F5:** an unknown result string falls back to `failed` instead of
dropping the event.

Tests:
- New: `unowned and out-of-window orphans are classified without reading
audio`.
- The scale/cache test now pins the one-day negative cache.
- Focused suite: 208 passed. Analyzer clean. The C7 event registry is
current.

Panel `review-20261117t161835-0ffb` (on `aae8b1f`) returned **SHIP**.
- F1 rejected: pre-2024 filename clocks predate any Omi capture, so they
are treated as bad clocks and retained.
- F2 accepted: the test-only commit adds `one foreground wake runs
recovery, then reclaim after recovery settles`. The recovery suite
passes (131 tests).
Git-on-my-level added a commit that referenced this pull request Nov 18, 2026
Stage beta is admitting pre-v3 store builds: the episodes client-seen marker it reads was also
written for store-channel episode callers before #25500 and lives 14 days. Since beta went live
(11-18 04:35Z) about 96% of store-channel episode calls come from v3-admitted owners; those
builds show the raw recording a capture ends with as a blank card that 404s.

GET /v1/conversations/live is called only by v3-capable builds, on any channel. It now refreshes
a separate 14-day conversations_v3:client_capable:{uid} Redis marker. beta requires that marker
plus the TestFlight episodes marker; all requires that marker; the named cohort is unchanged.
Owners whose apps all predate v3 keep legacy intake. Reads fail closed; a failed write is not
memoized or reflected in this process's answer.

Failure-Class: none

Co-authored-by: Claude Opus 5.5 <[email protected]>
Git-on-my-level added a commit that referenced this pull request Nov 21, 2026
…ersations-v3 first (SCA-2967) (#25713)

## What changed and why

SCA-2967. Activating conversations-v3 for TestFlight on 2026-11-17
needed several services to move in a fixed order: backend Cloud Run,
then llm-gateway, then pusher, then listen. Nothing encoded that order,
and each gap was found in prod or by luck:
- llm-gateway was two weeks stale and had no v3 lanes;
- pusher lacked the `SYNC_TASKS_PROJECT`/`SYNC_TASKS_LOCATION` that
listen sets;
- pusher's image was 8 days old (version skew);
- the `conversations-v3` queue and the v3 scheduler jobs did not exist.

KB evidence: `evidence/2026-11-17-v3-testflight-activation-escapes.md`
(#7, #8) and `2026-11-17-delivery-debt-from-v3-rollout.md` (D1, D8).

This PR adds a feature activation manifest (data) and a read-only tool
that checks it against live serving state. The first manifest is
conversations-v3. **The tool is not wired into any gate.**

- `backend/deploy/activation/conversations-v3.yaml` lists:
- the services and the commits each must contain (ancestry, not an exact
SHA);
  - the order they must move in;
- env keys that must be set, and equal across runtimes where that
matters;
  - gateway lanes, the queue and the scheduler jobs.

Each entry has a `why` that points at the code or incident behind it.
The format is in `backend/deploy/activation/README.md`.
- `backend/scripts/activation_check.py` is pure: manifest + state JSON
in, verdict out. Each requirement is `satisfied`, `missing`, `unknown`
or `deferred`.
- Exit codes: `0` READY; `1` BLOCKED (a controlled requirement is
missing); `2` UNKNOWN (nothing missing, but a controlled requirement
could not be read); `3` invalid input.
  - `unknown` never counts as satisfied.
- Some requirements are owned elsewhere: anything marked `controlled:
false` (the backfill queue), and anything listed under `not_checked`
(Firestore indexes, owned by the index readiness gate). They are always
reported, and the report says who owns them, but they never change the
exit code.
- `--before <service>` checks only the requirements due before that
service moves.
  - The verdict prints the state's `collected_at`.
- `backend/scripts/activation_collect.py` reads prod metadata only:
- Cloud Run: only the revisions receiving traffic, from
`status.traffic`, never the spec.
- GKE: the Deployment template env, with ConfigMaps resolved, and the
image digests of running pods.
  - Cloud Tasks queues and Scheduler jobs: one `list` call per location.

Serving identity comes from the image: its OCI
`org.opencontainers.image.revision` label, else its commit tag. The prod
pusher digest is looked up in the dev registry it was promoted from.
`OMI_BACKEND_RELEASE_SHA` is only recorded, as `release_env`: env merges
never remove a value, so it can name a release the revision does not
serve.

The collector never reads Secrets and records only the env keys the
manifest names. The checker's report prints key and runtime names, never
values.

### v3 requirements

| Kind | Requirement |
| --- | --- |
| Order | 1. `backend`, `backend-sync`, `backend-sync-backfill`,
`backend-integration`, `desktop-backend` → 2. `llm-gateway` → 3.
`pusher` → 4. `backend-listen` → lever (`CONVERSATIONS_V3_STAGE` /
`CONVERSATIONS_V3`) |
| Contains | Writers (`backend`, `backend-integration`,
`backend-listen`): #25500, #25588, #25658, #25661. Builder hosts
(`backend-sync`, `backend-sync-backfill`): the same plus #25691.
`llm-gateway`: #25500 (v3 lanes). `pusher`: #25500 (v3-aware
finalization), #25658 (admission) |
| Gateway lanes | `omi:auto:conversation-v3-outline`, `-summary`,
`-summary-open`, `omi:auto:conv-action-items` |
| Env | `v3-task-binding`: `SYNC_TASKS_PROJECT`/`LOCATION`/`INVOKER_SA`
set and equal on the six writers.<br>`v3-task-target`:
`CONVERSATIONS_V3_TASKS_URL` or `SYNC_TASKS_HANDLER_URL`.<br>`v3-stage`:
`CONVERSATIONS_V3_STAGE` equal on the writers and desktop (code default
`beta` for an absent key).<br>`v3-kill-switch`: `CONVERSATIONS_V3`
equal.<br>`v3-gateway-endpoint`: `OMI_LLM_GATEWAY_URL` on `backend` and
`backend-sync`; the placeholders `http://127.0.0.1:9` and `:9080` count
as unset |
| Queues | `conversations-v3` (controlled); `conversations-v3-backfill`
(`controlled: false`) |
| Scheduler | `conversations-v3-sweep`, `conversations-v3-legacy-users`
(ENABLED) |
| Not checked | Firestore composite indexes (index readiness gate) |

### How Release calls it (not in this PR)

Before each step of the train, and before a stage or kill-switch move:
1. `source ~/.local/bin/gcp-agent-env.sh ro-prod && git fetch origin`.
2. `python3 backend/scripts/activation_collect.py --manifest
backend/deploy/activation/<feature>.yaml --cluster prod-omi-gke
--promoted-from-gcloud-config ~/.config/gcloud-agent/ro-dev --out
state.json`.
3. `python3 backend/scripts/activation_check.py --manifest … --state
state.json --before <service|activate> --json`.
4. On exit 1, stop and name the missing requirements. On exit 2, a human
reviews the unknowns. On exit 0, proceed.

Only controlled requirements affect the exit code, so the check trips
only on signals the activation controls. The meta-repo train
(`omi-deploy-prod` / `train.sh`) can call these two scripts from its
release checkout; that wiring is a separate change.

## Product invariants affected

none

## How it was verified

- `backend/.venv/bin/python -m pytest -q
backend/tests/unit/test_activation_manifest.py`: 38 passed.
- **2026-11-17 fixture**
(`backend/tests/unit/fixtures/activation/state-2026-11-17.json`):
`verdict=BLOCKED`, exit 1, satisfied=63, missing=14, unknown=1. Missing:
- stale gateway: `service:llm-gateway:contains:012329830a9e`, plus the
three lanes `lane:omi:auto:conversation-v3-outline` / `-summary` /
`-summary-open`;
- old pusher image: `service:pusher:contains:012329830a9e` and
`:156b50921d7e`;
- pusher task binding: `env:v3-task-binding:pusher:SYNC_TASKS_PROJECT`
and `:SYNC_TASKS_LOCATION`, with their two `env-equal` results;
- infra: `queue:conversations-v3`,
`scheduler-job:conversations-v3-sweep`,
`scheduler-job:conversations-v3-legacy-users`;
  - the backfill queue (advisory).

The one unknown is the advisory Firestore-index item. With `--before
backend-listen`, the gateway, pusher and infra gaps still block, and
listen's own 10 requirements are deferred.
- **Correct-state fixture** (`state-ready.json`): `verdict=READY`, exit
0, satisfied=77, missing=0; the only unknown is the advisory
Firestore-index item.
- **Current prod, collected 2026-11-18T19:24:59Z** with the read-only
`ro-prod` identity, plus `ro-dev` for the dev-registry tag only.
Metadata reads only, no writes.
- `verdict=READY`, exit 0: satisfied=77, missing=0, unknown=1 (advisory
`external:firestore-indexes`).
- All 9 services resolved to a source commit, all 4 lanes are served,
all env requirements are met and equal, the `conversations-v3` queue is
RUNNING, and both v3 jobs are ENABLED.
- The first manifest draft required #25691 on `backend-listen`, and prod
(listen serving 44d0a4f) reported it missing. Short-task extraction runs
only on the sync task handler, so that requirement now applies to the
builder hosts only.
- `scripts/pr-preflight --pr-body-file` passed, and so did `python3
.github/scripts/check_release_rings.py` (the scope panel warned against
reusing the forbidden "release ring" names).

### Panels

- **Scope** `scope-20261118t174316-a7fd`: only glm-flash completed; luna
failed to launch (journal busy) and deepseek failed. Taken from it:
  - `activation` naming;
- CLI and tests only, with no checks-manifest entry or cross-service
invariant (check budget);
  - queue and scheduler ownership (ops_train, scheduler_reconcile);
- keep the manifest from drifting away from `runtime_env` (handled by a
drift test).

Two of its claims were contradicted by live reads, and I resolved them
that way:
- It said `OMI_BACKEND_RELEASE_SHA` is the true marker. Image identity
is used instead, per the documented env-merge misread.
- It said prod pusher's digest has no live source. The dev-registry tag
does resolve it.
- **Review** `review-20261118t185330-8905` (FIX-FIRST; deepseek and
glm-flash; luna failed to launch):
  - Accepted and fixed in d204e36: F1, F4–F17.
- F2/F3: the PR body first posted was another lane's (SCA-2966), because
a scratch file was shared between sessions. It has been replaced with
this one.

## Tests

`backend/tests/unit/test_activation_manifest.py` covers:
- **Fixtures:** each 11-17 escape is reported by name; the correct state
passes.
- **Unknown handling:** an unreadable service, ancestry or lanes gives
UNKNOWN (exit 2), never satisfied; missing beats unknown; uncontrolled
requirements never change the exit code; split traffic (every serving
revision must contain the commit); an env-equal result with one
unreadable unit is unknown.
- **Env values:** stage skew, code defaults versus an explicit empty
value, the placeholder URLs, `any_of` and Secret refs.
- **Order and input:** order deferral; invalid YAML, manifest and state
exit 3.
- **Collector, with fakes:** reads `status.traffic` and never the spec;
never reads Secrets; resolves ConfigMap and `envFrom`; resolves promoted
digests; failed reads become unknown; pod digest counting; container
choice; `Registry.source` (label, index, tag fallback, ambiguity); only
Google registry hosts.
- **Drift:** queue, job and lane names are parsed exactly from
`ops/prod.yaml`, `scheduler/jobs.yaml` and
`generated_route_overrides.yaml`. Every required env key is declared for
each runtime in the composed prod `runtime_env.yaml`; this would have
caught pusher's missing task binding at PR time.

## UI evidence

UI-Evidence: none -- backend tooling, no UI

## Failure class (fixes)

Failure-Class: none

🤖 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.

2 participants