Repository navigation
SCA-4247: Recover background Flex and reuse V3 outline prefixes - #26258
Conversation
Git-on-my-level
left a comment
There was a problem hiding this comment.
FIX findings on exact head d39f9496135a9ba571c7d42e5c492932bfef45cc. The outline arms being off by default does not cover these default-on background completion paths. The 300-pair replay, SCA-3677 clearance, SCA-3655/3657 freshness checks, and Margin GO remain separate rollout gates. The connected GitHub identity authored this PR, so GitHub rejected a formal REQUEST_CHANGES review; these comments record the findings.
Failure-Class: none Co-Authored-By: Claude Opus 5.5 <[email protected]>
Git-on-my-level
left a comment
There was a problem hiding this comment.
RE-REVIEW: both prior P1 fixes are verified at exact head 196329985f81cad81275ef36ab4be3018a987d2d. Flex timeouts stop dispatch even without a usage receipt; only a confirmed receipt-free 429 retains the scoped Standard reserve. The summary stream rechecks freshness and eligibility on the row reloaded under its lease, releases the lease, and serves stored notes without starting the notes model. The added race test asserts zero notes calls and lease release. No additional background retry was added; the stated delay/recovery tradeoff remains. The 178 passing tests are reported by the author; I did not rerun them. The replay, custody, freshness, and Margin GO gates remain separate.
Failure-Class: none
Git-on-my-level
left a comment
There was a problem hiding this comment.
Delta review at exact head abef1ac (from 1963299): no P0/P1 found for the requested shipped configuration. With OMI_V3_SUMMARY_FIRST_OPEN_GATING and both outline arms off, the new first-open behaviors are inactive; summary reads, background enrichment, and the v3_process_pending queue retain main behavior. The existing Flex recovery and the receipt-free timeout stop and lease freshness recheck remain. Static review only; I did not rerun tests.
Failure-Class: none
Failure-Class: none
Failure-Class: none
Failure-Class: none
… owner (#26530) Follow-up to #26258 for SCA-4247. - Use one gateway deadline from a valid backend background budget for Standard, Flex, and failover. Scoped Flex requires enough time for the Standard reserve and a useful Flex attempt. - Scope opt-in V3 outline prompt cache keys by owner for both streaming and builder calls. - Register V3 summary first-open gating with its default-off behavior and SCA-3677 rollout gate. Document scoped and legacy Flex fallback and rollback behavior. - Cover default-mode deterministic outline cache reuse and assert that the second pass skips the model. ## Product invariants affected none ## Failure class Failure-Class: FC-per-hop-timeout ## Verification - From `backend/`, `.venv/bin/python -m pytest -q tests/unit/test_llm_gateway_executor.py tests/unit/test_conversations_v3_review.py tests/unit/test_conversations_v3_stream.py` passed all 262 tests. - `python -m testing.pipeline_lab affected` selected 16 scenarios. All 16 passed with the local emulator and fake gateway. - `python3 scripts/check_feature_flag_registry.py` passed. - Pre-push PR preflight passed all 42 checks with this PR body. SCA-4247 continues to track serving evidence and the matched R36 readback. First-open gating uses the December 1 review checkpoint shared by the related outline flags. <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/26530?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="View guided diff" src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a> <a href="https://www.cubic.dev/action/auto-fix/pr/BasedHardware/omi/26530?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F26530&source=description" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"><img alt="Turn on auto-fix" src="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
What changed and why
SCA-4247 adds caller-scoped Flex budgets for background structure and L1. The old 10–15 second admission caps cut off slower completions, and the first 429 immediately triggered Standard. The Nov 24 partial reason sample contained 294 structure timeouts and 288 rate limits. Eligible calls now retry one 429 when a fresh attempt still fits and reserve time for Standard.
The existing V3 builder lease can be promoted by an explicit open during a paid background outline or summary. A superseded writer cannot publish. Background outline uses the same Luna route and JSON contract with a nonstreaming transport, capped at 110 seconds and admitted only with room before close + 2 hours. The separately reversible cache change places a stable, owner-scoped cache breakpoint before dynamic timing and transcript evidence. It keeps the existing logical result-cache key.
The merge retains main commit
8b3cc87cef7’s Standard default foromi:auto:conversation-v3-summary. Background Flex recovery remains enabled by default forconv-structureandmemory-l1.Product invariants affected
How it was verified
Merge head
dcaf4879344e801892caef84af1af9a523402dbfpassed all 1,279 focused backend tests across 16 files viaomi-heavy run --wait 600 -- timeout 600 bash test.shon M1.After merging current main, all 537 focused backend tests passed across 10 files through
omi-heavy, including the Standard default, Flex receipt and timeout handling, and V3 lease reload and task retries.The default-off gating follow-up passed all 307 tests across the V3 review, stream, transactions, and gateway executor files through
omi-heavy, using a focused subset of the changed-files selection.At the panel follow-up head, 410 focused backend tests passed through the M1
omi-heavygate. This includes synthetic replay sample bounds, provider timeout and retry behavior, strict Firestore lease races, and released-client detail compatibility.Focused
backend/test.shsuite viaomi-heavy, 399 tests passed across gateway executor, V3 engine, stream, transactions, task retry, and finalization.The two open-path suites passed 98 tests after updating the lease fixture, and the two L1 foreground deadline suites passed 32. The bounded pre-push check passed with zero type errors.
The exact stable text measured 1,223 tokens with
o200k_baseversus 546 for the old unexpanded template. The mock HTTP gateway verified the explicit cache breakpoint and unchanged lane, JSON response mode and reasoning effort.Read-only Prometheus reported a 9.05% outline cached-input share for the Nov 23 12:00 to Nov 24 12:00 UTC baseline. Post-change cache share and net spend await matched usage receipts.
The offline evaluator was smoke-tested with 300 synthetic paired receipts. The blind paired model replay, foreground p95/p99, deployment compatibility and custody/freshness gates are pending. Keep first-open gating off pending SCA-3677 and keep the outline arms off pending the rollout evidence below.
Tests
The replay runbook explains the gate and kill switches. Focused regressions cover successful Flex retry, preservation of Standard reserve, realtime admission without budget, message wire format, and the open race against an in-flight writer.
Panel review and rollout
Follow-up to panel
review-20261125t032001-fa2e. Eligible background structure and L1retain the default-on retry and deadline behavior. V3 summaries keep the Standard
default from main (
8b3cc87cef7), where Flex served about 5% of the lane. Aftera readback,
LLM_GATEWAY_FLEX_FIRST_LANEScan re-enable Flex for that lane withouta deploy. Receipt-free Flex timeouts stop dispatch because provider usage may be indeterminate. Only a confirmed receipt-free 429 can use the Standard reserve. Standard retries and failover use the same
deadline. Waited and unscoped calls use Standard.
The V3 summary first-open switch (
OMI_V3_SUMMARY_FIRST_OPEN_GATING) defaults off. SCA-3677 gates activation. With the switch off, background summary generation continues without waiting for a detail open.The outline prompt and cache prefix and the outline Flex transport default off.
After the approved 300-pair replay passes, SCA-3677 transcript access is cleared,
SCA-3655 and SCA-3657 freshness is verified, and Margin writes GO, Release can
enable each arm in the approved cohort. Release owns the backend
OMI_OUTLINE_CACHE_PREFIXkey and the backend and gatewayLLM_GATEWAY_BACKGROUND_OUTLINE_FLEXkey. Margin checks foreground p95/p99,close + 2h publication and net provider spend in the first full 24-hour cohort
window before approving expansion. Set either key to
offto roll it back.UI evidence
UI-Evidence: none -- no visual UI change; the client now marks an explicit conversation-detail open.
Failure class
Failure-Class: none
Line-Count-Exception: backend/database/conversations_v3.py | 1502 -> 1508 | Keep the separate Flex and realtime attempt counters inside the existing lease transaction.
Line-Count-Exception: backend/routers/conversations.py | 3197 -> 3209 | Preserve released-client generation and polling while requiring explicit intent for lease promotion.
Line-Count-Exception: backend/utils/conversations/v3/service.py | 1711 -> 1835 | Keep outline admission, provider ownership fencing and the background settlement race in their existing orchestration path.
Line-Count-Exception: backend/utils/conversations/process_conversation.py | 3612 -> 3614 | Let the existing notes error boundary propagate lease loss to the drain.