Skip to content

feat: recording-reliability rollouts behind per-account flags - #26348

Merged
Nizarius merged 5 commits into
mainfrom
feat/recording-reliability-flags
Nov 26, 2026
Merged

Nizarius merged 5 commits into
mainfrom
feat/recording-reliability-flags

Conversation

@Nizarius

@Nizarius Nizarius commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

What changed and why

Nine behaviour changes to ending a conversation, to what the phone shows while it records and to how fast an upload's result reaches the conversation, each behind its own flag and off for every account until a rule admits it. With no rule in the flag store the backend and the app behave as on main.

Each flag is one Omi flag store rule (kind: posthog rows in config/feature-flags.yaml). The backend reads the rule for the account at the place the behaviour changes (config.reliability_experiments.enabled(name, uid)), and the mobile app reads the same rule from GET /v1/flags (app/lib/services/experiments/reliability_flags.dart), so one rule switches both sides for an account.

Flag Sides On, for an admitted account
end_open_conversation app, backend Ending a conversation seals the phone file being written and sends the End time. The backend stores an owner-level cut there, starts a new v3 conversation at it at once, and joins speech recorded before the cut that lands later to the ended conversation. An End with a stored cut is not held by the Finish wait of CONVERSATIONS_V3_CAPTURE_CONTINUITY; every other End keeps that wait.
fast_end_feedback app, backend The conversation shows as done as soon as its summary is stored. GET /v1/conversations/{id}/summary/wait holds a request until the conversation is committed with its outline or its summary is stored, and the app applies each answer.
end_button_by_device app, backend The open v3 conversation names the app install behind its latest speech, so the app offers End on a conversation this phone feeds.
instant_live_text app, backend The phone's own recognised lines show under a conversation this phone feeds; a speech write whose grouping wake is refused enqueues one follow-up task in its 15 s slot; a batch-only session streams to the live provider while the app reports its transcript on screen.
vendor_recognizer_on_opened_app app, backend WebSocket /v4/live-words: while the app is in front and capturing, a copy of the audio goes to the live provider and words come back for display only, merged with the phone's own lines. Nothing is stored; batch stays the transcript.
receipt_long_poll app, backend POST /v2/sync-local-files/receipts/wait reports finished upload jobs to one waiting request instead of per-job status polls.
early_title_icon app Home lists an ended conversation with its title and emoji as soon as the server has fixed them.
commit_wake backend A batch worker that commits a result tells the serving backend which owner it was, and the backend projects that owner without waiting for the serving sweep.
batch_frame_outcomes backend A completed batch upload reports frame_outcomes_v1 in its status result.

Not behind a flag, because it only counts and logs:

  • The v3 pass collision record (database/conversations_v3_collisions.py): when a grouping pass is thrown away or its commit meets a lock, one line and one counter name the kind of document, the changed field names and the writer family. About 7% of passes are thrown away as source_changed and about 1.2% fail on a lock today, and neither outcome said what it lost to.
  • The builder commit meter (database/conversations_v3_commit_cost.py): how each live builder commit ended (first_try, recovered, exhausted, error) and what its lock retries cost. The share of exhausted is the share of passes left to the task queue's 30 s retry. The retries themselves are unchanged (SCA-2918).

Change notes: backend/docs/listen_pusher_pipeline/changes/2026-11-25-reliability-rollouts-per-account.md and 2026-11-25-v3-pass-collision-record.md.

Rollout

All nine flags start with no rule, so nothing changes at deploy. A rule's allow list admits single accounts and its percentage ramps it; deactivating the rule is the rollback. commit_wake is decided on the batch worker, which has no flag store configured today, so it cannot be admitted for any owner until that is added. /v4/live-words needs a load-balancer path rule before vendor_recognizer_on_opened_app is ramped beyond single accounts.

A development stack has no flag store: OMI_RELIABILITY_EXPERIMENTS (backend) and a define or a Documents file (app, debug and local_dev builds only) select names there. No deployed environment sets the backend variable, a test pins that, and a released app build ignores the local selection.

Batch pipeline numbers

New bounds, all on paths that run only for an account a flag admits:

  • MAX_OWNERS_PER_CALL new: 32 owner ids in one commit-wake request (commit_wake).
  • MAX_PENDING_OWNERS new: 1024 owners waiting to be sent by one worker; past it a wake is dropped and the sweep finds the row (commit_wake).
  • MAX_RUNS_BYTES new: 262144 bytes of frame-run input stored on an intake row (batch_frame_outcomes).
  • MAX_PART_SPANS new: 1024 text spans recorded per settled part (batch_frame_outcomes).
  • MAX_RANGES new: 4096 ranges in one status result (batch_frame_outcomes).

No existing capacity value changes.

Product invariants affected

  • INV-DATA-1: app/lib/main.dart gains one start-up call that returns at once in a released build (the local selection is read only in a debug or local_dev build). No routing or environment authority changes.
  • INV-CAP-1: app/lib/services/capture/** and app/lib/services/wals/** change only behind the flags above. With every flag off, capture, sealing, upload and receipt handling take the same paths as on main; a per-hunk audit of the app diff found no changed default, constant or control flow outside a flag.

How it was verified

  • The nine behaviours were exercised on an iPhone with a pendant against a local prod-parity stack with the names selected through the development override, before the switch became per-account. The per-account switch itself is covered by unit tests only; the branch as pushed has not been run on a phone.
  • Backend: the changed and added unit test files and the registry and contract guards, one file per process: Firestore query shapes, witnesses and index rules, lifecycle writer inventory, route policy baseline, cross-service deploy contract, flag budget, feature-flag registry. On this Mac a few files that need Redis scripting fail the same way on untouched main.
  • scripts/openapi_runner.sh scripts/export_openapi.py for the three surfaces, check_app_client_openapi_compatibility.py --base-ref origin/main, generate_dart_models.py --all --check, and the TypeScript and Swift generators.
  • scan_async_blockers.py, check_module_stub_pollution.py, scan_import_time_side_effects.py: no findings. backend/scripts/typecheck.sh: 0 errors. scripts/pr-preflight --all: every gate passes except web-app-checks, which needs bun and could not run on this machine.
  • App: flutter test (whole suite) passes, tool/perf_shell.py --check passes after regenerating the production shell copy for the new main.dart import.

Tests

  • Switch: backend/tests/unit/test_reliability_experiments_switch.py (per-account decision, the development override, a store fault reads as off, the event loop never reads the store inline, registry rows exist for every key) and app/test/unit/reliability_experiments_test.dart (remote flag per name, a released build ignores the local selection).
  • One backend/tests/unit/test_reliability_experiment_<name>.py per backend flag, each with the off path asserted to be the baseline, plus the app tests named for each flag under app/test.
  • test_conversations_v3_pass_collisions.py and test_conversations_v3_commit_cost.py for the unswitched record and meter: neither can change a result or an error.

UI evidence

UI-Evidence: none -- every UI change is behind a flag that is off for all accounts; with the flags off the screens are unchanged.

Failure class (fixes)

Failure-Class: none

Line-Count-Exception: app/lib/pages/conversation_detail/page.dart | 1738 -> 1875 | flag-gated live lines under the open conversation; the gates sit in the build and transcript helpers they change
Line-Count-Exception: app/lib/pages/conversations/conversations_page.dart | 1611 -> 1660 | flag-gated return of the Listening row after an End
Line-Count-Exception: app/lib/services/capture/capture_controller.dart | 5103 -> 5135 | End time and file seal on the existing End path, behind a flag
Line-Count-Exception: app/lib/backend/http/api/conversations.dart | 1642 -> 1740 | two wait requests and the End header beside the calls they extend
Line-Count-Exception: app/lib/services/wals/local_wal_sync.dart | 3212 -> 3272 | receipt wait start and stop beside the status polling it replaces
Line-Count-Exception: app/lib/providers/conversation_provider.dart | 2553 -> 2554 | one flag-gated condition
Line-Count-Exception: app/lib/pages/conversation_detail/conversation_detail_provider.dart | 1588 -> 1592 | optional read parameter for the wait answer
Line-Count-Exception: backend/routers/sync.py | 4208 -> 4281 | the receipts wait route beside the status route whose read it shares
Line-Count-Exception: backend/routers/conversations.py | 3203 -> 3276 | the summary wait route and the End cut on the existing End route
Line-Count-Exception: backend/database/conversations_v3.py | 1696 -> 1771 | collision record hooks inside the commit they observe
Line-Count-Exception: backend/utils/conversations/v3/service.py | 1568 -> 1614 | flag-gated cut load, device stamp and summary wake inside the pass
Line-Count-Exception: backend/utils/batch_pipeline/intake.py | 1550 -> 1585 | flag-gated frame outcome inputs at intake
Line-Count-Exception: backend/utils/batch_pipeline/projection.py | 1947 -> 1975 | flag-gated End lookup and frame spans at projection
Line-Count-Exception: backend/database/batch_pipeline_projection.py | 1550 -> 1569 | flag-gated receipt wake after a completed upload
Line-Count-Exception: backend/routers/listen/receiver.py | 3054 -> 3066 | attach points of the flag-gated watched stream
Line-Count-Exception: backend/utils/sync/assignment.py | 1684 -> 1695 | data-gated End boundary in the attach step

Scoped cleanups (optional)

get_sync_job_status is split into the route and _read_sync_job_status so the receipts wait can share the read; the Firestore caller witness is renamed with it.

🤖 Generated with Claude Code

Nizarius and others added 3 commits November 25, 2026 19:33
Nine behaviour changes to ending a conversation, to what the phone shows while it records and to how
fast an upload's result reaches the conversation, each behind its own Omi flag store rule and off for
every account until a rule admits it: end_open_conversation, fast_end_feedback, end_button_by_device,
instant_live_text, vendor_recognizer_on_opened_app, receipt_long_poll, early_title_icon, commit_wake and
batch_frame_outcomes. The backend reads a rule for the account at the place the behaviour changes and
the mobile app reads the same rule from GET /v1/flags, so one rule switches both sides.

Unswitched: the v3 pass collision record and the builder commit meter, which only count and log.

Failure-Class: none

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

Failure-Class: none

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Failure-Class: none

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

mintlify Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
omi 🟢 Ready View Preview Nov 26, 2026, 12:59 AM

💡 Tip: Enable Automations to automatically generate PRs for you.

Nizarius and others added 2 commits November 25, 2026 20:21
…dule; the WebSocket route entry names its method

Failure-Class: none

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@Nizarius
Nizarius merged commit 220610c into main Nov 26, 2026
74 of 76 checks passed
@Nizarius
Nizarius deleted the feat/recording-reliability-flags branch November 26, 2026 02:45
Nizarius added a commit that referenced this pull request Nov 26, 2026
…nnection, a stored End finds its row (#26357)

## What changed and why

Three follow-ups to #26348, each behind a per-account flag of that
change and inert for an account the flag is off for, and one new
analytics event that is not behind a flag.

1. **`receipt_finished_note`** (new flag, used with
`receipt_long_poll`). As first built, the receipts wait re-read every
listed job when a wait started, on every wake and when it expired, which
is several times the reads of the status polling it replaces. Now a
finished upload job leaves a note in Redis for an hour before its wake,
the wait reads job state only for a job a note or a wake names, and an
expired wait answers without reading anything. The app status-polls a
job the wait covers once a minute as a backstop. On a test phone the
reads from waits fell to one per finished upload.
2. **`vendor_recognizer_on_opened_app`: silence keeps the connection.**
A `/v4/live-words` connection used to close after 20 s without audio, so
a phone fed by a pendant reconnected after every pause, and the listen
service counts new connections per signed-in user (shared with the
capture connection). Now only the provider stream is given back after 20
s of silence and the next audio dials a new one on the same connection;
the connection closes after 10 minutes without audio.
3. **`end_open_conversation`: a stored End finds its conversation.**
When End is pressed before the server has a conversation for the speech
since the previous End, the End is answered pending and the app kept its
Processing row until the 20-minute deadline. Conversation reads now
serve the End instant the builder already stamps (`v3_manual_cut_at`,
hidden from the published schema), and the app matches its row to the
conversation whose cut equals the End time it sent; a pending acceptance
keeps the 2-minute expiry.

4. **`App Foreground Ended` (analytics event, every account, no flag).**
One event each time the app leaves the front after at least a second
there, with two whole numbers of seconds: in front, and in front with
capture active. "In front" is the lifecycle state `resumed` only. The
listening connection's own report counts a background launch as
foreground, so time in the app could not be measured on iPhone; this
number is the baseline for pricing a live stream before any rollout.
Registered in `contracts/analytics/events.json` with its consumers;
nothing is stored on the phone.

Change note:
`backend/docs/listen_pusher_pipeline/changes/2026-11-26-receipt-note-live-words-connection-end-finish-row.md`.

### Rollout

No rule exists for any of these flags at deploy. `receipt_long_poll`
should be admitted for an account only together with
`receipt_finished_note`. Before `vendor_recognizer_on_opened_app` is
ramped beyond single accounts: the load balancer needs a path rule for
`/v4/live-words`, the display stream has no plan-allowance check, and
the server's one-connection-per-install map is per process.

### Known limits

- `receipt_finished_note`: a failed upload leaves no note and no wake
(the once-a-minute poll finds it). A lost note, Redis being down and the
phone in the background are not tested.
- Live words: the provider give-back after real silence was seen with a
probe on a local stack, not on a phone (the room never went quiet for 20
s).
- End finish row: the 2-minute removal (no speech before the End) is
covered by tests only. When the server replaces an implausible phone End
time with its own, nothing matches and the row goes at 2 minutes.
`Conversation.model_dump()` consumers carry the new key like the other
v3 fields.

## Product invariants affected

- INV-CAP-1: `app/lib/services/capture/empty_recording_notice.dart` and
`app/lib/services/wals/**` change only behind `end_open_conversation`,
`receipt_long_poll` and `receipt_finished_note`. With the flags off,
capture, upload and receipt handling take the same paths as before.

## How it was verified

- The event was checked on a test iPhone through a temporary local
mirror that is not in this change (two visits recorded with the expected
seconds); its arrival in the analytics store is not verified, because
the local build has no analytics key.
- Each of the three flagged changes was exercised on an iPhone with a
pendant against a local prod-parity stack with the names selected
through the development override: the receipts wait over 17 minutes in
front (one job-status read per finished upload, each answered a fraction
of a second after its result was written), the live-words connection
held for 13 minutes without a reconnect, and an End followed by Finish
before the server had the conversation (the Processing row was replaced
about 14 s after Finish; before the fix it stayed for 20 minutes). The
per-account switch itself is covered by unit tests only.
- Backend: the changed test files and the registry and contract guards,
one file per process; `backend/scripts/typecheck.sh` 0 errors;
`scan_async_blockers.py` no findings.
- App: `flutter test` (whole suite).

## Tests

-
`backend/tests/unit/test_reliability_experiment_receipt_finished_note.py`
(12 cases), `test_reliability_experiment_live_words.py` (15),
`test_reliability_experiment_end_answer.py`,
`test_client_processing_trust_boundary.py` (the new model field is
classified).
- App: `test/utils/analytics/app_foreground_time_test.dart` (9 cases),
`test/unit/receipt_waiter_test.dart`,
`test/unit/sync_poll_storm_test.dart`,
`test/providers/end_stored_finish_row_test.dart`, two cases in
`test/pages/conversations/home_v3_test.dart`.

## UI evidence

UI-Evidence: none -- the only visible change (the Processing row leaving
sooner after an End) is behind a flag that is off for all accounts.

## Failure class (fixes)

Failure-Class: none

Line-Count-Exception: app/lib/services/wals/local_wal_sync.dart | 3272
-> 3285 | test seam and upload times for the receipt waiter beside the
wait it feeds
Line-Count-Exception: backend/database/batch_pipeline_projection.py |
1569 -> 1570 | one flag-gated call beside the wake it precedes
Line-Count-Exception: backend/routers/sync.py | 4281 -> 4297 | the note
read inside the receipts wait route

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Git-on-my-level added a commit that referenced this pull request Nov 26, 2026
## What changed and why

Repair two deterministic Backend Unit Tests regressions on main:

- Preserve and cache the real `speaker_evidence_erasure` submodule
through chat fixture setup/cleanup, using the same once-per-process
pattern as the other counter-registering observability module. This lets
`utils.metrics` import the counters without resolving through the
package-less stub or registering duplicate Prometheus series (interacts
with #26311).
- Mark the two flag-gated long-poll routes from #26348 as outside the
Flutter OpenAPI inventory because both deliberately use
`include_in_schema=False`.

No production code or runtime behavior changes. This includes both
repairs together so one exact head can establish green main CI.

## Product invariants affected

none

## How it was verified

Through bounded `omi-heavy` on Worker 1 / Python 3.11.15:

- All 12 files that failed on both `886bf459b01d` and `f5e510a917e0`
passed in one pytest process: 172 tests in 61.42 seconds, with repeated
fixture setup and cleanup throughout (`BACKEND_PYTEST_FILE_ISOLATION=0
BACKEND_PYTEST_XDIST=0`).
- Three additional explicit chat fixture setup/cleanup cycles reused the
identical real speaker-evidence module; no duplicate Prometheus
registration occurred.
- `test_digest_pinned_entries_unchanged` and the affected CI checks
remain delegated to the exact-head GitHub runs.

## Tests

`bash backend/test.sh` over:

- `test_chat_file_upload_unsupported.py`
- `test_chat_followup_block.py`
- `test_chat_generate_reply_stateless.py`
- `test_chat_quota_counting_router.py`
- `test_chat_stream_error_fallback.py`
- `test_chat_citation_surface_contract.py`
- `test_chat_file_upload_picked_name.py`
- `test_messaging_mobile_parity.py`
- `test_voice_message_soniox_metadata.py`
- `test_voice_message_syncing_cleanup.py`
- `test_voice_terminal_notification.py`
- `test_flutter_rest_inventory.py`

UI-Evidence: none -- test-only CI repair

Failure-Class: none
Nizarius added a commit that referenced this pull request Nov 27, 2026
…flags no_live_player and title_at_end (#26467)

## What changed and why

How the page of a conversation in progress looks. One part has no flag;
the other two are per-account flag store rules (the family of #26348),
off by default, and no rule exists for either.

- **Transcript follows its newest line (no flag).** The conversation
page's Transcript tab opens already at its newest line while the
conversation is in progress, with nothing painted on the way there, and
follows new text while the reader stays at the end. A reader who
scrolled up is left in place and gets the jump button. The clear space
under the last line is shorter while live. A saved conversation opens at
its first line as before. On the Listening page, a slow drag back to the
end now resumes the follow.
- **`no_live_player`** (app). No audio player on a conversation still in
progress: the bar is Ask Omi and, where it applies, End Conversation; a
tap on a line does not seek and no audio is loaded. The player returns
when the conversation ends.
- **`title_at_end`** (app + backend). An open conversation is not named
before it ends. The backend returns from the live-title step before
claiming an attempt (no model call, no title written; the outline names
the conversation at its end) and the app reads "Listening" for any
conversation in progress.

The two flags remove behaviour production has today, which is why they
are flags; the follow is not.

### Known limits

- `title_at_end`: a name the server already stored for an open
conversation stays in the page's edit field (tapping the title shows
it); surfaces other than Home and the page header were not searched for
a live conversation's name.
- The backend half of `title_at_end` works only on a backend release
that includes this change; the app half alone already shows "Listening".

## Product invariants affected

None. No capture, upload, memory or task path changes; the backend
change is one early return in the live-title step.

## How it was verified

- On an iPhone 16 Pro against a local prod-parity stack, with a
conversation growing from speech fed without sound, flags selected
through the development override: the Transcript tab opened at its
newest line and followed it; with the flags on, a conversation in
progress showed "Listening" on Home and on its page and had no player in
the bar; an ended conversation still showed its name and its player.
- On the local stack: an open conversation holding more speech than the
live-title threshold had no title and no live-title attempt recorded.
- The tests below on this branch merged with current main.

Not verified: the per-account form of the two flags against a real flag
store (the local stack uses the development override); Android on a
device.

## Tests

- `app/test/widgets/transcript_follow_open_conversation_test.dart`:
opening at the end with no visible scroll, the follow, a reader who
scrolled up, the jump button, the shorter foot, a saved conversation
opening at its first line.
- `app/test/widgets/live_conversation_bar_and_title_test.dart`: the bar
and the header with each flag on and off.
- Cases in `app/test/widgets/transcript_test.dart`,
`app/test/pages/conversations/home_v3_test.dart` and
`app/test/unit/reliability_experiments_test.dart`.
- `backend/tests/unit/test_reliability_experiment_title_at_end.py` (3
cases).

## UI evidence

Widget-test renders of the bar under a conversation in progress.

`no_live_player` off (as on main), the player shows:

![Bar of a conversation in progress with the
player](https://raw.githubusercontent.com/BasedHardware/omi/7a8bcf04dd2974c08c5ce8f518e3962d115400ab/.agent-artifacts/ui-evidence/live-conversation-page/001-mobile-android-live-conversation-bar-with-player.png)

`no_live_player` on, Ask Omi only:

![Bar of a conversation in progress without the
player](https://raw.githubusercontent.com/BasedHardware/omi/7a8bcf04dd2974c08c5ce8f518e3962d115400ab/.agent-artifacts/ui-evidence/live-conversation-page/002-mobile-android-live-conversation-bar-no-player.png)

No picture for the transcript follow: it is a scroll position (asserted
in `transcript_follow_open_conversation_test.dart`), and the screenshots
taken on the test phone show real speech, so they are not published.

## Failure class (fixes)

Failure-Class: none

Line-Count-Exception: app/lib/widgets/conversation_bottom_bar.dart |
1516 -> 1527 | the flag check that leaves the player out while a
conversation is in progress
Line-Count-Exception: app/lib/widgets/transcript.dart | 1601 -> 1664 |
placing the list at its end before first paint and the follow, in the
widget that owns the scroll position
Line-Count-Exception: backend/utils/conversations/v3/service.py | 2010
-> 2013 | one early return in the live-title step for an account with
the flag

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Nizarius added a commit that referenced this pull request Nov 27, 2026
…26466)

## What changed and why

The batch GPU worker chart can now bind the Omi flag store
(`OMI_FLAGS_FIRESTORE_PROJECT`, `OMI_FLAGS_FIRESTORE_DATABASE`), and the
production values set it to the store the serving roles already read.

The reliability experiment `commit_wake` (#26348) is decided per owner
in two places: the worker that commits a result and the serving backend
that receives the wake. The serving roles read the flag store; the
worker chart had no binding, so the worker's check read off for every
owner and a rule could not admit anyone there. The registry row for
`commit_wake` already names this as its precondition.

Nothing changes in behaviour with this PR alone:

- No rule admits an owner on the worker until this binding is rolled out
and a rule exists; with the binding and no admitted owner the worker
sends nothing.
- The binding is values-driven. Dev and staging values leave it empty,
which renders no binding, as today.
- Cost of the binding: each pump process re-reads the store's small
version document at most once a minute, and only while it is committing
results; the rules are reloaded only when the version changes. This is
the same reader the serving roles run.

Roll note for the release owner: the preserve-live image-only worker
release keeps the live environment, so this binding arrives only with a
chart roll of the worker. The worker's service account needs read access
to the flag database; please confirm it at roll time. A chart roll also
applies every other value of the production values file, so compare the
live worker with the rendered chart first (pump depth in particular).

## Product invariants affected

none

## How it was verified

- `helm template` through the chart test helper with the production
values: the three GPU pump deployments (primary, T4 fallback, borrower)
carry both names with the values of
`deploy/runtime_env/prod.overlay.yaml`; the record-seal worker, a
different program, carries neither. With default values no deployment
carries them.
- `bash test.sh` over `tests/unit/test_batch_pipeline_chart.py`,
`tests/unit/test_batch_pipeline_cohort_config.py` and
`tests/unit/test_cross_service_deploy_contract.py`: all pass, including
the two new tests. On this Mac the `test_rollout_wait_*` /
`test_rollout_verify_*` cases need GNU `timeout`, which macOS lacks;
they were run with a local stand-in for it.
- The pre-push suite selected for this change passed except
`tests/unit/test_monitoring_notification_contract.py`, which needs Go
(not installed here) and reads nothing this PR touches; left to CI.
- `helm lint` of the chart with the production values: no failures.
- Not verified: nothing was deployed. The worker reading the store in
production, and a wake sent for an admitted owner, are not exercised by
this PR.

## Tests

`backend/tests/unit/test_batch_pipeline_chart.py`:

- `test_production_workers_read_the_flag_store_the_serving_roles_read`:
every GPU pump deployment rendered from the production values names the
same project and database as the serving integration role in the runtime
manifest.
- `test_worker_without_a_flag_store_renders_no_flag_store_binding`: the
default chart renders no `OMI_FLAGS_*` name.

## UI evidence

UI-Evidence: none -- chart values and a chart test only

## Failure class (fixes)

Failure-Class: none

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Nizarius added a commit that referenced this pull request Nov 27, 2026
…il reaches the first summary (live_words_cascade) (#26473)

## What changed and why

`live_words_cascade`: one per-account flag store rule (the family of
#26348), app and backend, inert for an account its rule does not admit.
No rule exists for it. The page of a conversation in progress went
separately in #26467; this is the live-words half of the same work.

Builds on `vendor_recognizer_on_opened_app`; its End parts also need
`end_open_conversation`.

- **Order.** Per stretch of audio time the grey live words show the
provider's words where it has them and the phone's own recogniser's only
where it has none (the reverse of today); stored text still replaces
both. The phone's recogniser is not started for an account whose
language is multi-language or outside its list. Its phrases are joined
into one paragraph instead of one line each, and a line rebuilt from
part of its words no longer starts with a space.
- **How long a grey word stays.** Until a stored line covers its moment
of audio (2 s reach) or, where stored text exists to compare with, until
it is five minutes old. This replaces, under the flag, the rule that
dropped every live line older than the last stored line minus 10 s. A
conversation that has ended keeps the live words of its own time range
on its page by the same rule.
- **An End cuts the live words** at the End instant (the
`X-Omi-Ended-At` time), per word, for every screen, and the phone tells
the display connection (`{"type":"end"}`), so the provider's line in
progress breaks there.
- **The End's tail reaches the first summary.** The End request carries
`live_tail`, the words shown for the conversation being ended (at most
600 words). The backend checks and bounds it, keeps it encrypted with
the stored End and nowhere else, and adds the words no stored line
covers to that conversation's notes prompt, marked as a draft. The count
the notes read and the time of its first word are stamped on the
conversation; the late-speech rewrite rule takes stored words that land
in that stretch to be the same speech, up to that count, and a summary
pass still running when that speech lands settles instead of writing the
notes again. Speech from before that stretch that lands late counts in
full, as before.

**Trust boundary, stated plainly.** `live_tail` makes phone-authored
text an input to one model prompt for an admitted account. That is a
deliberate exception to the rule that client-authored text is display
only, which `tests/unit/test_client_processing_trust_boundary.py` proves
for `client_processing`; that field and that test are untouched. The
bounds: only under the flag; a separate request field hidden from the
published schema; 600 words / 6,000 characters / 200 lines; control and
bracket characters removed; only words that start before the End, at
most six hours before it and inside the conversation; dropped wherever
stored text exists; never written to a conversation, a recording row or
a transcript; one reader (the `transcript=` argument of the notes
prompt). What the notes say (title, summary, the action items they
propose) can therefore reflect those words, and so can whatever reads
the notes; the discard and wake-word checks, memory extraction and
search read the stored transcript alone.

Change note:
`backend/docs/listen_pusher_pipeline/changes/2026-11-26-live-words-cascade-end-tail-title-at-end.md`.

### Known limits

- An End with a tail must reach a backend that has this change: an older
one does not take `live_tail` for part of the app's Finish body and
answers 404 where it would have finished the recording. The flag tool's
live check refuses to admit accounts before the serving commit includes
the key.
- The stored tail is removed when a later summary pass finds it covered,
when the credit is used up, or at the owner's next End with a tail (Ends
one to eight days old). There is no timed sweep, so a tail whose speech
never lands can stay (encrypted, at most 6,000 characters).
- A summary pass writes the tail count to the conversation before the
notes are written; a grouping pass that had already loaded that
conversation loses its commit race once and is retried.
- A grey word that stored text never covers sits under newer stored
lines for up to five minutes, because grey lines are drawn after the
transcript.
- `/v4/live-words` still needs a load-balancer path rule before a wide
ramp (unchanged).

## Product invariants affected

- INV-CAP-1: `app/lib/services/capture/capture_controller.dart` and
`capture_composition.dart` gain one optional callback that an End calls
after it has sealed the open phone file. With `live_words_cascade` off
the callback returns null and the End request is byte-for-byte what it
was; capture, upload and receipt handling are unchanged in both modes.
- INV-MEM-4: `backend/utils/conversations/process_conversation.py`
changes in one argument of the notes prompt builder. Memory intake,
consolidation and promotion are untouched; memory extraction reads the
stored transcript, never the tail.
- INV-TASK-2: the same one-argument change. No capture-policy outcome,
Candidate path or writer changes; action items the notes propose go
through the path they went through before. For an admitted account the
notes prompt can contain the tail's words, so a proposed item can come
from them.

## How it was verified

- On an iPhone 16 Pro with an Omi pendant against a local prod-parity
stack, flags selected through the development override:
- cascade: twenty minutes of real speech with the provider's words
replacing the phone's on screen (local counters: most of the phone
recogniser's words replaced, a handful only it had, no recogniser
restart);
- one End pressed mid-speech: every live line left the list at the End
instant, the display stream logged its line break at the same moment,
the server stored the tail and the summary pass read the uncovered part;
- On the local stack with a probe and fresh accounts (`live_tail` sent
with an End, then the same speech uploaded): the first summary held
facts that existed only in the tail, the stored transcript held only the
batch text, and the landing 6 s later left the summary as it was (no
rewrite). The same run without a tail wrote a second summary.
- Backend: the changed and neighbouring test files one file per process;
`backend/scripts/typecheck.sh`; `scan_async_blockers.py`.
- The phone and stack runs above were made before this branch was
rebased onto #25992, which moved the grouping pass's planning loop into
`_plan_projection`; the tail credit was carried into it unchanged and
the backend tests were run again afterwards.
- App: `flutter test` on the live-preview, unit, widget, page and
provider folders; `dart analyze lib` no errors.

Not verified: Home's Listening row, the Listening page and the next
conversation right after an End with speech continuing (the test phone
was restarted seconds after the End); the five-minute rule, the joined
paragraph and the indent fix on a phone's screen (unit tests only); a
language outside the phone recogniser's list on a phone; a landing that
brings substantially more than the tail on a stack (unit test only); the
per-account form of the flag against a real flag store (the local stack
uses the development override).

## Tests

- `backend/tests/unit/test_reliability_experiment_live_words_cascade.py`
(43 cases): per-account switch, payload bounds and plain text, encrypted
storage with the End, covered words dropped, transcript never written,
the prompt as the only reader, rewrite accounting, the settle rule,
removal of stored words, the display line break.
- `app/test/services/live_preview/live_words_cascade_test.dart` (46
cases): reversed merge, joined paragraph and spacing, language rule,
counters, watchdog, the End cut per word on the inputs of all three
screens, a conversation's own time range, the
stored-text-or-five-minutes rule, the tail payload and the End request
body, the End message on the display connection.

## UI evidence

UI-Evidence: none -- the grey live words keep the look merged in #26394;
what changes is which words are listed and for how long (asserted in
`live_words_cascade_test.dart`), and the screenshots taken on the test
phone show real speech, so they are not published.

## Failure class (fixes)

Failure-Class: none

Line-Count-Exception: app/lib/backend/http/api/conversations.dart | 1780
-> 1787 | one optional field on the End request beside the header it
travels with
Line-Count-Exception: app/lib/pages/conversation_detail/page.dart | 1874
-> 1900 | the flag-gated branch that picks a conversation's live words
by its time range, inside the function that already picks them
Line-Count-Exception: app/lib/services/capture/capture_controller.dart |
5138 -> 5149 | one optional callback an End calls after sealing the open
phone file
Line-Count-Exception: backend/routers/conversations.py | 3358 -> 3365 |
passing the optional tail to the End's stored cut
Line-Count-Exception:
backend/utils/conversations/process_conversation.py | 3614 -> 3622 | one
argument of the notes prompt builder and its comment
Line-Count-Exception: backend/utils/conversations/v3/service.py | 2013
-> 2051 | the tail credit beside the rewrite rule it adjusts and the
tail read beside the notes call it feeds

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant