Repository navigation
Batch vendor overflow: one oldest-first rule with per-vendor in-flight slots; length-aware Modulate breaker - #26816
Merged
Merged
Conversation
…t slots; length-aware breaker Admission always starts a GPU-capable unit on the GPU and stamps it overflow-eligible inside the vendor-routing cohort. A fleet-paced pump moves stamped units that have waited past BATCH_VENDOR_OVERFLOW_ENTER_SECONDS to a vendor, oldest first whatever their priority, only into a free fleet-wide in-flight slot (Redis ZSET with a lease; Modulate 16, Soniox 6). A unit that finds every vendor full waits in provider_pending with no hold, and none fails. BATCH_VENDOR_OVERFLOW_PRIORITIES is retired. The Modulate latency breaker now allows per-audio-minute latency on top of its flat bounds. Refs SCA-5986, SCA-5183. Failure-Class: new Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Take the vendor slot before reading audio, on armed and unarmed paths, so a slot wait costs no download or inspection; only the chosen vendor keeps one. - A serving health service without its shared store grants no slot and no pump token (no per-pod fallback for a fleet-wide bound). - The builtin table never stamps a unit or names an overflow vendor. - The move re-checks the cohort on its own transactional read. - Rows the pump scans but cannot move leave the scan (re-dated or unstamped), so a ramp-down or a refused move cannot starve the bounded prefix. - Release a unit's slots once its row has left the provider stage. Panel review-20261130t213739-0ba9 F1-F5, F7 (part); SCA-5986 design review. Failure-Class: new Co-Authored-By: Claude Opus 5.5 <[email protected]>
An overlapping pump pass (one that ran past the 5 s token) could renew a slot the winning pass had handed to a running provider call, then release it when its own move lost the CAS, freeing capacity under a live call. The pump now takes a slot only when the unit holds none yet, so it releases only the reservations it created. The provider stage still adopts the pump's slot. SCA-5986 design review (DESIGN: BLOCKED, slot release not fenced). Failure-Class: new Co-Authored-By: Claude Opus 5.5 <[email protected]>
test_sync_future_early_parity executes a pinned older intake.py against the current helpers; that intake still passes gpu_saturated, so routing raised TypeError and sync answered 503. Overflow is the pump's now; the argument is accepted and ignored. Refs SCA-5986. Failure-Class: new Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ease reserve_slot returns the lease it wrote; the pump's rollback removes the slot only while its score is still that lease. A pass that stalled past the 600 s lease can no longer delete a successor's reservation (or one the adopting provider renewed) when its own move CAS fails. SCA-5986 design review (stale rollback after lease expiry). Failure-Class: new Co-Authored-By: Claude Opus 5.5 <[email protected]>
The provider stage now passes the unit's audio length to record_attempt (the length-aware breaker); the failover test's MeteredHealth fake rejected the new keyword, so its records were empty. Refs SCA-5986. Failure-Class: new Co-Authored-By: Claude Opus 5.5 <[email protected]>
Git-on-my-level
added a commit
that referenced
this pull request
Dec 1, 2026
…SCA-5315) (#26866) ## What changed and why Restore the serving predecessor's admission-time GPU overflow at the `backend-sync` upload call for SCA-5315. The original parser includes FRESH and reads the predecessor's `fresh,recent` production setting on Sync. Outside the GPU floor, a configured-priority unit that would choose GPU can select a healthy primary vendor when that priority's backlog is saturated. Sync uploads leave admission without the deferred overflow stamp. The #26816 slot and pump path continues for all other callers, including backfill and integration. The Sync guard failures remain unattributed. Immediate predecessor routing can send newly admitted work to a vendor during saturation. Release owns the separate canary, guard and pause decisions. Rollback is a revert of this patch. ## Product invariants affected - INV-MEM-4. Intake routing stays upstream of memory-promotion authority. ## How it was verified The focused M1 tests exercise the recreated predecessor priority parser, route matrix (saturation, health, cohort, floor and kill switch) and the real admission transaction with a synthetic store. The latter checks the GPU ring, provider outbox and deferred eligibility fields. Existing pump and worker controls are outside this patch. ## UI evidence UI-Evidence: none -- backend mitigation ## Failure class (fixes) Failure-Class: none Line-Count-Exception: backend/routers/sync.py | 4462 -> 4463 | Select the predecessor route only at the backend-sync upload authority. Line-Count-Exception: backend/utils/batch_pipeline/intake.py | 1617 -> 1649 | Keep route selection and deferred-stamp policy together in a small helper outside the existing admission transaction. <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/26866?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/26866?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F26866&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. -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
One overflow rule for every recording, with a fleet-wide in-flight limit per vendor, and a Modulate latency breaker that allows for audio length (SCA-5986; David, 2026-11-30).
The 25→100
batch-vendor-routingramp tripped at 20:01Z on 11-30 (SCA-5183):rate_limitedand 71error_5xxin 100 min.vendor_heldrose to about 470.What changes
overflow_languageand a writer-owned due clock,overflow_due_at = enqueued_at + ENTER_SECONDS.BATCH_VENDOR_OVERFLOW_PRIORITIESis retired, and the prod overlay drops it.utils/batch_pipeline/overflow_pump.py) moves stamped units that have waited at leastBATCH_VENDOR_OVERFLOW_ENTER_SECONDS(1200 s) to a vendor, oldest first and whatever their priority, only into a free vendor slot.ready, admissible,unattempted(no GPU allowance reserved), past the threshold, and inside the cohort at the current percent._prefer_merge_headdoes.state == ready,compute_decision.outcome == unattempted,overflow_due_at <= now, ordered byoverflow_due_at, at most 100 rows. Only stamped units carry the field, so a backlog of units that can never move (legacy on, a GPU-only language, units admitted before this build) can't fill the scan and hide a movable unit behind it.enrichment-maintenancesweep, which acts as the bootstrap.max_in_flightinBATCH_VENDOR_HEALTH_THRESHOLDS.provider_pendingand looks again after 5–10 s. It is never held or failed for lack of a slot.latency_degraded_s + latency_degraded_per_audio_min_s × audio minutes(defaults 30 s + 15 s per minute; open at 120 s + 60 s per minute).omi_batch_pipeline_vendor_in_flightand_in_flight_limit{provider};omi_batch_pipeline_vendor_overflow_diverted_total{provider,priority};omi_batch_pipeline_vendor_slot_waits_total{provider}.Firestore index
This adds one composite per stage namespace:
batch_pipeline_{prod,dev}_jobson (state, compute_decision.outcome, overflow_due_at, name).database/batch_pipeline_indexes.py, andfirestore.indexes.jsonis regenerated.overflow_due_atjoins the census due-clock fields. Units with a due stamp leave the query when they move or leaveready.Tuning
New knobs, so there are no before numbers:
Product invariants affected
backend/deploy/runtime_env.yamlis regenerated. The only change there dropsBATCH_VENDOR_OVERFLOW_PRIORITIES. No memory intake, consolidation or promotion path changes.Line-count exceptions
Line-Count-Exception: backend/database/batch_pipeline_store.py | 1486 -> 1511 | the pump's one store read sits beside its siblings oldest_admissible_ready and ready_for_capacity, which the parity census and query-driver registry key by module
Line-Count-Exception: backend/utils/batch_pipeline/provider_stt.py | 1460 -> 1528 | slot take, renew and release must sit at the provider stage's mint, settle and hold points
Line-Count-Exception: backend/utils/batch_pipeline/scheduler.py | 1492 -> 1529 | unlink_ready_in_transaction edits the owner FIFO and ring invariants this module owns, next to the lease path it mirrors
Evidence (ro-prod, read-only, 11-30)
DESIGN
SCA-5986 first comment covers:
Rollout and rollback
BATCH_VENDOR_OVERFLOW_ENABLED=falsekeeps every capable unit on the GPU.max_in_flightinBATCH_VENDOR_HEALTH_THRESHOLDS.fresh,recentwould then need re-adding to the overlay.Tests
tests/unit/test_batch_vendor_overflow_pump.py(new): moves, unlinking, slots on MemoryStore and fakeredis Lua, slot waits in the stage, and the length-aware breaker. It includes a starvation regression: 120 older unstamped units must not hide a stamped one.tests/unit/test_batch_vendor_outage_drills.py: the GPU-outage drill now runs the real pump over the real store, GPU ring and provider stage. In 30 min with no GPU, 90 units moved, oldest first, each 600–609 s after admission, and Modulate never held more than its 4 drill slots. All 630 units committed.tests/unit/test_batch_vendor_overflow.py,tests/unit/test_batch_vendor_route_table_prod.py,tests/unit/test_jobstore_protocol_parity.py, and the census and Firestore query-shape registries (tests/unit/test_batch_census_registry.py, query drivers).Failure class (fixes)
Failure-Class: new
🤖 Generated with Claude Code