Repository navigation
fix(batch): keep a declared unsupported language on the vendor route for multilingual-profile users - #26870
fix(batch): keep a declared unsupported language on the vendor route for multilingual-profile users#26870Nizarius wants to merge 4 commits into
Conversation
…for multilingual-profile users The multilingual-profile rule (#26431) stops trusting a supported conversation pin for a multi-language user whose live speech shows a language batch Parakeet cannot transcribe. Its two intake lines drop every declaration of such a user, also an unsupported one: a user who declares Japanese and speaks Japanese live is admitted as multi on the GPU route, probed, refused by the worker (unsupported_language) and transcribed by a vendor only after the recovery sweep. Before the rule the declaration gave the upload the vendor route at admission. Flag store rule declared_unsupported_language_route (default off, per account): for such a user, a declaration that is a known language Parakeet cannot serve stays the declaration and the inherited language, so select_route admits the upload on the vendor route with no probe and no GPU unit. A supported or unknown declaration is still dropped and classified on audio. Serving intake and shadow intake decide through one helper; the rule is read only for an upload it can change, from the process's flag-store snapshot. With the rule off the two functions answer what they answer on main (tested value for value). Failure-Class: none Co-Authored-By: Claude Fable 5.2 <[email protected]>
…h the declared-language rule on and off The lab's routing step modelled only owners whose legacy sync is on, where an excluded upload goes to legacy. With "legacy_sync": "draining" or "dark" in the routing inputs it now follows intake for an admitted upload: a declared language Parakeet cannot serve goes to the vendor at admission (no probe); anything else goes to the GPU, a multi upload is probed once, and a frozen verdict that is not Parakeet's is a refusal the vendor serves after recovery. The product's own helpers decide each step, including the experiment declared_unsupported_language_route from the arm's env; the refusal and the recovery are a label on the route, their wait is not modelled. - A recording expectation can pin what routing decided (route, route_reason, lid_probes, gpu_refused); metric stt_routing counts GPU refusals and vendor admissions. - Scenarios stt_route_declared_unsupported_language_vendor (rule on) and stt_route_declared_unsupported_language_gpu_refused (rule off) run one synthetic upload through the route and on through the batch worker, projection, v3 builder and Home. - A committed synthetic language answer for the committed synthetic audio (fixtures/lid/) and synthetic routing inputs (fixtures/stt_routing/), so both run in CI without a private lab root. - reach.json re-measured: the two new scenarios added, the 26 existing ones unchanged. Co-Authored-By: Claude Fable 5.2 <[email protected]>
…supported-language-route
…supported-language-route
There was a problem hiding this comment.
10 issues found across 27 files
Confidence score: 3/5
- In
routing.py, an unsupportedinput_languageis marked refused but still selects a Parakeet cassette, so the test can exercise the wrong recovery path. Use the vendor recovery route and cassette. - In
batch_pipeline_language.py, an unrecognized conversation language can override the user's known unsupported declaration, changing the effective language at intake. Return the effective declaration in this case. - In
run-emulator-proofs.sh, the proof can report PASS when theworldfixture skips against a non-loopback emulator. Gate the proof on a loopbackFIRESTORE_EMULATOR_HOSTso a skip cannot count as success. - The route contract is inconsistent: the change note says contract updates belong in
listen_pusher_pipeline.mdx, but its linkedmultilingual_profileparagraph still describes the old response. Update the contract paragraph to match the new route.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="backend/scripts/run-emulator-proofs.sh">
<violation number="1" location="backend/scripts/run-emulator-proofs.sh:141">
P3: This proof can report PASS without running: its `world` fixture skips for a non-loopback `FIRESTORE_EMULATOR_HOST`, and `run_proof` treats pytest's successful skip exit as success. Gate this invocation on a loopback host and record a failure otherwise.</violation>
</file>
<file name="backend/testing/pipeline_lab/scenario/spec.py">
<violation number="1" location="backend/testing/pipeline_lab/scenario/spec.py:693">
P3: A `recording` check on route fields for a speech-only recording can never pass, and the spec does not reject it. Validate this after the recordings are built, the way the `speakers` block checks for an `audio_file` recording, so an authoring mistake fails at load time.</violation>
<violation number="2" location="backend/testing/pipeline_lab/scenario/spec.py:694">
P3: `route` accepts any non-empty string, so a typo such as `"multilngual"` loads without error and then fails at runtime with an unclear mismatch. Validate `route` against the three names routing defines (`parakeet`, `multilingual`, `mixed`) at load time.</violation>
</file>
<file name="backend/tests/unit/test_batch_admission_language.py">
<violation number="1" location="backend/tests/unit/test_batch_admission_language.py:822">
P3: Move these two function-level imports (`reliability_experiments` and `enqueue_in_transaction`) to the module import block. AGENTS.md requires top-level imports in backend code, and this module already imports from the same packages at top level.</violation>
</file>
<file name="backend/testing/pipeline_lab/README.md">
<violation number="1" location="backend/testing/pipeline_lab/README.md:477">
P2: This bullet states the vendor-at-admission route unconditionally for draining/dark owners. For a multilingual-profile user it only happens when `declared_unsupported_language_route` is on, and with the rule off the upload goes to the GPU and is probed. Name that condition here, for example: "for a multilingual-profile user, only when `declared_unsupported_language_route` is on; otherwise the declaration is dropped and the upload goes to the GPU."</violation>
</file>
<file name="backend/testing/pipeline_lab/scenario/scenarios/stt_route_declared_unsupported_language_gpu_refused.json">
<violation number="1" location="backend/testing/pipeline_lab/scenario/scenarios/stt_route_declared_unsupported_language_gpu_refused.json:27">
P2: These budget caps are copied from `audio_single_recording_finish` with no measured run behind them. This path adds a language probe and a refusal/recovery sweep, so the counts and the 'adds no product operation' note may not hold. Run the scenario and record the measured reads, writes, and STT calls in the note, or adjust the caps to match.</violation>
</file>
<file name="backend/docs/listen_pusher_pipeline/changes/2026-12-01-declared-unsupported-language-route.md">
<violation number="1" location="backend/docs/listen_pusher_pipeline/changes/2026-12-01-declared-unsupported-language-route.md:1">
P2: This note says contract changes belong in `listen_pusher_pipeline.mdx`, but the `multilingual_profile` paragraph it links to was not updated. That paragraph still says such uploads return `multilingual_profile`, which is false with the rule on for a declared unsupported language. Add the rule-on exception and the flag name to that contract paragraph.</violation>
</file>
<file name="backend/testing/pipeline_lab/stt_routing/routing.py">
<violation number="1" location="backend/testing/pipeline_lab/stt_routing/routing.py:185">
P2: Relative `OMI_PIPELINE_LAB_STT_ROUTING_INPUTS` paths now resolve against `backend/`, not the shell's working directory. That silently changes how private inputs are found, and the PR description does not mention it. The docstring's `scenario/fixtures/stt_routing/` example also resolves to a non-existent path; the real path is `testing/pipeline_lab/scenario/fixtures/stt_routing/`. Consider keeping CWD resolution for user paths and applying the backend base only to committed fixtures.</violation>
<violation number="2" location="backend/testing/pipeline_lab/stt_routing/routing.py:644">
P2: An unsupported `input_language` is marked `gpu_refused` below, but this line still selects a Parakeet cassette. Use the vendor recovery route and cassette for this refused upload.</violation>
</file>
<file name="backend/config/batch_pipeline_language.py">
<violation number="1" location="backend/config/batch_pipeline_language.py:140">
P2: When the conversation has an unrecognized language but the user declares a known unsupported one, this returns the conversation value instead of the effective declaration. With language inheritance disabled, intake sends that unknown code to the provider; use `inherited_language()` for the kept-profile case.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
| "legacy_sync"}`). Real inputs are private (a path outside Git); a committed scenario names a synthetic file | ||
| under `scenario/fixtures/stt_routing/`, relative to `backend/`. | ||
| - `legacy_sync` is `on` by default. With `draining` or `dark` nothing is refused to legacy: the upload is | ||
| admitted and routed once from its declared language, as intake does. A known language Parakeet cannot serve |
There was a problem hiding this comment.
P2: This bullet states the vendor-at-admission route unconditionally for draining/dark owners. For a multilingual-profile user it only happens when declared_unsupported_language_route is on, and with the rule off the upload goes to the GPU and is probed. Name that condition here, for example: "for a multilingual-profile user, only when declared_unsupported_language_route is on; otherwise the declaration is dropped and the upload goes to the GPU."
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/testing/pipeline_lab/README.md, line 477:
<comment>This bullet states the vendor-at-admission route unconditionally for draining/dark owners. For a multilingual-profile user it only happens when `declared_unsupported_language_route` is on, and with the rule off the upload goes to the GPU and is probed. Name that condition here, for example: "for a multilingual-profile user, only when `declared_unsupported_language_route` is on; otherwise the declaration is dropped and the upload goes to the GPU."</comment>
<file context>
@@ -465,11 +466,26 @@ differently transcribe identically. With `OMI_PIPELINE_LAB_STT_ROUTING=product`
+ "legacy_sync"}`). Real inputs are private (a path outside Git); a committed scenario names a synthetic file
+ under `scenario/fixtures/stt_routing/`, relative to `backend/`.
+- `legacy_sync` is `on` by default. With `draining` or `dark` nothing is refused to legacy: the upload is
+ admitted and routed once from its declared language, as intake does. A known language Parakeet cannot serve
+ goes to the vendor when it is admitted (`route_reason` `vendor:unsupported_language`, no probe). Anything
+ else goes to the GPU; a `multi` upload there is probed once and, when the frozen verdict is not Parakeet's,
</file context>
| admitted and routed once from its declared language, as intake does. A known language Parakeet cannot serve | |
| admitted and routed once from its declared language, as intake does. A known language Parakeet cannot serve (for a multilingual-profile user, only with `declared_unsupported_language_route` on; otherwise the declaration is dropped and the upload goes to the GPU) |
| {"no_hidden_with": "B"} | ||
| ], | ||
| "budget": { | ||
| "reads": 210, "writes": 60, "deletes": 1, "noop_writes": 5, "vendor_calls": {"stt": 2, "llm": 7}, |
There was a problem hiding this comment.
P2: These budget caps are copied from audio_single_recording_finish with no measured run behind them. This path adds a language probe and a refusal/recovery sweep, so the counts and the 'adds no product operation' note may not hold. Run the scenario and record the measured reads, writes, and STT calls in the note, or adjust the caps to match.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/testing/pipeline_lab/scenario/scenarios/stt_route_declared_unsupported_language_gpu_refused.json, line 27:
<comment>These budget caps are copied from `audio_single_recording_finish` with no measured run behind them. This path adds a language probe and a refusal/recovery sweep, so the counts and the 'adds no product operation' note may not hold. Run the scenario and record the measured reads, writes, and STT calls in the note, or adjust the caps to match.</comment>
<file context>
@@ -0,0 +1,30 @@
+ {"no_hidden_with": "B"}
+ ],
+ "budget": {
+ "reads": 210, "writes": 60, "deletes": 1, "noop_writes": 5, "vendor_calls": {"stt": 2, "llm": 7},
+ "note": "Same caps as audio_single_recording_finish: routing chooses the cassette before the run and adds no product operation."
+ }
</file context>
| @@ -0,0 +1,69 @@ | |||
| # A declared unsupported language keeps its vendor route | |||
There was a problem hiding this comment.
P2: This note says contract changes belong in listen_pusher_pipeline.mdx, but the multilingual_profile paragraph it links to was not updated. That paragraph still says such uploads return multilingual_profile, which is false with the rule on for a declared unsupported language. Add the rule-on exception and the flag name to that contract paragraph.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/docs/listen_pusher_pipeline/changes/2026-12-01-declared-unsupported-language-route.md, line 1:
<comment>This note says contract changes belong in `listen_pusher_pipeline.mdx`, but the `multilingual_profile` paragraph it links to was not updated. That paragraph still says such uploads return `multilingual_profile`, which is false with the rule on for a declared unsupported language. Add the rule-on exception and the flag name to that contract paragraph.</comment>
<file context>
@@ -0,0 +1,69 @@
+# A declared unsupported language keeps its vendor route
+
+Contract: [batch admission language](../../listen_pusher_pipeline.mdx), the `multilingual_profile` paragraph.
</file context>
| raw = json.loads(Path(path).expanduser().read_text(encoding='utf-8')) | ||
| file = Path(path).expanduser() | ||
| if not file.is_absolute(): | ||
| file = Path(__file__).resolve().parents[3] / file # a committed synthetic fixture, from backend/ |
There was a problem hiding this comment.
P2: Relative OMI_PIPELINE_LAB_STT_ROUTING_INPUTS paths now resolve against backend/, not the shell's working directory. That silently changes how private inputs are found, and the PR description does not mention it. The docstring's scenario/fixtures/stt_routing/ example also resolves to a non-existent path; the real path is testing/pipeline_lab/scenario/fixtures/stt_routing/. Consider keeping CWD resolution for user paths and applying the backend base only to committed fixtures.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/testing/pipeline_lab/stt_routing/routing.py, line 185:
<comment>Relative `OMI_PIPELINE_LAB_STT_ROUTING_INPUTS` paths now resolve against `backend/`, not the shell's working directory. That silently changes how private inputs are found, and the PR description does not mention it. The docstring's `scenario/fixtures/stt_routing/` example also resolves to a non-existent path; the real path is `testing/pipeline_lab/scenario/fixtures/stt_routing/`. Consider keeping CWD resolution for user paths and applying the backend base only to committed fixtures.</comment>
<file context>
@@ -163,10 +180,16 @@ def load(cls, env: Mapping[str, str]) -> 'Inputs':
- raw = json.loads(Path(path).expanduser().read_text(encoding='utf-8'))
+ file = Path(path).expanduser()
+ if not file.is_absolute():
+ file = Path(__file__).resolve().parents[3] / file # a committed synthetic fixture, from backend/
+ raw = json.loads(file.read_text(encoding='utf-8'))
if not isinstance(raw, dict) or not isinstance(raw.get('user'), dict):
</file context>
| gpu_refused=False, | ||
| ) | ||
| if language_class(input_language) != 'unknown': | ||
| service, model, sent = _batch(input_language) |
There was a problem hiding this comment.
P2: An unsupported input_language is marked gpu_refused below, but this line still selects a Parakeet cassette. Use the vendor recovery route and cassette for this refused upload.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/testing/pipeline_lab/stt_routing/routing.py, line 644:
<comment>An unsupported `input_language` is marked `gpu_refused` below, but this line still selects a Parakeet cassette. Use the vendor recovery route and cassette for this refused upload.</comment>
<file context>
@@ -523,6 +569,111 @@ def decide(
+ gpu_refused=False,
+ )
+ if language_class(input_language) != 'unknown':
+ service, model, sent = _batch(input_language)
+ return Route(
+ PARAKEET,
</file context>
| ``keep_unsupported`` (``unsupported_declaration_kept``) restores the declaration for such a user.""" | ||
| if pin_untrusted(user) and not keep_unsupported: | ||
| return 'multi' | ||
| return normalized_stt_language(target.get('language') or user.get('language')) |
There was a problem hiding this comment.
P2: When the conversation has an unrecognized language but the user declares a known unsupported one, this returns the conversation value instead of the effective declaration. With language inheritance disabled, intake sends that unknown code to the provider; use inherited_language() for the kept-profile case.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/config/batch_pipeline_language.py, line 140:
<comment>When the conversation has an unrecognized language but the user declares a known unsupported one, this returns the conversation value instead of the effective declaration. With language inheritance disabled, intake sends that unknown code to the provider; use `inherited_language()` for the kept-profile case.</comment>
<file context>
@@ -106,13 +107,47 @@ def pin_untrusted(user: dict) -> bool:
+ ``keep_unsupported`` (``unsupported_declaration_kept``) restores the declaration for such a user."""
+ if pin_untrusted(user) and not keep_unsupported:
+ return 'multi'
+ return normalized_stt_language(target.get('language') or user.get('language'))
+
+
</file context>
| run_proof "batch intake: a declared unsupported language keeps its vendor route (experiment off against on)" \ | ||
| "$PYTHON" -m pytest -q -p no:cacheprovider \ | ||
| tests/integration/test_batch_declared_unsupported_language_route_firestore.py |
There was a problem hiding this comment.
P3: This proof can report PASS without running: its world fixture skips for a non-loopback FIRESTORE_EMULATOR_HOST, and run_proof treats pytest's successful skip exit as success. Gate this invocation on a loopback host and record a failure otherwise.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/scripts/run-emulator-proofs.sh, line 141:
<comment>This proof can report PASS without running: its `world` fixture skips for a non-loopback `FIRESTORE_EMULATOR_HOST`, and `run_proof` treats pytest's successful skip exit as success. Gate this invocation on a loopback host and record a failure otherwise.</comment>
<file context>
@@ -135,6 +135,13 @@ run_proof "batch projection follow-up (silent ready, rollback and mixed completi
+# Two accounts in one database, one admitted to declared_unsupported_language_route: a real upload of a
+# multilingual-profile user who declares Japanese takes the vendor route at admission (no probe, nothing in
+# the GPU ring, text written); the account outside the experiment is admitted as multi on the GPU route.
+run_proof "batch intake: a declared unsupported language keeps its vendor route (experiment off against on)" \
+ "$PYTHON" -m pytest -q -p no:cacheprovider \
+ tests/integration/test_batch_declared_unsupported_language_route_firestore.py
</file context>
| run_proof "batch intake: a declared unsupported language keeps its vendor route (experiment off against on)" \ | |
| "$PYTHON" -m pytest -q -p no:cacheprovider \ | |
| tests/integration/test_batch_declared_unsupported_language_route_firestore.py | |
| if [[ "$FIRESTORE_EMULATOR_HOST" == 127.0.0.1:* || "$FIRESTORE_EMULATOR_HOST" == localhost:* ]]; then | |
| run_proof "batch intake: a declared unsupported language keeps its vendor route (experiment off against on)" \ | |
| "$PYTHON" -m pytest -q -p no:cacheprovider \ | |
| tests/integration/test_batch_declared_unsupported_language_route_firestore.py | |
| else | |
| echo "FAIL batch intake proof: a loopback Firestore emulator is required" >&2 | |
| failures+=("batch intake proof: loopback emulator required") | |
| fi |
| raise ScenarioError(f'{where}.outcome: one of {RESPONSE_OUTCOMES}') | ||
| if 'fast_finish' in fields and (not isinstance(fields['fast_finish'], str) or not fields['fast_finish']): | ||
| raise ScenarioError(f'{where}.fast_finish: an outcome name, or "none"') | ||
| if target_key == 'recording': |
There was a problem hiding this comment.
P3: A recording check on route fields for a speech-only recording can never pass, and the spec does not reject it. Validate this after the recordings are built, the way the speakers block checks for an audio_file recording, so an authoring mistake fails at load time.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/testing/pipeline_lab/scenario/spec.py, line 693:
<comment>A `recording` check on route fields for a speech-only recording can never pass, and the spec does not reject it. Validate this after the recordings are built, the way the `speakers` block checks for an `audio_file` recording, so an authoring mistake fails at load time.</comment>
<file context>
@@ -684,6 +690,14 @@ def _check(raw: Any, where: str, labels: set[str], has_finish: bool, taps: int =
raise ScenarioError(f'{where}.outcome: one of {RESPONSE_OUTCOMES}')
if 'fast_finish' in fields and (not isinstance(fields['fast_finish'], str) or not fields['fast_finish']):
raise ScenarioError(f'{where}.fast_finish: an outcome name, or "none"')
+ if target_key == 'recording':
+ for key in ('route', 'route_reason'):
+ if key in fields and (not isinstance(fields[key], str) or not fields[key]):
</file context>
| if 'fast_finish' in fields and (not isinstance(fields['fast_finish'], str) or not fields['fast_finish']): | ||
| raise ScenarioError(f'{where}.fast_finish: an outcome name, or "none"') | ||
| if target_key == 'recording': | ||
| for key in ('route', 'route_reason'): |
There was a problem hiding this comment.
P3: route accepts any non-empty string, so a typo such as "multilngual" loads without error and then fails at runtime with an unclear mismatch. Validate route against the three names routing defines (parakeet, multilingual, mixed) at load time.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/testing/pipeline_lab/scenario/spec.py, line 694:
<comment>`route` accepts any non-empty string, so a typo such as `"multilngual"` loads without error and then fails at runtime with an unclear mismatch. Validate `route` against the three names routing defines (`parakeet`, `multilingual`, `mixed`) at load time.</comment>
<file context>
@@ -684,6 +690,14 @@ def _check(raw: Any, where: str, labels: set[str], has_finish: bool, taps: int =
if 'fast_finish' in fields and (not isinstance(fields['fast_finish'], str) or not fields['fast_finish']):
raise ScenarioError(f'{where}.fast_finish: an outcome name, or "none"')
+ if target_key == 'recording':
+ for key in ('route', 'route_reason'):
+ if key in fields and (not isinstance(fields[key], str) or not fields[key]):
+ raise ScenarioError(f'{where}.{key}: a route name or reason from stt_routing')
</file context>
| @pytest.fixture | ||
| def declared_route(monkeypatch): | ||
| """Switch the experiment for the harness account; ``.routes`` records the language each route was chosen for.""" | ||
| from config import reliability_experiments |
There was a problem hiding this comment.
P3: Move these two function-level imports (reliability_experiments and enqueue_in_transaction) to the module import block. AGENTS.md requires top-level imports in backend code, and this module already imports from the same packages at top level.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/tests/unit/test_batch_admission_language.py, line 822:
<comment>Move these two function-level imports (`reliability_experiments` and `enqueue_in_transaction`) to the module import block. AGENTS.md requires top-level imports in backend code, and this module already imports from the same packages at top level.</comment>
<file context>
@@ -805,3 +805,237 @@ async def test_exclusion_precedes_legacy_owner_rehome(monkeypatch):
[email protected]
+def declared_route(monkeypatch):
+ """Switch the experiment for the harness account; ``.routes`` records the language each route was chosen for."""
+ from config import reliability_experiments
+
+ monkeypatch.delenv(reliability_experiments.ENV, raising=False)
</file context>
|
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. |
|
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:
Before your next PR, please skim:
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! |
…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)
What changed and why
Batch audio in a language our GPU recogniser (Parakeet, 25 European languages) cannot serve should never go
to a GPU worker: the worker refuses it and the unit then waits for the recovery sweep before a vendor
transcribes it. For one group of users that is what happens today.
PR #26431 (multilingual-profile routing, by
Git-on-my-level) stops trusting a supported conversation pin,usually the app language
en, for a multi-language user whose own live speech shows a language Parakeetcannot transcribe. Its two intake lines drop every declaration of such a user, though, also an unsupported
one. A user who declares Japanese and speaks Japanese live is exactly such a user. Before #26431 their upload
was routed by the declaration and took the vendor route when it was admitted. Since #26431 it is
multi: GPUroute, a language probe per unit, the probe hears Japanese, the worker refuses the unit
(
unsupported_language), recovery hands it to a vendor later. This reading is from the diff and fromproduction counters; the PR text speaks only of a supported pin, so I take the unsupported case as unintended.
Measured on one production day after #26431 reached the upload service:
unsupported language (Japanese about three quarters of all refused units);
reaching them, six times the share two days earlier;
declared unsupported language fell to about a third of their share.
The change. Behind a per-account flag store rule,
declared_unsupported_language_route(default off): fora multilingual-profile user, when the declared language of the upload (the conversation's first, then the
user's) is a known language Parakeet cannot serve, it stays the declaration and the inherited language.
select_routethen admits the upload on the vendor route (policy.stt_route = provider,provider_reason = unsupported_language), no language probe is spent on it and none of its units is leased toa GPU worker. This restores the routing these uploads had before #26431 and nothing else:
batch_admission_languagealready has; there is no newlanguage list and no new environment setting;
en, userja) and an unknown declaration are still dropped and classifiedon audio, as fix(stt): route multilingual-profile users' uploads by audio, not the en pin; add lab STT routing #26431 intends;
dropped), and the rule is not even read for their uploads;
used (a
batch_sync_v1owner, which skips admission, gets the declared language on its units instead of aprobe verdict; there is no vendor route while legacy is on);
An upload the rule moves is funded and scheduled by the provider-STT stage instead of GPU compute admission
(
requires_compute_admissionfalse), exactly like an upload of any user who declares an unsupported languageand has no profile hits, and like these users' own uploads before #26431.
Serving intake and shadow intake decide through one helper
(
config/batch_pipeline_language.unsupported_declaration_kept). Shadow intake has no vendor route: it recordsthe kept declaration on the shadow row and still classifies the unit on its audio, as it did before #26431.
Not covered. A multilingual-profile user with a supported pin whose audio is in an unsupported language
(the Mandarin speaker with the
enapp language, about 14% of the language-refused units) still goes tothe GPU, is probed and refused. Routing those uploads by the probe's verdict is a separate, larger change that
I am preparing as its own PR.
What a merge does. No rule exists, so no account's route changes. For every account the code path is
main's: the two functions answer what they answer on main (tested value for value, see Tests). The rule is
read only for an upload it can change, after
warm(uid)so an account's first upload in a process is notmissed; the answer comes from the process's flag-store snapshot and no customer-database read is added.
Rollout and rollback. Allow list first, then 5%, 25%, 100% (flag row). Rollback: deactivate the rule;
uploads already admitted finish on the route they were given. End state: all accounts on, then delete the
switch and fold the rule into the multilingual-profile rule.
What to watch, per admitted cohort:
omi_batch_pipeline_language_route_total{surface="worker",route="blocked"}: falls;omi_batch_pipeline_vendor_route_decisions_totalfor a declared unsupported language: rises by the sameuploads;
omi_batch_pipeline_language_probe_audio_seconds_total: falls;so the load moves earlier rather than growing;
account's ordered log, which a refused unit does not. Today such units get their vendor answer in seconds
and then wait for their turn in the log (a median of about a minute), so the gain here is that the GPU, the
refusal and the recovery sweep leave the path, not a faster vendor.
Details:
backend/docs/listen_pusher_pipeline/changes/2026-12-01-declared-unsupported-language-route.md.Product invariants affected
none
How it was verified
All local, on this branch at main
ba502efad6; main was merged in twice afterwards (now96c2b86a48; nooverlap with this change) and the touched test files re-run. Nothing was run against production and no flag
rule was created.
accept_upload(new file, 3 tests, also added toscripts/run-emulator-proofs.sh): two accounts in one database, both multilingual-profile users who declareJapanese with no legacy sync, one admitted to the rule.
policy.stt_route == 'provider',provider_reason == 'unsupported_language',requires_compute_admissionfalse; no language probe call; staged audio frozen asja/declared; itsprovider-STT outbox row written in the admission transaction; nothing for it in the GPU ring. Then the
vendor stage (synthetic vendor answer), the ordered merge and the projection: one conversation written,
language
ja, jobcommitted, never quarantined or held.policy.stt_route == 'parakeet',requires_compute_admissiontrue, one probe call, stagedaudio frozen as
ja/audio_lid(the unit a worker refuses), leased from the GPU ring.profile hits) route as on main and never read the rule.
python -m testing.pipeline_lab affectednamed every committed scenario; all 28 ran(
scenario run, the 26 existing ones and the 2 new ones) and passed. The lab does not runaccept_uploaditself (its batch admission is a stand-in), so the emulator test above is the proof for intake; the lab covers
the route decision and everything after it. The lab's STT routing step modelled only owners with legacy sync on; it
now also models an owner without it (vendor at admission, or GPU with one probe and a refusal), and two new
scenarios run one upload through it and on through the real batch worker, projection, v3 builder and Home:
stt_route_declared_unsupported_language_vendor(rule on: vendor at admission, 0 probes, not refused) andstt_route_declared_unsupported_language_gpu_refused(rule off: 1 probe, refused on the GPU). The lab pinsthe route, not the recovery wait: it does not model how long a refused unit waits.
bash test.sh --changed: the selector picked 3,129 test files and 3,118 passed. The 11 others fail the same wayon untouched main
ba502efad6on this Mac (I ran them there):test_flag_budget.py(the calendar check thatis red on main),
test_rollout_cohort_deploy.py(fixed on main since by test(rollout): pin the cleared speaker-grouping shadow allow-list (main shard 8/8 red since #26828) #26853),test_batch_pipeline_chart.py(needs GNU
timeout), and eight files about cells, the directory store, spaces sync, the monitoring contractand empty-capture recovery. They fail identically with and without this change.
scripts/pr-preflight --all --pr-body-file <this body>: 44 gates passed, 0 failed, 0 skipped. Strict type check(
backend/scripts/typecheck.sh): 0 errors.passed and
test_flag_budget.pyfailed on the calendar check that is red on main (renewal: Renew November 30 flag budget rows (SCA-3850) #26600). Thebranch was pushed with that phase skipped (
PRE_PUSH_SKIP_BACKEND_UNIT_TESTS=1), so expect the same singlered test in CI until Renew November 30 flag budget rows (SCA-3850) #26600 lands.
every test); the GPU worker's refusal itself is not re-run here (its own tests cover it), the emulator test
stops at the frozen
javerdict and the GPU lease for the account outside the rule.tests/integration/test_batch_pipeline_intake_firestore.pyfails on this Mac on untouched main as well(the upload is declined to legacy); it is not in the proof script and not touched here.
Tests
tests/unit/test_batch_multilingual_profile_routing.py(+34): the declaration helper over conversation anduser combinations including
sr/hr; agreement withbatch_admission_languageandresolve_routeforevery known language code; the rule read only for candidate uploads, after
warm; kill switches; a failingstore read is main's behaviour; rule off equals main: the two functions against a copy of main's two
functions over 540 declaration, profile and mode combinations; rule on changes only an unsupported
declaration, and for it equals the profile rule's kill switch (the routing before fix(stt): route multilingual-profile users' uploads by audio, not the en pin; add lab STT routing #26431).
tests/unit/test_batch_admission_language.py(+52), the realaccept_upload: declaredja, conversationja+ useren,ko-KR,sr; rule off pins main (multi, probed); conversationen+ userjastaysmultion and off in every legacy mode; no profile hits, single-language mode, ambiguoussrprofile witha Croatian pin; legacy sync on; a
batch_sync_v1owner; the stored job row on and off; rule on equals theprofile rule's kill switch.
tests/unit/test_batch_pipeline_shadow_runtime.py(+5): shadow intake records the declaration servingintake routes by, on and off.
tests/unit/test_pipeline_lab_stt_routing.py(+8): the lab's routing for an owner without legacy sync, thecommitted synthetic language answer, the two new metric columns.
tests/integration/test_batch_declared_unsupported_language_route_firestore.py(new, 3): above.UI evidence
UI-Evidence: none -- backend routing only
Failure class (fixes)
Failure-Class: none
Scoped cleanups (optional)
_declared_languagemoved fromutils/batch_pipeline/intake.pytoconfig/batch_pipeline_language.py(
declared_language) so serving intake, shadow intake and the lab read one definition.🤖 Generated with Claude Code