Skip to content

perf(v3): keep the stored outlines of stretches a builder pass did not visit (outline_keep_stored, default off) - #26832

Closed
Nizarius wants to merge 6 commits into
mainfrom
perf/outline-reuse-unchanged-stretch
Closed

Nizarius wants to merge 6 commits into
mainfrom
perf/outline-reuse-unchanged-stretch

Conversation

@Nizarius

@Nizarius Nizarius commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

What changed and why

The v3 builder stores each stretch's outline in a list on its lease and reuses an entry only on an exact key match (the stretch's lines, the prompt and the context block). A pass that is not partial rebuilt that list from the stretches it loaded and wrote it over the stored one, so the outline of every stretch it did not load was dropped although nothing about that stretch had changed. When the stretch was loaded again (a late line elsewhere in its recording; any segment write to a recording row, a speaker field write included, re-arms it), the pass found no entry and sent the model the same prompt again. A cache key gets two model attempts, so a third visit takes the fallback outline.

Measured on production, 2026-11-29 and 2026-11-30 (read-only; time, token and count fields):

  • 12.6% of the cache keys in a sample of builder leases had been sent to the model twice (the per-key attempt counts the lease keeps). That is about 11% of outline calls.
  • 14% of outline calls with a prompt of 1,200 tokens or more were served from the provider's prompt cache for all but a few tokens: the identical prompt had been sent minutes before. They carry 13% of outline prompt tokens.
  • No call had a partly cached prompt. A changed context block or preceding-conversation line over unchanged lines would show as a cached prefix with a new tail, so that was not a measurable cause.
  • The repeated call does not return the same answer: for about 70% of repeats of large prompts the answer's length differed by more than 10% from the earlier one.
  • On-open passes are not the cause: the per-caller pass metric showed builder passes only over 24 hours.

The change. Experiment outline_keep_stored, a per-account Omi flag store rule, default off. On, a live builder or on-open pass keeps the stored outlines of stretches it did not visit (outline.with_unvisited):

  • only successful model outlines: a failed outline leaves the list as on main, and timing previews are not kept;
  • newest first, within 128 rows (the bound save_outline already applies during a pass) and 256 KiB of JSON; the pass's own rows are never dropped;
  • a kept row is marked kept until a pass visits its stretch again.

The cache key is unchanged: a stretch whose lines, prompt or context changed is outlined again as before, and a reused entry is the model's own answer to exactly that key. Backfill and re-derive passes are untouched. Off, the list is written as on main.

Two visible differences, both where main loses the model's outline and the experiment still has it:

  • A stretch that was outlined while finished and is later loaded while it is not ready for an outline (it became the last stretch of the pass) keeps showing its outline. On main it keeps it for one such pass and then shows the placeholder until it is ready again.
  • The third visit. On main a third visit to an unchanged stretch finds both model attempts of its key spent and plans from the fallback outline, whose title is the stretch's first seven words. A published conversation keeps its own title, but that stand-in title is what the model is given as the preceding conversation when the next stretch is outlined in the same pass. With the experiment on, the model's outline is still stored, so the next stretch's prompt carries the real title. The wording of a title outlined after that point can differ between the two; which conversations exist, their cuts, transcripts, statuses, summaries owed and deliveries do not. A model that answers a repeated prompt differently has the same effect one visit earlier: main's second answer replaces the first as the preceding conversation of the next stretch, and the experiment keeps the first answer.

new: metrics. omi_conversations_v3_outline_reuse_total{source} counts hits on the stored list: visited (a hit main also has), kept (a model call saved by the experiment), kept_open (the difference above). Three series per instance, added to the backend-sync scrape keep rule (deploy/cloud_run_gmp_sync.yaml). Compare kept with omi_conversations_v3_model_calls_total{kind="outline"}.

Expected effect when on for every account, from the same two days: about 11% fewer outline calls, 13 to 21% fewer outline prompt tokens and 4 to 12% less outline model cost. The low end counts only repeats the provider cache proves identical (already billed at the cached rate); the high end adds same-size repeats whose provider cache had gone cold. Each saved call also frees its builder queue slot for the length of the call, and skips the two lease transactions around it. Firestore operation counts do not rise; the lease document grows by the kept rows (bounded above).

Rollback. Deactivate the rule: the next pass that is not partial drops the kept rows. No stored data needs repair either way.

Not covered.

  • A stretch that grows by a line or two after its first outline is outlined again in full. This is the larger share of repeated outline work: 39 to 51% of large calls continued an earlier, slightly smaller call of the same account, more than a third of them within 90 seconds, and on the heavier day chains of eleven or more such calls carried 47% of large-call tokens. Holding the first outline of a finished stretch until its lines stop arriving would remove most of it, but it delays that stretch's first title, so it is left out here.
  • A stretch loaded without its predecessor has another context block and another key.
  • Identical prompts whose key changed without the prompt changing (line clock or row changes the prompt does not show) are not reused.

Change note: backend/docs/listen_pusher_pipeline/changes/2026-11-30-v3-outline-keep-stored.md.

Product invariants affected

none

How it was verified

Pipeline lab (backend/testing/pipeline_lab/): the real v3 code on a Firestore emulator and Redis, looped-back named tasks on a virtual clock, a scripted fake model gateway.

  • New scenario outline_kept_across_passes (experiment on): one recording with two stretches, three later recordings, and three late lines that each make the builder load the first recording again. It passes twice with identical results (scenario run outline_kept_across_passes --repeat 2); its model-call budget is the measured count with the experiment on (45).
  • scenario compare with three arms (origin/main at 28876df, this branch with the experiment off, this branch with it on) over the 20 scenarios that set no experiment of their own plus the new one's story:
    • Off against main: 0 of 292 metric keys differ (reads, writes, deletes, no-op writes, model and STT calls, outcomes, speakers, and per scenario the notes digest, titled and summarised counts and memory inputs).
    • On against main: no conversation differs in any scenario (recordings, visibility, hidden reason, words, manual end), and the notes digest, titled count and memory inputs of every scenario are the same. In the 19 older scenarios every count is the same. In the new scenario: 45 model calls against 46, 1,258 reads against 1,263, 325 writes against 328. Main and the off arm fail that scenario on one check only, its model-call budget.
  • The same three arms over the seven stage_queues_* scenarios, with stage_queues on in every arm: 0 of 105 metric keys differ in either arm.
  • All 27 committed scenarios pass on this branch (scenario run --jobs 4).
  • Before the change, a trace of the same story on main showed the unchanged first stretch looked up three more times with the same key and the same prompt and missing the list each time: one model call, then the fallback outline twice (both attempts spent).

Firestore emulator, off against on (backend/tests/integration/test_conversations_v3_outline_keep_stored_firestore.py, run by backend/scripts/run-emulator-proofs.sh). Two accounts in one database, one admitted to the experiment through the per-account resolver, are told the same story; after every builder pass everything stored under the two accounts is compared, the builder's lease document apart: every conversation (title, overview, transcript, span, status, visibility, the recordings it was cut from, the summary it owes or has), every recording row, the Home feed rows, which summaries were written and from what input, which conversation-created deliveries went out, and whether a conversation kept its id. Real: the builder pass, its lease and attempt counters, the summary stage's begin, persist and settle writes, the created-delivery claim, the speaker field write. Faked: the outline, live-title and summary models, Cloud Tasks, the integrations fanout. The v3 settings are read from deploy/runtime_env.yaml (backend-sync). The fake outline model's answer carries a digest of the whole prompt, so a prompt that differs by one word shows as another title.

  • Six stories with a model that gives the same answer to the same prompt: a late piece that reloads an unchanged stretch, a speaker named on a line (twice), an app open followed by a late piece, speech the model cannot outline (visited until both attempts are spent), an outline aged out of the bounds, a capture in progress with a late piece for an older recording. Nothing stored differs in any of them, at any pass. The baseline account repeats one or two prompts per story; the admitted account repeats none and asks nothing the baseline did not.
  • The third visit, and a model that answers a repeat differently: the two stories that pin the second difference above. Everything but the model's wording still matches at every pass, no stand-in title reaches a conversation in either account, what was on Home before keeps its title and overview, and the wording differs only on the conversations cut from the late pieces that arrived afterwards.
  • The comparison itself is checked: one changed title in one account fails it. Three deliberate breakages of the change each fail the suite (a failed outline kept; a kept outline returned with another title; a kept outline used for a stretch whose speech changed).
  • Baseline = main: the same five stories run on main's own service.py, outline.py, metrics.py and reliability_experiments.py left the baseline account with exactly what it has on this branch at every pass, model calls included (a local run, not part of the suite).

Not verified:

  • The emulator stories run under default timing only (no custom silence or lock seconds, so no timing previews) and at one instant: a stretch crossing its lock delay between passes is not in them (the lab's virtual clock covers that). The first difference above (a stretch loaded while not ready) is covered by a unit test only. The summary writer in them is a stand-in that goes through the real persist and settle writes; the real summary model is not called.

  • The owner-day replay with its scorer (testing/pipeline_lab/ideal/) was not run: the corpus day and the ideal file are private data on the lab host, and I have neither. A v3 day replay also feeds each recording once at its arrival instant and replays no speaker writes, late units or app opens, so it would not load a finished stretch a second time: it could confirm "no difference", not the saving.

  • The lab's model is a deterministic fake. With a real model the baseline's repeated call can return another answer; this change keeps the first one. A unit probe showed a published conversation keeps its title on main when its stretch is re-outlined, so for published stretches the repeated answer is not used; for a stretch that is still unlocked it can be.

  • Nothing ran against a deployed service or a real model. The production effect above is an estimate from two days of call records and one lease sample.

Tests

  • backend/tests/unit/test_reliability_experiment_outline_keep_stored.py (13 tests): the experiment is registered and off by default; a partial pass keeps every unvisited row unmarked, as before; only successful model outlines are kept and marked; the row and byte bounds hold, newest first, and the pass's own rows are never dropped; off, a stretch another pass skipped is sent to the model again with the same prompt; on, it is reused and counted as kept, with the same planned conversation; changed lines are still outlined again; an on-open pass of one conversation keeps the other outlines when on and drops them when off; a third visit plans from the model outline when on and from the fallback when off; a backfill pass keeps nothing; the counter passes the scrape keep rule.
  • backend/tests/integration/test_conversations_v3_outline_keep_stored_firestore.py (10 tests, Firestore emulator, run by scripts/run-emulator-proofs.sh): described under "How it was verified".
  • Pipeline lab: scenario/scenarios/outline_kept_across_passes.json; scenario/reach.json re-measured.
  • Every test_conversations_v3_*, test_pipeline_lab_*, test_reliability_experiment* and flag-store unit file (110 files, one process each) passes on the merged commit.

UI evidence

UI-Evidence: none -- backend only

Failure class (fixes)

Failure-Class: none

🤖 Generated with Claude Code

Nizarius and others added 6 commits November 30, 2026 18:54
…t visit

A builder pass that is not partial wrote the stored outline list from the
stretches it loaded only, so the outline of every other stretch was dropped.
When such a stretch was loaded again with the same lines and the same prompt
(a late line elsewhere in its recording, a speaker field write that re-arms
the recording row), the pass missed the list and paid for the same model call
again; a third visit took the fallback outline, because a cache key gets two
model attempts.

Experiment outline_keep_stored (Omi flag store rule, per account, default
off): a live builder or on-open pass keeps the successful model outlines of
unvisited stretches, newest first, within 128 rows and 256 KiB. The cache key
is unchanged, so only an exact repeat is answered from the list. Backfill and
re-derive passes are untouched.

omi_conversations_v3_outline_reuse_total{source} counts hits on the list:
visited (as on main), kept (a model call saved) and kept_open. It is added to
the backend-sync scrape keep rule.

Failure-Class: none

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Both sides register an experiment and add a counter to the backend-sync
scrape keep rule; the scenario reach map is re-measured with both sets
of scenarios.

Failure-Class: none

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

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

Two accounts in one database, one admitted to the experiment through the
per-account resolver, are told the same story; after every builder pass
everything stored under them is compared, the builder's lease document
apart: conversations, recording rows, Home feed rows, the summaries
written and from what input, the created deliveries, and whether a
conversation kept its id.

Real: the builder pass, its lease and attempt counters, the summary
stage's begin, persist and settle writes, the created-delivery claim and
the speaker field write. Faked: the outline, live-title and summary
models, Cloud Tasks and the integrations fanout. The v3 settings are read
from deploy/runtime_env.yaml (backend-sync).

Stories: a late piece that reloads an unchanged stretch, a speaker named
on a line, an app open, speech the model cannot outline, an outline aged
out of the bounds, a capture in progress. With a model that gives the
same answer to the same prompt nothing stored differs in any of them.

Two stories pin the one place the accounts part. On its third visit to
an unchanged stretch the baseline has spent both model attempts, plans
from the fallback outline and hands its first-words title to the model
as the preceding conversation of the next stretch; the experiment still
holds the model's outline. A model that answers a repeat differently has
the same effect one visit earlier. Conversations, cuts, transcripts,
statuses, summaries owed and deliveries stay the same; the wording of
titles outlined afterwards can differ. The change note says so.

The suite joins the emulator proofs.

Failure-Class: none

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

The emulator proofs job has a 20 minute limit and the suite took 106 s of it: the
comparison listed subcollections with one request per document, and every test
re-read the runtime env file. One recursive query per top-level collection and a
cached settings read bring it to about 30 s. The recursive walk was checked against
the per-document walk on every comparison of a full run: same documents.

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

Nizarius commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator Author

Closed in favour of #26875, which carries this PR's head unchanged (merged in with a merge commit) together with seven other open PRs, so they take one pass through CI instead of eight. The description and review notes here stay the reference for this part.

@Nizarius Nizarius closed this Dec 1, 2026
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Hey @Nizarius 👋

Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request.

After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:

  • Project standards — Ensuring consistency across the codebase
  • User needs — Making sure changes align with what our users need
  • Code best practices — Maintaining code quality and maintainability
  • Project direction — Keeping aligned with our product principles and locked invariants

Before your next PR, please skim:

  • PRODUCT.md — product north star
  • Product invariants — locked rules (shared chat, memory tiers, agent control plane, integrations, brand)

If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing.

Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out.

Thank you for being part of the Omi community!

Nizarius added a commit that referenced this pull request Dec 1, 2026
…y switch off (#26875)

## What changed and why

Open pull requests from the backend bottleneck work, joined into one so
they take one pass through CI
instead of one each. Two of the eight parts (#26862, #26851) have since
merged on their own; this PR carries
the same commits, so they add nothing to its diff. Six of them add a row
to the same three flag files (`config/feature-flags.yaml`, the
generated registry page, `backend/config/reliability_experiments.py`),
so merged one at a time each merge made
the next one conflict and cost it another full CI run.

Each part is the head of its own PR, merged here with a merge commit, so
the history of every part is intact.
The original PR carries the full description, measurements and review
notes of its part; they are closed in
favour of this one.

| Part | Original PR | Switch | What a merge changes in production |
|---|---|---|---|
| Flag budget renewal | #26862 (merged) | none | Already on main. |
| GPU worker floor 6 to 12 | #26851 (merged) | none | Already on main.
Nothing changes until the worker chart is rolled by the release owner. |
| Fresh class for just-recorded phone audio | #26848 |
`fresh_class_for_new_audio`, off | One more histogram label; one
in-process flag evaluation per qualifying upload. |
| Commit wake made dependable and measured | #26860 | `commit_wake`
(existing), off | New counters and two histograms for every account;
behaviour only for admitted accounts. |
| Declared unsupported language stays on the vendor route | #26870 |
`declared_unsupported_language_route`, off | Nothing without a rule. |
| One capture transport per listen session | #26822 |
`one_capture_transport`, off | Nothing without a rule, on the backend or
in a new app build. |
| Stored outlines of unvisited stretches are kept | #26832 |
`outline_keep_stored`, off | One new metric; nothing else without a
rule. |
| Live builder pass with fewer database requests | #26868 |
`lean_builder_pass`, `outline_context_on_demand`,
`tombstone_check_written_rows`, all off | Nothing without a rule. |

No flag store rule exists for any of the seven new switches, so no
account's behaviour changes at deploy.

### The parts in one paragraph each

- **Flag budget renewal (#26862).** Carries the three-file change of
#26600 (SCA-3850) onto current main: the
26 rows of `backend/config/flag_budget.json` that passed `review_by` on
2026-11-30 move to 2026-12-06 with
the reasons #26600 gives. One difference from #26600, after review: the
five rows that already carried a
row-specific reason (`BATCH_PIPELINE_PROTECTED_SHARE_ENABLED`,
`BATCH_PIPELINE_PROTECTED_SHARE_PERCENT`,
`SYNC_BACKFILL_WORKER_API_URL`, `SYNC_BACKFILL_WORKER_AUDIENCE`,
`LISTEN_BATCH_RECONNECT_ENABLED`) keep that
text, with the renewal sentence appended. No rollout setting or runtime
value changes.
- **GPU worker floor (#26851).** `replicaCount` and
`autoscaling.minReplicas` of the production batch worker
go from 6 to 12; `maxReplicas` stays 16. Nodes for the weekday peak
cannot be obtained on the day, so the
floor is the only setting that has them in place before the ramp. In a
replay of nine weekdays it about
  halves the mean wait for a worker for 27% more worker node-hours.
- **Fresh class for new audio (#26848).** A phone upload in the backfill
lane whose audio is at most 10 minutes
old is served with the fresh class (job row `priority` 0,
`admitted_priority` 1). Metering, the enrichment
queue and admission still read the admitted class. It reorders the GPU
queue and adds no capacity; the ramp
in the flag row stops at 25% until GPU capacity covers the weekday peak.
The GPU worker image must carry
  this build before the first rule is created.
- **Commit wake (#26860).** A wake that meets a busy account claim is
retried (0.5, 1, 2, 4 s), the first walk
waits 0.5 s, and serving-side commits of an admitted account ask the
in-process owner drain. Counters at
both ends and `commit_to_text` / `ready_to_text` histograms by path and
cohort. In the local load test,
  commit to written fell from a median of 11.2 s to 0.52 s.
- **Declared unsupported language (#26870).** For a multilingual-profile
user (#26431), a declared language
Parakeet cannot serve stays the declaration, so the upload takes the
vendor route at admission: no language
probe, no GPU unit, no refusal, no recovery wait. Supported and unknown
declarations, legacy-on owners and
  the record lane are unchanged.
- **One capture transport (#26822).** With the rule on, a batch-only
session sends no pendant audio on the
socket and a live session gets no phone-file grant, so the same audio is
no longer transcribed twice. Admit
accounts to `end_open_conversation` together with this rule: without
socket audio the baseline End closes
nothing. Stored text then depends on the phone's serial upload queue
alone.
- **Stored outlines kept (#26832).** A live builder or on-open pass
keeps the stored outlines of stretches it
did not visit, so a later visit with the same lines and prompt reuses
the model's answer instead of paying
  for it again. About 11% fewer outline calls with every account on.
- **Fewer database requests per builder pass (#26868).** Three
experiments remove bookkeeping reads and
writes of the live builder pass. On a synthetic day against the
Firestore emulator: same documents and
prompts, reads down 35%, writes down 19%. `tombstone_check_written_rows`
touches the commit's deletion
guard: please review it as such, and agree it with the owner of
conversation deletion before any account is
  admitted.

### Where the parts meet

- `_reconcile_outlines` in `backend/utils/conversations/v3/service.py`
now takes both `keep_stored` (#26832)
and `clock` (#26868). The two do not interfere: a stretch found by its
lines key keeps its stored
fingerprint, and `outline.with_unvisited` drops stored rows by that
fingerprint as before.
- `config/feature-flags.yaml`: the `commit_wake` row is #26860's; #26822
only adds its own row beside it.
- `backend/testing/pipeline_lab/scenario/reach.json` was measured again
on the combined branch.
- `backend/docs/feature-flag-registry.md` was rendered again from the
combined YAML.

### Changed after the automated review

The review bot left 34 comments. One was not valid, three are answered
without a code change, the rest are
fixed in this PR. Behaviour with every switch off is unchanged by all of
them. What changed in behaviour:

- **`one_capture_transport`, app half.** Safety copies are left untagged
per conversation window, by whether
pendant audio was really kept off the socket in that window, not by the
socket's mode when the conversation
closes. Before, phone-microphone copies (always sent) could end marked
as sent with no conversation id and
no upload. The app half now does nothing unless `end_open_conversation`
is also on for the account, because
without socket audio the baseline End closes nothing. The flag row makes
that pairing a precondition of
every cohort. The flag texts now say the rule covers the grant that
comes with the on-phone preview; the
  Standard cohort grant is unchanged and listed as a known limit.
- **`declared_unsupported_language_route`.** With language inheritance
switched off
(`BATCH_PIPELINE_LANGUAGE_INHERITANCE_ENABLED=false`) and a conversation
language that declares nothing, the
kept declaration was lost and the upload went to the GPU. Serving and
shadow intake now take one kept value.
- **`commit_wake`.** The retry set held a busy-claim token no walk
returns (it mattered only with the owner
drain switched off); corrected. `ready_to_text` now times a vendor-route
row without `ready_at` from its
  settle instant, as the ordered merge does.
- **`tombstone_check_written_rows`.** The ramp now starts with a step
that admits no account until the owner
  of conversation deletion has agreed the change to the deletion guard.
- **Simulator and lab.** The pipeline simulator clears an inherited
`OMI_RELIABILITY_EXPERIMENTS`; the lab's
final verdict carries STT routes and queue counts; a scenario's `route`
is validated when it is loaded.
- **Docs.** Wording corrected where it promised more than the code does
(the fresh-class pause is a bound on
promotions, not a guarantee for units already fresh; `served` is the
class on the job row, not who
transcribed the unit; when `lines_key` is written; which rollout
readouts are fleet-wide).

### CI

The first run of this PR had its emulator proofs job cancelled at the
20-minute limit (the job took 18.4 to
19.5 minutes on main that day; this PR's three added proofs take about
70 s there). #26882 has since raised
the limit to 25 minutes on main, so this PR changes no workflow.

### Tuning

- MAX_READY_UNITS (#26848, fresh ring size at which promotion pauses),
new: 600 waiting units, about 30 s of
fleet work at the weekday peak's lease rate; promotion resumes under
300.
- MAX_TIMED_OWNERS (#26860, receipt times kept for the wake start
histogram), new: 8192 accounts per process.
  Past it a wake still walks, untimed.
- SETTLE_SECONDS (#26860, wait before a wake's first walk): before 0 s,
after 0.5 s.
- BUSY_RETRY_DELAYS (#26860, retries of a wake's walk after a busy
account claim): before 0 retries (the wake
  was dropped), after 4 retries at 0.5, 1, 2 and 4 s.
- Worker floor (#26851): before 6, after 12 (`replicaCount` and
`autoscaling.minReplicas`); `maxReplicas`
  stays 16.

### Not in this PR

#26857 (the sweep that gives a lost memory extraction its task back) is
left out. #26859, merged to main on
2026-12-01, recovers the same lost memory obligations with its own
re-drive in the builder sweep, so the two
would now run side by side. #26857 stays open for its author to rework
or close.

Line-Count-Exception: backend/utils/batch_pipeline/scheduler.py | 1529
-> 1534 | the enqueue takes the served class and a rejoining row returns
to its admitted class; both belong to the two functions that own the
ring
Line-Count-Exception: backend/utils/batch_pipeline/projection.py | 1978
-> 2003 | the walk now returns its stop reason to the caller
(`walk_owner`, with `project_owner` kept as a wrapper for its existing
callers) and names its origin for the commit-to-text series; one observe
call, two origin markers and the method's signature and docstring.
Splitting the projector is outside this change.
Line-Count-Exception: app/lib/services/capture/capture_controller.dart |
5265 -> 5276 | call sites of the experiment at the per-packet routing
boundary, socket publish, socket close and the status handler; its state
and helpers are in the new part file capture_one_transport.dart
Line-Count-Exception: backend/routers/listen/receiver.py | 3066 -> 3070
| two one-line calls and their two imports; the logic is in
routers/listen/local_preview.py
Line-Count-Exception: backend/utils/conversations/v3/service.py | 2570
-> 2647 | the experiments' branches sit in reconcile and
_reconcile_outlines beside the baseline calls they replace, so the two
paths can be read side by side and deleted together when the rollouts
end; the old branches and the switches go then
Line-Count-Exception: backend/database/conversations_v3.py | 3075 ->
3171 | PendingPage, the pending page clear_terminal_pending returns and
the batched source read share load's private helpers and the commit's
tombstone decision is carved out of its write loop in place; the
baseline paths they duplicate are removed when the rollout ends

## Product invariants affected

- INV-CAP-1: the change of #26822 is in the capture routing boundary
(`app/lib/services/capture/capture_controller.dart`,
`capture_conversation_custody.dart`). No packet loses custody: one that
is not sent is already in a phone file or the safety copy, and one the
safety copy refused is sent as before. Tests follow each packet to
exactly one place.

## How it was verified

Each part was verified on its own branch; the commands and results are
in its PR. On the combined branch:

- Unit, after the review fixes: the test files the parts change, every
`test_conversations_v3*`,
`test_reliability_experiment*`, pipeline lab and simulator file, the
batch intake, commit, projection,
scheduler, admission and language files, the local preview and Standard
batch files, the Firestore query
shape guard and the flag files, plus the multipart and part-retirement
files, every unit file that exercises batch intake and the unit files
main changed since: 216 files, 9,661 tests, all pass
  (`BACKEND_UNIT_TEST_FILE_LIST=<list> bash test.sh`).
- App, after the review fixes: `flutter test` on
`one_capture_transport_test.dart`,
`local_preview_admission_test.dart` and
`reliability_experiments_test.dart`: 73 pass; `flutter analyze` on
  the changed files: no issues.
- Firestore emulator: the integration files of #26868, #26832, #26870
and #26860 plus
`test_conversations_v3_unchanged_writes_firestore.py`: 45 tests pass,
also after the review fixes. After
the merge of #26847 (multipart reads and part retirement, which meets
`tombstone_check_written_rows` in the
projection commit) the same files plus
`test_conversations_v3_finish_emulator.py` and
`test_v3_multipart_transcript_firestore.py`: 92 pass; after the merge of
#26771 and #26873, with the locked
  closure cost and live catch-up files added: 104 pass. One of them,
`test_naming_a_speaker_rearms_a_recording_and_nothing_stored_differs`,
failed when run between 07:34 and
08:00 UTC, because the story's first recording (26 minutes, starting
eight hours before the run) then
crosses midnight UTC and the baseline outlines one more stretch. The
test now starts that recording half an
  hour earlier in that case, and the file passes inside the window.
- Pipeline lab, all 30 committed scenarios: 30 pass (`scenario run
--trace-calls`, the run `reach.json` was
measured from), 30 pass again after the review fixes, and all 31 (main
added one) after the last merge of main.
- Pipeline lab, old against new, run before the review fixes (`scenario
compare`, four arms: `origin/main`, this branch with every switch
off, with the four v3 switches on together, with all eight switches on
together). With the switches off,
every scenario main can run (28 of 30) has the same conversations and
exactly the same reads, writes and
no-op writes as main. With the switches on, no conversation differs;
reads fall 10.6% and writes 9.3%
over those scenarios, and the four v3 switches together give the same
result as all eight. The four
scenarios whose verdict changes with a switch are the ones written to
show that switch
(`fewer_requests_two_talks_and_late_sync`, `outline_kept_across_passes`
and the two
  `stt_route_declared_unsupported_language_*`).
- `scripts/check_feature_flag_registry.py`: OK. `scripts/pr-preflight`:
65 of 65 checks pass.

Not verified on the combined branch: a running stack, a phone,
production. The app half of #26822 was run on
a test phone from its own branch (results in #26822), not from this one,
and that run predates the changes
made in review (per-window untagging, the `end_open_conversation`
guard): tests are their only evidence.

## Tests

Every part brings its own tests (listed below). Added or strengthened in
review: the per-window untagging,
the `end_open_conversation` guard, a capture-end flush and the hold
counters in the app tests; the provider
open and the warm-before-admission order in
`test_reliability_experiment_one_capture_transport.py`; the kept
declaration with inheritance off in the three language test files; the
real projector walk with the claim held
and the vendor-row ready time in
`test_reliability_experiment_commit_wake.py`; changed lines against a
stored
outline in `test_conversations_v3_fewer_requests.py`; a real opened
conversation in
`test_reliability_experiment_outline_keep_stored.py`; the simulator's
inherited override in
`test_pipeline_sim_new_audio_wait.py`; the lab verdict's routes and the
route names at load.

- #26848: `tests/unit/test_reliability_experiment_fresh_class.py`,
`tests/unit/test_pipeline_sim_new_audio_wait.py`.
- #26860: `tests/unit/test_reliability_experiment_commit_wake.py`,
`tests/integration/test_batch_commit_wake_firestore.py`.
- #26870: `tests/unit/test_batch_multilingual_profile_routing.py`,
`tests/unit/test_batch_admission_language.py`,

`tests/integration/test_batch_declared_unsupported_language_route_firestore.py`,
two pipeline lab scenarios.
- #26822:
`tests/unit/test_reliability_experiment_one_capture_transport.py`,
  `app/test/services/capture/one_capture_transport_test.dart`.
- #26832:
`tests/unit/test_reliability_experiment_outline_keep_stored.py`,

`tests/integration/test_conversations_v3_outline_keep_stored_firestore.py`.
- #26868: `tests/unit/test_conversations_v3_fewer_requests.py`,
`tests/integration/test_conversations_v3_fewer_requests_firestore.py`,
one pipeline lab scenario.
- #26851: `tests/unit/test_batch_pipeline_chart.py` and the two HPA
replay files follow the new floor.
- #26862: `tests/unit/test_flag_budget.py` follows the new dates.

## UI evidence

UI-Evidence: none -- no screen changes

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

1 participant