Repository navigation
feat(held-recovery): release a 25h trial grant and paid conversions on idle GPUs under daily limits - #24382
Conversation
…e boundary Offline allowance enforcement (default on) holds sync audio without consulting STT_CAP_DISPATCH_LANES, but recovery scope required `sync` in that list. With prod's live-only list, no sync or pre-origin hold could recover, even after the owner bought credits or chose "Process waiting recordings"; the worker skipped and refunded them as out of scope. recovery_admission_enabled now also admits lane `sync` while STT_CAP_OFFLINE_ENFORCEMENT is on, for a cap-cohort owner with execution admission configured. The backlog worker's excluded-release check uses the same recovery predicate. Intake, consent gating and execution_admission_enabled are unchanged; recovery still requires explicit consent, current allowance on the original lane and shared pacing. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…, consent and pacing Luna r1 P2: cover the non-batch recovery path for a sync-origin hold under live-only lanes: allowance on lane sync before dispatch, pacing deferral and refusal, the offline kill switch, and a stale-month backlog grant. Co-Authored-By: Claude Opus 5.5 <[email protected]>
_offline_hold_recovery_selected bypassed selected()'s unknown-token check, so a typo in STT_CAP_DISPATCH_LANES still authorized sync recovery. Share the parse and deny on malformed, while still not requiring sync in the list. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…hort STT_CAP_OFFLINE_ENFORCEMENT=false also removes the allowance cap on new sync audio. STT_CAP_RECOVERY_COHORT=pct:0 stops every recovery path and keeps the cap; test both halves and make it the documented rollback. Also narrow the kill-switch statement Cubic flagged: it does not govern legacy-selected sync. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…in holds
A processing choice skips an out-of-scope or unknown-origin hold before any
recovery attempt, so omi_held_content_recovery_total read healthy while sync
holds never recovered. Add omi_held_content_recovery_skipped_total{outcome}
(closed HeldRecoverySkipOutcome, armed at import, kept by the GMP filter) and
put it in the recovery gate's denominator.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…utcome
POST /v1/users/processing-backlog/process and the upgrade intent left no
metric, so taps could not be counted. Add
omi_processing_backlog_choice_total{source=manual|upgrade,outcome} from a
closed BacklogChoiceOutcome; no account labels.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Record the out-of-scope tap through the lazily imported processing_backlog module instead of two new router imports. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Move the process route's 404 gate into processing_backlog.manual_choice_in_scope, which also counts the out-of-scope tap, instead of growing the router. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The shorthand {result="attempt"} selected across metrics and the series'
differing labels would not divide. Use explicit selectors, sum() away the
labels and take increases over the 24 h watch window.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 24eba77)
…paid plan
David's ruling (2026-11-01): "I only want paid users processed, not free."
funded_processing.paid_owner reads get_user_valid_subscription(provision=False)
on every decision and applies is_paid_plan; an unreadable entitlement fails
closed. It gates the recovery predicate (cap_hold_recovery._scope, so
_selected_lane, recover_selected and the worker's per-item scope on every lane),
processing_backlog.choose, the worker run and the redrive sweep, which now
visits paid owners only (_paid_first becomes _paid_only). A lapsed or downgraded
owner parks at the next decision; Free holds stay held and untouched.
snapshot reports capped for a Free owner with waiting work, so the process
route returns its existing 402 and shipped clients show Upgrade, while
budget_exhausted still says whether the monthly limit was really reached.
Free skips count as omi_held_content_recovery_skipped_total{outcome="not_paid"}
and Free taps as omi_processing_backlog_choice_total{outcome="not_paid"}; the
recovery gate excludes not_paid. Hold creation and STT_CAP_OFFLINE_ENFORCEMENT
are unchanged.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…apped at 25 h David's rulings (2026-11-01): "trial recovers newest 25h is fine, but we should also let it process new... we shouldn't auto recover to save cost" and "Let's not state it and just let the user manually process any beyond their recent." Removed every automatic start on the paid path in routers/payment.py: - in-app plan change (processing_backlog_worker.upgrade, plan-change key); - checkout.session.completed (upgrade_async, checkout key); - customer.subscription.* (upgrade_async, subscription-upgrade key). allowance_increased had no other caller and is removed. Purchases, plan changes, renewals and the first real charge leave held audio waiting with the process action until the owner taps. The subscription webhook now calls trial_started_async for a paid subscription in status trialing. It chooses newest first with a budget of TRIAL_RECOVERY_GRANT_HOURS (25, a plain constant in config/stt_cap_dispatch.py) of held audio, or less when a finite allowance has less; the job's existing remaining field is that budget, and the worker skips what no longer fits. The request key is trial-grant:<subscription id>, so the durable receipt makes a retry, restart or later month a no-op, and trial_start dates the intent so a late first delivery stays stale (the old-event guard is kept). Recordings made during the trial are not held and never debit the grant. The choice counter's source is now manual|trial, and exceeds_remaining, no longer reachable, leaves the outcome vocabulary. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nthly rollover Choices expired at rollover (is_active, period_id), so every choice stalled on the 1st and October's choices are parked today. When the owner's current capacity is unlimited, so recovery spends no finite allowance, the worker rolls an earlier month's unleased manual choice into the current month (processing_backlog.rolls, database.processing_backlog.roll): a new token fences out the old month's worker, plus the new period and a new cutoff. A reservation carries over to finish under its source's claim and receipts, so the debit stays idempotent. This resumes parked October choices at deploy without a new tap. snapshot shows such a choice as processing. Plus (finite) keeps the monthly tap, and the existing tests that prior consent cannot spend a new month for finite plans are unchanged. A trial grant or a legacy upgrade intent (automatic) never rolls, and roll never creates a choice. Co-Authored-By: Claude Opus 5.5 <[email protected]>
David's copy: "your recordings are safe but unprocessed, upgrade to process now". A Free owner's held audio no longer waits for a choice, so the card no longer says it does. Free owners (outside the holdout) see "<held total> of your recordings are safe but unprocessed." then "Upgrade to process now." in the existing card on Home, the live banner and Settings, with Upgrade first and "Transcribe on this phone" second. Where no total is shown, one line says both. Paid owners keep their accurate copy. This is a text change inside the existing layout: no new elements, screens, notifications or paywall changes; Upgrade still opens the existing plans sheet (Unlimited is the one plan sold). Measurement: registered Held Audio Card Seen, Held Audio Upgrade Tapped and Held Audio Process Tapped (surface, variant, state enums; no account fields) with consumer held-audio-card. A stable 10% of Free owners, by a hashed bucket computed on the device, keep the previous copy as variant=holdout so lift can be measured. The holdout changes copy only, never who can recover. Strings are added for all 49 locales through scripts/l10n.py. Render evidence for the Free, Plus and Unlimited views is in .agent-artifacts/ui-evidence/24224. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…Free-card changes - Recheck the paid entitlement before every new provider request (_new_dispatch_allowed), not only when a hold enters recovery, so a lapse between the pieces of a long hold stops the next dispatch. - Grant the trial recovery only on customer.subscription.created. A later update while trialing (a plan change) never grants, even when the start left no receipt. - A Free card with nothing waiting no longer says recordings are safe but unprocessed; it shows the existing headline with no second line. - The held-audio-card consumer states that its registered query is the presence check and that lift splits the same events by the variant property. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ion stub main now calls cap_hold_admission.enabled_for(row, uid=uid) from recover_selected; the sync-hold recovery stub predated that and raised TypeError in CI's merge build. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The held-audio cards are being removed in a separate UI PR (David, 2026-11-02), so this branch reverts its own app, l10n, analytics and changelog changes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…le GPUs under daily limits David, 2026-11-02: "Let's keep on 25 hour trial grant, and lower other throttles as well for now". Newest 25 h once per account; the first 2.5 h at normal backfill priority, the rest on idle GPUs only; 5 h a day per owner; 400 audio-hours a day and 20 an hour across the fleet; a kill switch that also stops releases in progress. Held audio never takes the cheaper-vendor route. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…for hard-3 While legacy sync serves an owner, a held recording recovers on the live Parakeet pool or a vendor, which the idle gate cannot see, so an automatic release now waits (decision legacy_route). With batch at 0 nothing is released until the lead's re-entry. A deferred summary uses no GPU and skips the route and idle checks, still spending the owner day and fleet budget. Each released recording carries release=trial|conversion on its intake record and every batch job row, so hard-3 and the 2h alarm can count it apart. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…payment router The webhook now calls processing_backlog_worker.subscription_changed_async, which holds the conversion and trial-start rules, keeping payment.py inside its line-count ratchet. Registers the BACKLOG_RELEASE_ENABLED kill switch. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
14 issues found across 35 files
Confidence score: 2/5
processing_backlog_worker.pytreatscustomer.subscription.createdas an allowance increase, so a new trial can start a full-plan conversion release before its 25-hour grant. Skip the allowance-increase path for subscription creation events.backlog_release.pygives an entire recording normal priority if any trial grant remains, letting it exceed the 2.5-hour priority allowance and bypass the idle gate. Require the candidate to fit within the remaining allowance.processing_backlog.pylets a manual tap overwrite a rolled trial choice when the earlier-month job is stillprocessing. Allow manual starts only fromwaiting_choice.database/processing_backlog.pydrops pending paid-conversion intent when a trial grant rolls into the next month, and Stripe retries will not recreate it. Preserve the pending intent across the reset.
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/docs/runbooks/held-content-acceptance.md">
<violation number="1" location="backend/docs/runbooks/held-content-acceptance.md:117">
P2: This promotion-gate query escapes regex alternation as `\|` inside a PromQL string, which makes the query invalid rather than matching the skip outcomes. Use plain `|` separators, as in the other runbook queries, so the recovery gate can be evaluated.</violation>
</file>
<file name="backend/tests/unit/test_stt_cap_recovery_cohort.py">
<violation number="1" location="backend/tests/unit/test_stt_cap_recovery_cohort.py:86">
P2: This replacement drops cohort coverage for both conversion entry points, including the synchronous `upgrade()` still called by the plan-change route. Keep the existing upgrade test and add a separate trial-start gate test so conversion regressions remain detected.</violation>
</file>
<file name="backend/tests/unit/test_processing_backlog.py">
<violation number="1" location="backend/tests/unit/test_processing_backlog.py:119">
P2: The renamed trial tests still exercise conversion semantics, so they never verify the trial grant flag, 25-hour limit, one-account ledger, or `trial` metric source. Pass `trial=True` in these trial scenarios and cover it in the counter test.</violation>
</file>
<file name="backend/tests/unit/test_processing_backlog_rollover.py">
<violation number="1" location="backend/tests/unit/test_processing_backlog_rollover.py:141">
P2: `visit.roll` leaves `scope_skipped=True` and October’s cursor, unlike `store.roll`; because its `_page` mock ignores the cursor, these worker tests can pass without verifying the rollover rewind. Return the reset fields in this stub so the tests model the rollover contract.</violation>
</file>
<file name="backend/docs/stt-cap-dispatch.md">
<violation number="1" location="backend/docs/stt-cap-dispatch.md:177">
P2: This now documents only pending trial grants, but the finish transaction also consumes pending conversion upgrades. Name both automatic release types here so operators do not assume a conversion cannot be handed off at page completion.</violation>
<violation number="2" location="backend/docs/stt-cap-dispatch.md:654">
P2: Conversion recovery still rechecks the current ladder budget before dispatch, but this sentence now mentions only trial grants. Keep conversion releases in this operational guarantee.</violation>
<violation number="3" location="backend/docs/stt-cap-dispatch.md:762">
P2: The recovery cohort also gates conversion and allowance-increase consent creation through `upgrade_async`, not only trial grants. Include conversion releases here so the `pct:0` rollback guidance accurately covers every automatic release path.</violation>
</file>
<file name="backend/utils/processing_backlog_worker.py">
<violation number="1" location="backend/utils/processing_backlog_worker.py:432">
P1: A paid `customer.subscription.created` event is incorrectly treated as an allowance increase, so a new trial can start a full-plan conversion release before the 25-hour grant. Skip `allowance_increased` for creation events (and require a real previous subscription); only trial conversion or an actual update should call `upgrade_async`.</violation>
</file>
<file name="backend/utils/batch_pipeline/pump.py">
<violation number="1" location="backend/utils/batch_pipeline/pump.py:492">
P2: This label includes skipped leases even though the worker dispatch excludes them on the next line. When a mixed batch loses its non-DEEP lease before dispatch, the remaining DEEP-only work is recorded as `worker_flight`, causing the HPA to scale on idle-only work; classify only active leases.</violation>
</file>
<file name="backend/tests/unit/test_held_recovery_trial_grant.py">
<violation number="1" location="backend/tests/unit/test_held_recovery_trial_grant.py:187">
P2: This assertion does not verify that the rejected second trial request is recorded as rejected. Add a receipt assertion; otherwise the test can pass while the account-level once-only gate reports an accepted grant that never started.</violation>
</file>
<file name="backend/utils/backlog_release.py">
<violation number="1" location="backend/utils/backlog_release.py:136">
P1: This marks the entire recording as normal priority whenever any grant remains, so a recording can consume more than the remaining 2.5-hour trial priority allowance and bypass the idle gate. Require the candidate to fit the remaining priority units (or split it) before setting `normal_priority`.</violation>
</file>
<file name="backend/utils/processing_backlog.py">
<violation number="1" location="backend/utils/processing_backlog.py:128">
P1: A manual tap can overwrite a rolled trial choice because `begin` remains true when `snapshot()` reports the earlier-month job as `processing`. Restrict manual starts to `waiting_choice`; otherwise this path resets the grant budget and reserved work instead of preserving the rollover.</violation>
</file>
<file name="backend/database/processing_backlog.py">
<violation number="1" location="backend/database/processing_backlog.py:139">
P2: The one-per-account trial ledger is not recorded when the first valid trial has no eligible backlog, allowing a later trial to grant again. Record the trial consumption before the `begin=False` early return for a current-period trial.</violation>
<violation number="2" location="backend/database/processing_backlog.py:212">
P2: This unconditional reset drops a pending paid-conversion intent when a trial grant rolls into the next month. The conversion receipt already exists, so Stripe retries return the current row without recreating the intent; preserve a retryable conversion or explicitly make its receipt retryable before rolling.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
| if audio and not batch_serving(uid): | ||
| return Decision(False, 'legacy_route') | ||
| priority_left = float(job.get('release_priority_units') or 0) | ||
| normal = audio and priority_left > 0 |
There was a problem hiding this comment.
P1: This marks the entire recording as normal priority whenever any grant remains, so a recording can consume more than the remaining 2.5-hour trial priority allowance and bypass the idle gate. Require the candidate to fit the remaining priority units (or split it) before setting normal_priority.
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/utils/backlog_release.py, line 136:
<comment>This marks the entire recording as normal priority whenever any grant remains, so a recording can consume more than the remaining 2.5-hour trial priority allowance and bypass the idle gate. Require the candidate to fit the remaining priority units (or split it) before setting `normal_priority`.</comment>
<file context>
@@ -0,0 +1,144 @@
+ if audio and not batch_serving(uid):
+ return Decision(False, 'legacy_route')
+ priority_left = float(job.get('release_priority_units') or 0)
+ normal = audio and priority_left > 0
+ if audio and not normal and not idle_now():
+ return Decision(False, 'not_idle')
</file context>
| normal = audio and priority_left > 0 | |
| normal = audio and 0 < priority_left and units <= priority_left |
| begin = result.state not in {'none', 'capped'} and ( | ||
| not automatic or intent_period == period and not result.exceeds_remaining | ||
| ) | ||
| begin = result.state not in {'none', 'capped'} and (not automatic or intent_period == period) |
There was a problem hiding this comment.
P1: A manual tap can overwrite a rolled trial choice because begin remains true when snapshot() reports the earlier-month job as processing. Restrict manual starts to waiting_choice; otherwise this path resets the grant budget and reserved work instead of preserving the rollover.
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/utils/processing_backlog.py, line 128:
<comment>A manual tap can overwrite a rolled trial choice because `begin` remains true when `snapshot()` reports the earlier-month job as `processing`. Restrict manual starts to `waiting_choice`; otherwise this path resets the grant budget and reserved work instead of preserving the rollover.</comment>
<file context>
@@ -92,27 +125,57 @@ def choose(uid: str, *, request_key: str, automatic: bool = False, intent_at: An
- begin = result.state not in {'none', 'capped'} and (
- not automatic or intent_period == period and not result.exceeds_remaining
- )
+ begin = result.state not in {'none', 'capped'} and (not automatic or intent_period == period)
+ if begin:
+ outcome = BacklogChoiceOutcome.ACCEPTED
</file context>
| begin = result.state not in {'none', 'capped'} and (not automatic or intent_period == period) | |
| begin = (result.state == 'waiting_choice' if not automatic else result.state not in {'none', 'capped'} and intent_period == period) |
| | Lost capture | `omi_held_content_capture_total{kind="lost"}`, `{kind="byte_mismatch"}`, `{kind="frame_mismatch"}`, and `{kind="ack_without_authority"}` stay at zero new events. Any loss stops immediately. Track volatile PCM separately: the last unpublished <=15 seconds is not an acknowledged custody guarantee. | | ||
| | Choice API and capability | `omi_held_content_choice_5xx_total` no more than baseline +0.1 percentage point. p95 of `omi_held_content_choice_latency_seconds` no more than 1.2x baseline (`histogram_quantile(0.95, sum by (le, method) (rate(omi_held_content_choice_latency_seconds_bucket[5m])))`). `omi_held_content_choice_total{outcome="no_capability"}` is the dark/excluded 404 path, not a 200. `{outcome="stale_period_409"}` may be non-zero at the UTC boundary and must not accompany a write. `{outcome="intent_only"}` counts upgrade writes; `{outcome="ok"}` is the other success. A managed grant from an upgrade choice increments `{outcome="intent_only"}` on the read and stops the step. Expected other 409/429 outcomes are not this series. | | ||
| | Recovery completion and held age | `omi_held_content_recovery_total{result="completed"}` / `{result="attempt"}` >= 99% within the predeclared visit/lease/discovery budget. `omi_held_content_oldest_age_seconds`, `omi_held_content_pending_count`, `omi_held_content_pending_seconds`, `omi_held_content_undated_pending_count`, and `omi_held_content_backlog_items` are one fleet snapshot from the `cap-hold-durable-redrive` scheduler (holds count + seconds sum, dated-hold count where `listed_at` > 0, oldest `listed_at` via `limit(1)`, and the sum of `processing_backlog.count` where `state="processing"`). Read each with the newest-snapshot expression above. An empty population is 0. `omi_held_content_undated_pending_count` > 0 fails the gate. If pending is above zero and no dated hold exists, `omi_held_content_oldest_age_seconds` is the sentinel -1, not 0; age 0 is an empty population or a hold listed at the snapshot clock. No unexplained oldest-age growth; no progress for two discovery rotations after lease expiry pages the owner. Hold the step if the denominator is too small; synthetic completion is mandatory. | | ||
| | Recovery completion and held age | `sum(increase(omi_held_content_recovery_total{result="completed"}[24h])) / (sum(increase(omi_held_content_recovery_total{result="attempt"}[24h])) + sum(increase(omi_held_content_recovery_skipped_total{outcome=~"out_of_scope\|unknown_origin\|unknown"}[24h])))` >= 0.99 over the watch window, within the predeclared visit/lease/discovery budget (`sum()` drops the differing `result`/`outcome` labels so the series divide). A processing choice skips an out-of-scope or unknown-origin hold before any attempt, so `completed / attempt` alone can read healthy while nothing recovers; the skip counter closes that gap, and any sustained `unknown_origin` growth holds the step. `{outcome="text_out_of_scope"}` counts deferred text rows and is read separately. Attempts and completions count only the legacy recovery path; holds handed to batch admission appear in neither. `omi_held_content_oldest_age_seconds`, `omi_held_content_pending_count`, `omi_held_content_pending_seconds`, `omi_held_content_undated_pending_count`, and `omi_held_content_backlog_items` are one fleet snapshot from the `cap-hold-durable-redrive` scheduler (holds count + seconds sum, dated-hold count where `listed_at` > 0, oldest `listed_at` via `limit(1)`, and the sum of `processing_backlog.count` where `state="processing"`). Read each with the newest-snapshot expression above. An empty population is 0. `omi_held_content_undated_pending_count` > 0 fails the gate. If pending is above zero and no dated hold exists, `omi_held_content_oldest_age_seconds` is the sentinel -1, not 0; age 0 is an empty population or a hold listed at the snapshot clock. No unexplained oldest-age growth; no progress for two discovery rotations after lease expiry pages the owner. Hold the step if the denominator is too small; synthetic completion is mandatory. | |
There was a problem hiding this comment.
P2: This promotion-gate query escapes regex alternation as \| inside a PromQL string, which makes the query invalid rather than matching the skip outcomes. Use plain | separators, as in the other runbook queries, so the recovery gate can be evaluated.
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/runbooks/held-content-acceptance.md, line 117:
<comment>This promotion-gate query escapes regex alternation as `\|` inside a PromQL string, which makes the query invalid rather than matching the skip outcomes. Use plain `|` separators, as in the other runbook queries, so the recovery gate can be evaluated.</comment>
<file context>
@@ -114,10 +114,18 @@ Do not `sum()` these gauges, and do not `max()` the gauge itself.
| Lost capture | `omi_held_content_capture_total{kind="lost"}`, `{kind="byte_mismatch"}`, `{kind="frame_mismatch"}`, and `{kind="ack_without_authority"}` stay at zero new events. Any loss stops immediately. Track volatile PCM separately: the last unpublished <=15 seconds is not an acknowledged custody guarantee. |
| Choice API and capability | `omi_held_content_choice_5xx_total` no more than baseline +0.1 percentage point. p95 of `omi_held_content_choice_latency_seconds` no more than 1.2x baseline (`histogram_quantile(0.95, sum by (le, method) (rate(omi_held_content_choice_latency_seconds_bucket[5m])))`). `omi_held_content_choice_total{outcome="no_capability"}` is the dark/excluded 404 path, not a 200. `{outcome="stale_period_409"}` may be non-zero at the UTC boundary and must not accompany a write. `{outcome="intent_only"}` counts upgrade writes; `{outcome="ok"}` is the other success. A managed grant from an upgrade choice increments `{outcome="intent_only"}` on the read and stops the step. Expected other 409/429 outcomes are not this series. |
-| Recovery completion and held age | `omi_held_content_recovery_total{result="completed"}` / `{result="attempt"}` >= 99% within the predeclared visit/lease/discovery budget. `omi_held_content_oldest_age_seconds`, `omi_held_content_pending_count`, `omi_held_content_pending_seconds`, `omi_held_content_undated_pending_count`, and `omi_held_content_backlog_items` are one fleet snapshot from the `cap-hold-durable-redrive` scheduler (holds count + seconds sum, dated-hold count where `listed_at` > 0, oldest `listed_at` via `limit(1)`, and the sum of `processing_backlog.count` where `state="processing"`). Read each with the newest-snapshot expression above. An empty population is 0. `omi_held_content_undated_pending_count` > 0 fails the gate. If pending is above zero and no dated hold exists, `omi_held_content_oldest_age_seconds` is the sentinel -1, not 0; age 0 is an empty population or a hold listed at the snapshot clock. No unexplained oldest-age growth; no progress for two discovery rotations after lease expiry pages the owner. Hold the step if the denominator is too small; synthetic completion is mandatory. |
+| Recovery completion and held age | `sum(increase(omi_held_content_recovery_total{result="completed"}[24h])) / (sum(increase(omi_held_content_recovery_total{result="attempt"}[24h])) + sum(increase(omi_held_content_recovery_skipped_total{outcome=~"out_of_scope\|unknown_origin\|unknown"}[24h])))` >= 0.99 over the watch window, within the predeclared visit/lease/discovery budget (`sum()` drops the differing `result`/`outcome` labels so the series divide). A processing choice skips an out-of-scope or unknown-origin hold before any attempt, so `completed / attempt` alone can read healthy while nothing recovers; the skip counter closes that gap, and any sustained `unknown_origin` growth holds the step. `{outcome="text_out_of_scope"}` counts deferred text rows and is read separately. Attempts and completions count only the legacy recovery path; holds handed to batch admission appear in neither. `omi_held_content_oldest_age_seconds`, `omi_held_content_pending_count`, `omi_held_content_pending_seconds`, `omi_held_content_undated_pending_count`, and `omi_held_content_backlog_items` are one fleet snapshot from the `cap-hold-durable-redrive` scheduler (holds count + seconds sum, dated-hold count where `listed_at` > 0, oldest `listed_at` via `limit(1)`, and the sum of `processing_backlog.count` where `state="processing"`). Read each with the newest-snapshot expression above. An empty population is 0. `omi_held_content_undated_pending_count` > 0 fails the gate. If pending is above zero and no dated hold exists, `omi_held_content_oldest_age_seconds` is the sentinel -1, not 0; age 0 is an empty population or a hold listed at the snapshot clock. No unexplained oldest-age growth; no progress for two discovery rotations after lease expiry pages the owner. Hold the step if the denominator is too small; synthetic completion is mandatory. |
| Spend and reconciliation | Zero unexplained duplicate usage keys or repeat provider dispatch, no increase in `omi_stt_cap_recovery_reconciliation_total{outcome="redispatched"}` / `failed`; any lost or doubly funded probe audio stops immediately. Preserve receipts/audio for investigation. Compare vendor usage with internal accepted seconds; internal counters alone are not invoice proof. |
| Custody maintenance and deletion | `omi_held_content_erasure_total{outcome="failure"}` stays at zero new events after the retry budget. `{outcome="post_delete_publication"}` stays at zero: it increments only when a publish observes a `purged` receipt and returns before any manifest commit or upload. `event=cap_hold_redrive` progresses with no repeated `worker_deferred`, `seal_deferred`, `cleanup_deferred`, or `fleet_snapshot_deferred`. No launch-config errors; stable live STT and sync/client 5xx. |
</file context>
| | Recovery completion and held age | `sum(increase(omi_held_content_recovery_total{result="completed"}[24h])) / (sum(increase(omi_held_content_recovery_total{result="attempt"}[24h])) + sum(increase(omi_held_content_recovery_skipped_total{outcome=~"out_of_scope\|unknown_origin\|unknown"}[24h])))` >= 0.99 over the watch window, within the predeclared visit/lease/discovery budget (`sum()` drops the differing `result`/`outcome` labels so the series divide). A processing choice skips an out-of-scope or unknown-origin hold before any attempt, so `completed / attempt` alone can read healthy while nothing recovers; the skip counter closes that gap, and any sustained `unknown_origin` growth holds the step. `{outcome="text_out_of_scope"}` counts deferred text rows and is read separately. Attempts and completions count only the legacy recovery path; holds handed to batch admission appear in neither. `omi_held_content_oldest_age_seconds`, `omi_held_content_pending_count`, `omi_held_content_pending_seconds`, `omi_held_content_undated_pending_count`, and `omi_held_content_backlog_items` are one fleet snapshot from the `cap-hold-durable-redrive` scheduler (holds count + seconds sum, dated-hold count where `listed_at` > 0, oldest `listed_at` via `limit(1)`, and the sum of `processing_backlog.count` where `state="processing"`). Read each with the newest-snapshot expression above. An empty population is 0. `omi_held_content_undated_pending_count` > 0 fails the gate. If pending is above zero and no dated hold exists, `omi_held_content_oldest_age_seconds` is the sentinel -1, not 0; age 0 is an empty population or a hold listed at the snapshot clock. No unexplained oldest-age growth; no progress for two discovery rotations after lease expiry pages the owner. Hold the step if the denominator is too small; synthetic completion is mandatory. | | |
| | Recovery completion and held age | `sum(increase(omi_held_content_recovery_total{result="completed"}[24h])) / (sum(increase(omi_held_content_recovery_total{result="attempt"}[24h])) + sum(increase(omi_held_content_recovery_skipped_total{outcome=~"out_of_scope|unknown_origin|unknown"}[24h])))` >= 0.99 over the watch window, within the predeclared visit/lease/discovery budget (`sum()` drops the differing `result`/`outcome` labels so the series divide). A processing choice skips an out-of-scope or unknown-origin hold before any attempt, so `completed / attempt` alone can read healthy while nothing recovers; the skip counter closes that gap, and any sustained `unknown_origin` growth holds the step. `{outcome="text_out_of_scope"}` counts deferred text rows and is read separately. Attempts and completions count only the legacy recovery path; holds handed to batch admission appear in neither. `omi_held_content_oldest_age_seconds`, `omi_held_content_pending_count`, `omi_held_content_pending_seconds`, `omi_held_content_undated_pending_count`, and `omi_held_content_backlog_items` are one fleet snapshot from the `cap-hold-durable-redrive` scheduler (holds count + seconds sum, dated-hold count where `listed_at` > 0, oldest `listed_at` via `limit(1)`, and the sum of `processing_backlog.count` where `state="processing"`). Read each with the newest-snapshot expression above. An empty population is 0. `omi_held_content_undated_pending_count` > 0 fails the gate. If pending is above zero and no dated hold exists, `omi_held_content_oldest_age_seconds` is the sentinel -1, not 0; age 0 is an empty population or a hold listed at the snapshot clock. No unexplained oldest-age growth; no progress for two discovery rotations after lease expiry pages the owner. Hold the step if the denominator is too small; synthetic completion is mandatory. | |
|
|
||
| @pytest.mark.parametrize('asynchronous', [False, True]) | ||
| async def test_upgrade_consent_only_starts_selected_owner(admission, consent, monkeypatch, asynchronous): | ||
| async def test_trial_start_consent_only_starts_selected_owner(admission, consent, monkeypatch): |
There was a problem hiding this comment.
P2: This replacement drops cohort coverage for both conversion entry points, including the synchronous upgrade() still called by the plan-change route. Keep the existing upgrade test and add a separate trial-start gate test so conversion regressions remain detected.
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_stt_cap_recovery_cohort.py, line 86:
<comment>This replacement drops cohort coverage for both conversion entry points, including the synchronous `upgrade()` still called by the plan-change route. Keep the existing upgrade test and add a separate trial-start gate test so conversion regressions remain detected.</comment>
<file context>
@@ -81,16 +83,13 @@ def test_manual_consent_only_starts_selected_owner(admission, consent):
[email protected]('asynchronous', [False, True])
-async def test_upgrade_consent_only_starts_selected_owner(admission, consent, monkeypatch, asynchronous):
+async def test_trial_start_consent_only_starts_selected_owner(admission, consent, monkeypatch):
async def immediate(pool, fn, *args, **kwargs):
return fn(*args, **kwargs)
</file context>
| an already-authorized current-month pending trial grant into a fresh token, allowance | ||
| and cutoff. Excluded rows do not block that grant. Without an eligible grant, |
There was a problem hiding this comment.
P2: This now documents only pending trial grants, but the finish transaction also consumes pending conversion upgrades. Name both automatic release types here so operators do not assume a conversion cannot be handed off at page completion.
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/stt-cap-dispatch.md, line 177:
<comment>This now documents only pending trial grants, but the finish transaction also consumes pending conversion upgrades. Name both automatic release types here so operators do not assume a conversion cannot be handed off at page completion.</comment>
<file context>
@@ -140,8 +174,8 @@ the reservation. Such ambiguous reservations conservatively block that choice
At page completion the store refuses any actual reservation first, then consumes
-an already-authorized current-month pending upgrade into a fresh token, allowance
-and cutoff. Excluded rows do not block that upgrade. Without an eligible upgrade,
+an already-authorized current-month pending trial grant into a fresh token, allowance
+and cutoff. Excluded rows do not block that grant. Without an eligible grant,
skipped scope keeps the choice processing and atomically rewinds its cursors;
</file context>
| an already-authorized current-month pending trial grant into a fresh token, allowance | |
| and cutoff. Excluded rows do not block that grant. Without an eligible grant, | |
| an already-authorized current-month pending automatic release (trial grant or conversion) into a fresh token, allowance | |
| and cutoff. Excluded rows do not block that release. Without an eligible release, |
| # The HPA sizes on worker_flight: idle-only release must not buy a GPU. | ||
| ( | ||
| 'worker_flight_deep' | ||
| if all(v.item.priority == Priority.DEEP for v in leases) |
There was a problem hiding this comment.
P2: This label includes skipped leases even though the worker dispatch excludes them on the next line. When a mixed batch loses its non-DEEP lease before dispatch, the remaining DEEP-only work is recorded as worker_flight, causing the HPA to scale on idle-only work; classify only active leases.
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/utils/batch_pipeline/pump.py, line 492:
<comment>This label includes skipped leases even though the worker dispatch excludes them on the next line. When a mixed batch loses its non-DEEP lease before dispatch, the remaining DEEP-only work is recorded as `worker_flight`, causing the HPA to scale on idle-only work; classify only active leases.</comment>
<file context>
@@ -485,7 +486,12 @@ async def discard_invalid_preparation(handle):
+ # The HPA sizes on worker_flight: idle-only release must not buy a GPU.
+ (
+ 'worker_flight_deep'
+ if all(v.item.priority == Priority.DEEP for v in leases)
+ else 'worker_flight'
+ ),
</file context>
| if all(v.item.priority == Priority.DEEP for v in leases) | |
| if ( | |
| any(v.item.segment_id not in skipped for v in leases) | |
| and all( | |
| v.item.priority == Priority.DEEP | |
| for v in leases | |
| if v.item.segment_id not in skipped | |
| ) | |
| ) |
| assert first['release_priority_units'] == PRIORITY_HOURS * RATE | ||
| owner.client.rows[SUMMARY]['state'] = 'waiting_choice' | ||
| await worker.trial_started_async(UID, trialing(id='sub_second')) | ||
| assert owner.choice()['state'] == 'waiting_choice' |
There was a problem hiding this comment.
P2: This assertion does not verify that the rejected second trial request is recorded as rejected. Add a receipt assertion; otherwise the test can pass while the account-level once-only gate reports an accepted grant that never started.
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_held_recovery_trial_grant.py, line 187:
<comment>This assertion does not verify that the rejected second trial request is recorded as rejected. Add a receipt assertion; otherwise the test can pass while the account-level once-only gate reports an accepted grant that never started.</comment>
<file context>
@@ -0,0 +1,332 @@
+ assert first['release_priority_units'] == PRIORITY_HOURS * RATE
+ owner.client.rows[SUMMARY]['state'] = 'waiting_choice'
+ await worker.trial_started_async(UID, trialing(id='sub_second'))
+ assert owner.choice()['state'] == 'waiting_choice'
+
+
</file context>
| 'token': uuid4().hex, | ||
| 'cutoff': cutoff, | ||
| 'remaining': None, | ||
| 'pending_upgrade': {}, |
There was a problem hiding this comment.
P2: This unconditional reset drops a pending paid-conversion intent when a trial grant rolls into the next month. The conversion receipt already exists, so Stripe retries return the current row without recreating the intent; preserve a retryable conversion or explicitly make its receipt retryable before rolling.
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/database/processing_backlog.py, line 212:
<comment>This unconditional reset drops a pending paid-conversion intent when a trial grant rolls into the next month. The conversion receipt already exists, so Stripe retries return the current row without recreating the intent; preserve a retryable conversion or explicitly make its receipt retryable before rolling.</comment>
<file context>
@@ -164,6 +179,55 @@ def commit(tx):
+ 'token': uuid4().hex,
+ 'cutoff': cutoff,
+ 'remaining': None,
+ 'pending_upgrade': {},
+ 'scope_skipped': False,
+ 'cursor_audio': None,
</file context>
| if not begin: | ||
| return current | ||
| # The per-account ledger: a second trial on any subscription grants nothing. | ||
| if trial and current.get('trial_granted_at'): |
There was a problem hiding this comment.
P2: The one-per-account trial ledger is not recorded when the first valid trial has no eligible backlog, allowing a later trial to grant again. Record the trial consumption before the begin=False early return for a current-period trial.
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/database/processing_backlog.py, line 139:
<comment>The one-per-account trial ledger is not recorded when the first valid trial has no eligible backlog, allowing a later trial to grant again. Record the trial consumption before the `begin=False` early return for a current-period trial.</comment>
<file context>
@@ -133,12 +135,22 @@ def commit(tx):
if not begin:
return current
+ # The per-account ledger: a second trial on any subscription grants nothing.
+ if trial and current.get('trial_granted_at'):
+ return current
+ ledger = {'trial_granted_at': time.time()} if trial else {}
</file context>
…egacy-started holds Luna r1 P1: a Basic owner starting an Unlimited trial raised the allowance, so the conversion path started an unlimited release before the 25h grant. A conversion now releases only when the Stripe subscription is active; a trialing one is covered by its grant and converts on trialing->active. The checkout and plan-change triggers move into the worker with the same rule. Luna r1 P2: a hold with legacy spend can only finish on the legacy route, outside the idle gate and vendor table, so an automatic release passes over it (decision legacy_started) and it stays held for a manual choice. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ted rules Co-Authored-By: Claude Opus 5.5 <[email protected]>
… Stripe status Luna r2 P1: the legacy-started check read the candidate snapshot and was skipped for resumed reservations. The worker now rereads the hold before each automatic attempt and defers legacy-started audio, and recover_selected refuses the legacy fallback whenever an automatic release is in scope, after its own claim. Luna r2 P2: an immediate plan change passes the modified subscription's own Stripe status, and other conversions retry the status lookup three times and count a persistent failure as a conversion error instead of a silent no-op. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
… event Lead review of the r2 residual: with the Process button removed, a checkout whose Stripe lookup failed would leave a paying owner no release path. A paid subscription created active now releases as a conversion from customer.subscription.created, whose payload carries the status. Creation happens once per subscription, so renewal never starts a release. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
) <!-- claude-projects-attribution: {"github_login":"Git-on-my-level"} --> _Requested by **David**_ ## What changed and why David's Home showed three 1s "Thank you" rows for about 12 hours, plus "Yeah." (5m44s), "I don't know" (2m12s) and "ハハハハ" fragments that later vanished. David asked that users never see these rows. - **Short-clip floor skipped the rules.** `quiet_minimum` returned a kept row before relevance ran. Text the rules prove content-free (`filler_only`, `no_content_words`, `mic_check`) now discards on that path. User curation, keep triggers such as first open, and calendar overlap still keep it. - **Occasion retention outranked the rules.** A content-free clip was kept because a neighbor or episode member existed. There's nothing in it to transfer to a survivor, so the rules now run first. This narrows `c3863b3e9203a`, on content-free text only; any text with content still stays until absorption. - **Katakana laughter.** `CJK_FILLER_CHARS` had hiragana `は` only. `ハ` and `イ` are added, so `ハハハハ` and `ハイ` are filler while `アイ` still goes to the model. `RULES_VERSION` moves to 2. - **Settling hold.** A short batch-owned row (under 60s, or a server minimum) stays off default reads until batch text lands, the upload fails or a partial is published, for at most 2 hours from `finished_at`. It's presentation only: nothing is stored. A live episode whose only rows are settling stays off `/v1/episodes/live` too. It uses the existing `HOME_HIDE_BELOW_FLOOR_ROWS` kill switch. `record_audio_closed` is deliberately not a release signal, because the live text is still provisional then. - **Stored rows.** The episode list also hides rows with a stored below-floor decision and no `summary_blocked_reason`. `conversation_relevance_backfill.py` can re-judge floor and occasion keeps. Dry run stays the default and nothing has been applied. The upload half of the report needs no change here: reading the code, the open row and the "processing on Omi" label behave as designed, and held-audio release belongs to #24382. ## Product invariants affected - INV-MEM-4: a content-free short clip now records a discard instead of a keep. Discarded rows produce no memory intake, and this PR adds no intake, promotion or consolidation route. - INV-TASK-2: no capture policy or task write changes, and a discarded clip yields no task candidate. ## How it was verified Repo `BasedHardware/omi`, `lane/offlinesync-noise`. Layer measured: unit tests only. - `pytest` file by file over 24 affected test files, Google credentials stripped: all passed. This includes the relevance, short-clip, occasion, recovery, episode Home, sync visibility and archive filter contract suites. - `relevance_rules.py` run directly on the reported strings returns discard for "Thank you", "Yeah." and "I don't know". Not verified: - **David's stored rows.** The read-only look at them was approved, but this Mac's permission check blocked it. So the claim that the "Thank you" rows took the short-clip path rests on code plus the screenshot: the title is the transcript and the icon is the minimum's 💬. Check `relevance_decision.reason` on those rows after deploy; `content_below_floor` confirms it. - **Dev or production behaviour.** Nothing has been deployed. ## Risks - A real short recording appears later than it does today: when batch text lands, or at 2 hours at most if it's stuck. - `is_visible_conversation` is shared, so the hold also applies to other default readers and to direct reads without `include_discarded`, matching `bridge_pending`. Rollback: set `HOME_HIDE_BELOW_FLOOR_ROWS=false`. - A client may still show the row returned by its own finalize call until the next list refresh. This PR changes no client code. - `"Brief Conversation Fragment"`-style rows of 60s or longer with model notes aren't held. ## Review Luna review of the first head had 5 findings. Fixed: live episode bypass, starred or foldered short clips discarded at finalize, katakana set too broad. Not fixed: MCP and agent previews can return a held row, because they aren't Home; and the list count can exceed the list by the held rows for up to 2 hours, because an exact count needs an extra query on every count call. Luna's re-check confirmed the curated and katakana fixes and added one known limit, also not fixed: a live episode with another visible row still shows the held row's moments on `/v1/episodes/live`. They appear inside that episode, not as a standalone Home row, and hiding them needs moment-level filtering. ## Tests Regression tests: `test_a_content_free_short_clip_is_hidden_not_stood_up_as_a_row`, `test_content_free_text_is_no_evidence_of_an_occasion`, `test_katakana_laughter_and_acknowledgement_are_filler`, `test_record_settling.py`, `test_a_stored_floor_decision_without_a_blocked_reason_leaves_the_list`, `test_keeps_that_never_ran_the_rules_are_rejudged`. ## UI evidence UI-Evidence: none -- backend only ## Line count Line-Count-Exception: backend/database/conversations.py | 4649 -> 4652 | Shared visibility predicate and its list field mask must sit beside the other holds in this file. Line-Count-Exception: backend/utils/conversations/process_conversation.py | 3411 -> 3412 | One import for the short-clip decision; the logic itself lives in relevance_io.py. ## Failure class (fixes) Failure-Class: FC-rule-discard-left-visible 🤖 Generated with [Claude Code](https://claude.com/claude-code)
… review) (#24397) <!-- claude-projects-attribution: {"github_login":"Git-on-my-level"} --> _Requested by **David**_ ## What David reviewed 49 recently added UI items on 11-02 and gave a call on each one: 14 Remove, 15 Simplify, 20 Keep. This PR carries out those calls, plus his follow-ups on the renders (14:54Z, 15:43Z). It changes the Flutter app and one macOS badge. **Merge dependency:** do not merge before **#24382** (backend automatic release for held audio). This PR removes Home's waiting card, whose **Process** button is today's only way to release held recordings by hand. Once #24382 ships, the release happens on its own. ### Home - Above the conversation list, Home shows only **Questions for you** (David: "Only the Questions for you should show up"). Removed from Home: the waiting card and its rows, Process/Not now, the processing and paused states, the confirm dialog, the older waiting card, the on-device banners, the yearly row and the dogfood alert. The speech-profile and firmware-update cards stay (David, 14:54Z). - Recordings waiting for a plan come back as **locked rows** in the list, on their own day (David: "show the locked conversation rows again"). - They keep the frosted card, with no "Pending" text and a single **Upgrade** action that opens the plans (David, 15:43Z: "frosted card, but no Pending text its ugly"). - Locked conversation rows match: Upgrade instead of View Usage, and no Pending. - There is no "Transcribe on this phone" option: it cannot unlock a recording already held on the server (David, 14:54Z). - The on-device banners and the dogfood alert (still debug and TestFlight only) moved to the **Activity (bell) page** (David: "Move any of this stuff into the Notification Bell page"). - Short clips (noise and media) no longer fold on Home. Search finds them under a new **Short clips** filter (David: "Only shows up in search + add a search filter for it"). ### Elsewhere - **Memories:** locked memory rows match locked conversation rows: frosted card, no Pending text, Upgrade opens the plans sheet. They had shown Pending and View Usage. - **Plan & Usage:** the waiting card is gone. Only the save-live-hours toggle remains. - **Live page:** the paused upsell banner is removed. Notes lose the "On this phone" tag and caption. The "Recording safely" card is now one quiet line. - **On the Way:** the big headline, its progress bar and "Details for support" are removed. The day rows stay. - **Offline Sync:** - The step bar is one determinate bar. - Refused rows use a neutral status and no inline red Delete; swipe and confirm still remove them. - The charger wait is a quiet line here instead of a row status (David: "Put into Offline Sync page"). - The sync details sheet shows only where the audio is. Speed, file and job counts and the firmware version now go only into the "Copy details for support" text. - **Edge throttle:** "Syncing paused briefly" is no longer shown anywhere (David, 14:54Z: "remove the syncing paused briefly since it's not actionable by the user"). Other cooldowns (backend busy, fair use, dispatch hold) still show. - **Summaries:** "Made on your iPhone" is a one-liner, and its explanation opens only on tap. - **Device page:** the stat tiles are one plain line that wraps at large text. - **Onboarding:** "Connect Omi" is the one filled button (David: "Emphasize Omi"). - **Review:** - Dream Report drops tokens, cost and shadow copy. A preview-mode report still labels its edits "Would fix". - Recent changes is a lighter list. - **macOS:** the locked badge says **Waiting** in neutral ink instead of the amber "Saved and waiting". Strings: added `searchNoiseFilter`; restored `dreamReportWouldFix` with main's translations; removed the dead `homeNoiseFold*` and `syncDetailsForSupport`. All changes went through `scripts/l10n.py` for 49 locales. ## Renders | Change | Before (main) | After (this PR) | |---|---|---| | Home above the list | <img src="https://raw.githubusercontent.com/BasedHardware/omi/4b61ffd523e5/.agent-artifacts/ui-evidence/ui-junk-audit/001-mobile-ios-home-before-stack.png" width="260" alt="Home above the list before"> | <img src="https://raw.githubusercontent.com/BasedHardware/omi/4b61ffd523e5/.agent-artifacts/ui-evidence/ui-junk-audit/002-mobile-ios-home-after-questions-locked.png" width="260" alt="Home above the list after"> | | Short clips | <img src="https://raw.githubusercontent.com/BasedHardware/omi/4b61ffd523e5/.agent-artifacts/ui-evidence/ui-junk-audit/004-mobile-ios-short-clips-before-fold.png" width="260" alt="Short clips before"> | <img src="https://raw.githubusercontent.com/BasedHardware/omi/4b61ffd523e5/.agent-artifacts/ui-evidence/ui-junk-audit/005-mobile-ios-short-clips-after-search.png" width="260" alt="Short clips after"> | | Made on iPhone | <img src="https://raw.githubusercontent.com/BasedHardware/omi/4b61ffd523e5/.agent-artifacts/ui-evidence/ui-junk-audit/006-mobile-ios-made-on-iphone-before.png" width="260" alt="Made on iPhone before"> | <img src="https://raw.githubusercontent.com/BasedHardware/omi/4b61ffd523e5/.agent-artifacts/ui-evidence/ui-junk-audit/007-mobile-ios-made-on-iphone-after.png" width="260" alt="Made on iPhone after"> | | Live notes tag | <img src="https://raw.githubusercontent.com/BasedHardware/omi/4b61ffd523e5/.agent-artifacts/ui-evidence/ui-junk-audit/008-mobile-ios-live-notes-before.png" width="260" alt="Live notes tag before"> | <img src="https://raw.githubusercontent.com/BasedHardware/omi/4b61ffd523e5/.agent-artifacts/ui-evidence/ui-junk-audit/009-mobile-ios-live-notes-after.png" width="260" alt="Live notes tag after"> | | Live transcript card | <img src="https://raw.githubusercontent.com/BasedHardware/omi/4b61ffd523e5/.agent-artifacts/ui-evidence/ui-junk-audit/010-mobile-ios-live-transcript-before.png" width="260" alt="Live transcript card before"> | <img src="https://raw.githubusercontent.com/BasedHardware/omi/4b61ffd523e5/.agent-artifacts/ui-evidence/ui-junk-audit/011-mobile-ios-live-transcript-after.png" width="260" alt="Live transcript card after"> | | Plan & Usage waiting card | <img src="https://raw.githubusercontent.com/BasedHardware/omi/4b61ffd523e5/.agent-artifacts/ui-evidence/ui-junk-audit/012-mobile-ios-plan-usage-before.png" width="260" alt="Plan & Usage waiting card before"> | Removed | | Live page paused banner | <img src="https://raw.githubusercontent.com/BasedHardware/omi/4b61ffd523e5/.agent-artifacts/ui-evidence/ui-junk-audit/013-mobile-ios-live-paused-banner-before.png" width="260" alt="Live page paused banner before"> | Removed | Locked row history, from one fixture: Sep 30–Oct 14, Oct 14–now on main, and this PR: <img src="https://raw.githubusercontent.com/BasedHardware/omi/4b61ffd523e5/.agent-artifacts/ui-evidence/ui-junk-audit/003-mobile-ios-locked-row-history.png" width="260" alt="locked row history"> ## Review round 1 (Luna), addressed - **P1, integration-test search fakes:** fixed. Both visual-audit `search.dart` overrides take `includeNoise`. - **P1, no UI path for `waiting_choice`:** intended. It is this PR's merge dependency on #24382, which releases held audio automatically, so no manual accept is needed. Deferred conversations still appear as locked conversation rows and open the plans. This PR must not merge before #24382. - **P2, Dream Report preview mode said "Fixed":** fixed in round 2 per edit (see below); "Would fix" string restored from main. - **P2, short clips filtered from only the first 20 discarded matches:** mitigated. With the filter on, search reads 50 discarded matches. The backend has no content-kind filter, so a clip past the first 50 discarded matches can still be missed. ## Review round 2 (Luna, delta), addressed - **P1, a live report labelled every edit "Fixed":** fixed. Each edit is labelled by its own `outcome`: applied edits show under "Fixed"; suggest-only, suppressed and shadow edits show under "Would fix". The test covers a mixed run in a live report. This replaces the round-1 report-level label. Failure-Class: FC-decoded-outcome-discarded-before-canonical-record ## Invariants - INV-NAV-1: `ConversationRowView.swift` changes only a comment about the locked badge's copy. No destination or route changes, and Conversations keeps its feature-complete page. - INV-MEM-1: `memory_item.dart` changes only the locked row's copy and its tap destination (the plans sheet). No memory tier, collection or access change. - PRODUCT.md asks for honest cooldown states. The edge-throttle pause is now hidden at David's explicit direction (quoted above), because it clears by itself and asks nothing of the user. Every other cooldown still shows. ## Verification - `flutter analyze` on `lib` and `test` after merging main, plus the changed `integration_test` files: clean, apart from the generated-env errors that exist on main. - Ran 123 affected test files (tests importing changed files, plus changed tests), then the round-2 set (103 tests). All pass except `l5_home_visibility_test` "closed episode Home and search open the episode page", which times out in `pumpAndSettle` on unmodified main as well: it failed 2 of 3 main runs, under heavy host load. - New tests: - `ui_cleanup_render_test.dart`: Home locked rows and the search filter. - A short-clips filter behaviour test. - A collapsed-by-default check for the on-device provenance. - Locked rows carry no Pending text. - An edge throttle shows no pause. - macOS: copy-only Swift change. The pre-push gate built the app. - `scripts/pr-preflight --pr-body-file`: passed. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
What this does
Releases held audio automatically in two cases, both throttled:
Main already starts a conversion release, but only when the whole backlog fits the allowance. So the owners with the largest backlogs got nothing. Once the waiting-recordings cards (and their Process button) are removed in the separate UI PR, these releases become the path for held audio after an upgrade.
This PR is backend only. The branch's earlier app, l10n, analytics and changelog changes are reverted here (commit
chore(app): leave the app UI out…); the UI cleanup ships as its own PR with renders.David's ruling, in his words
The limits below scale the approved proposal by the same quarter. That scaling is the session's reading of "lower other throttles" and was reported to David.
Limits
Every automatic release passes
utils/backlog_release.decideonce per recording; a manual tap does not. A refusal leaves the recording held and the cursor unmoved, and the next sweep asks again.BACKLOG_RELEASE_ENABLED, on unless set to off. Off refuses every new recording and stops a release already in progress at its next recording (processing_backlog_worker.runreturns before claiming). Audio already admitted to batch finishes; nothing is deleted.trial_granted_at). Older held audio stays locked; cancelling or lapsing the trial parks the release (paid_owneris re-read on every visit).Held audio never takes the cheaper-vendor table (
vendor_table=False).Lead merge conditions
1. Measured idle signal. The HPA takes the larger of two signals:
worker_flight, against a target of 0.5 per worker.So a low priority alone does not make a release idle-only. Each signal is handled separately:
worker_flight_deep, which the adapter'sworker_flightrule does not read. Released DEEP audio therefore cannot buy a GPU through this metric.Measured on prod,
prod-omi-backend, last 7 days, 10-minute steps, read-only GMP:2. Backfill tagged apart from fresh in hard-3 and the 2h alarm.
release: trial|conversionon its intake record and on every batch job row.priority. RECENT is shared with fresh-lane catch-up, which is why a separate tag is needed.t3_pending_over7200) and fresh record latency for at most 24h, and is reported asrelease_t3_*.3. Daily cost against the $1,950/day target.
4. Kill switch that stops in-progress releases. Covered by
test_kill_switch_stops_a_release_already_runningandtest_kill_switch_stops_everything_including_priority_hours.5. David's yes, in his words. Quoted above.
Known problems, stated rather than hidden
Luna round 1 (FIX-FIRST), both fixed
active. That covers the subscription event, checkout and immediate plan change, all now inprocessing_backlog_worker.legacy_started) like audio that does not fit, and it stays held for a manual choice.Luna round 2 (delta, FIX-FIRST), both addressed
_processrereads the hold before every automatic attempt, resumed reservations included, and defers legacy-started audio (it stays held).recover_selectedrefuses the legacy fallback whenever an automatic release is in scope, after its own row claim. The next visit rereads and passes over the hold, so nothing stalls.stripe.Subscription.modify), so it does no second lookup.omi_processing_backlog_choice{source=conversion,outcome=error}.customer.subscription.createdevent for the same purchase. That event carries the subscription's status in its payload, so it needs no lookup, and a paid subscription createdactivereleases as a conversion. Creation happens once per subscription, so a renewal never starts a release. The lookup failure stays counted. An unknown status is never treated as a paid charge, which would reopen P1. (The lead noted the UI PR feat(app): clean up recent UI per David's 49 calls (Home, sync, live, review) #24397 removes the manual Process button, so this event path is the retry.)At the two-round cap, the lead (via uitrial, 2026-11-02 15:20Z) accepted this as SHIP with no third review. The conditions were exact-head CI green, and this body stating the Modulate hours inside the 400 h cap and the r2 residual. The event-path retry above closes the lead's follow-up on that residual.
Verification
BACKEND_UNIT_TEST_FILE_LIST=<changed and related files> bash backend/test.sh(18 release files, then 18 payment and billing files after the router refactor, all passed). The first run had 37 passed and 1 failed:test_fleet_snapshot_runs_beside_the_sweep_not_ahead_of_its_work, a 2-second thread-timing check under host load, which passed on rerun along with the fixed gate test (38 + 26 passed).ro-prodtier, aggregates only.Deploy needed (lead)
Backend images that run the processing-backlog worker and payment webhooks (
backend), shared batch intake (backend,backend-listen), andbatch-pipeline-worker(theworker_flight_deepstage). New Redis keys:rl:backlog-release:v1:*. New metric:omi_held_content_backlog_release_total{decision}. Rollback:BACKLOG_RELEASE_ENABLED=falsestops all automatic releases at their next recording.Product invariants affected
none
Failure class (fixes)
Failure-Class: none
🤖 Generated with Claude Code