Repository navigation
mitigate(sync): restore predecessor intake overflow on backend-sync (SCA-5315) - #26866
Conversation
Codex Review Summary: ✅ CompletedThis 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. |
There was a problem hiding this comment.
7 issues found across 12 files
Confidence score: 3/5
- Re-enabling
BATCH_VENDOR_OVERFLOW_PRIORITIESin the runtime and production config could restore the admission-time FRESH/RECENT overflow that was retired after vendor slowdown and Soniox 429s. Keep the setting retired unless that behavior has been deliberately re-approved. - The
select_routeand module docstrings inroute_selection.pystill say admission never reacts to GPU saturation, which conflicts with the documented backend-sync exception. Update both docstrings to describe the exception. - The docstring in
batch_pipeline_vendor_overflow.pyimplies overflow priorities apply to the deferred pump, but they only gate backend-sync admission overflow. Clarify that scope. - The test imports
artifact_idthrough a re-export intest_batch_vendor_overflow.py, contrary to the backend import guidance. Import it fromdatabase.batch_pipeline_stagingand move the import to the module import block.
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/utils/batch_pipeline/vendor_route_contracts.py">
<violation number="1" location="backend/utils/batch_pipeline/vendor_route_contracts.py:596">
P2: This re-registers `BATCH_VENDOR_OVERFLOW_PRIORITIES`, which the repo documents as retired by SCA-5986 and no longer read. The mdx contract, the 11-30 change note, and the `select_route` docstring still say admission never overflows. Either update those contract docs and the retirement notes in this PR, or drop this registry entry and the admission-time reader if the retirement still stands.</violation>
</file>
<file name="backend/config/batch_pipeline_vendor_overflow.py">
<violation number="1" location="backend/config/batch_pipeline_vendor_overflow.py:35">
P3: This docstring overstates the scope. `overflow_priorities()` only gates backend-sync admission overflow; the deferred pump moves units of any priority. Name the admission scope in the docstring.</violation>
</file>
<file name="backend/tests/unit/test_batch_vendor_overflow.py">
<violation number="1" location="backend/tests/unit/test_batch_vendor_overflow.py:236">
P3: Move this import to the module import block. Import `artifact_id` from its defining module, `database.batch_pipeline_staging`, rather than the re-export in `batch_pipeline_intake`. AGENTS.md requires backend imports at module top level.</violation>
</file>
<file name="backend/deploy/runtime_env.yaml">
<violation number="1" location="backend/deploy/runtime_env.yaml:4975">
P1: This re-adds `BATCH_VENDOR_OVERFLOW_PRIORITIES=fresh,recent`, which the SCA-5986 change retired after admission-time RECENT overflow tripped the Modulate breaker. The retirement doc and the `listen_pusher_pipeline.mdx` contract both say this key is no longer read. Confirm the SCA-5986 rule still allows admission-time RECENT overflow for backend-sync, or drop this entry and keep the retired contract.</violation>
</file>
<file name="backend/deploy/runtime_env/prod.overlay.yaml">
<violation number="1" location="backend/deploy/runtime_env/prod.overlay.yaml:1184">
P1: This re-enables `BATCH_VENDOR_OVERFLOW_PRIORITIES`, which the 2026-11-30 one-rule ruling (SCA-5986) retired because admission-time FRESH and RECENT overflow caused the vendor slowdown and Soniox 429s. The retirement doc, the `listen_pusher_pipeline.mdx` section, and the feature-flag registry still say production drops this key. Either update those docs and the ruling reference in the PR description, or drop this line and keep the one-rule behavior.</violation>
</file>
<file name="config/feature-flags.yaml">
<violation number="1" location="config/feature-flags.yaml:159">
P2: This entry revives BATCH_VENDOR_OVERFLOW_PRIORITIES, which the contract doc and change note both mark as retired and no longer read. Update listen_pusher_pipeline.mdx and the 2026-11-30 change note in this PR, or they will describe the opposite of the registry and code.</violation>
</file>
<file name="backend/utils/batch_pipeline/route_selection.py">
<violation number="1" location="backend/utils/batch_pipeline/route_selection.py:265">
P3: The added sentence documents the backend-sync exception, but the docstrings directly above it still say admission never reacts to GPU saturation. Update the `select_route` and module docstrings to state that overflow at admission applies only when `immediate_gpu_overflow` is passed.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
| category: ops_kill | ||
| BATCH_VENDOR_ROUTE_TABLE: {value: '{"schema_version":1,"table_version":"soniox-unsupported-1127","selection":"ordered","gpu_floor_percent":0.0,"routes":{"gpu":{"price_usd_per_audio_hour":null,"daily_audio_hours_cap":null,"monthly_budget_usd":null,"failover_only":false,"speaker_turns":"discard"},"modulate":{"price_usd_per_audio_hour":0.06,"daily_audio_hours_cap":5000.0,"monthly_budget_usd":null,"failover_only":false,"speaker_turns":"discard"},"soniox":{"price_usd_per_audio_hour":0.12,"daily_audio_hours_cap":null,"monthly_budget_usd":null,"failover_only":false,"speaker_turns":"discard"}},"rows":[{"language_class":"en","options":[{"route":"gpu","quality_tier":"accepted","quality_source":"legacy_parity"},{"route":"modulate","quality_tier":"accepted","quality_source":"legacy_parity"},{"route":"soniox","quality_tier":"accepted","quality_source":"staging_drill"}]},{"language_class":"gpu_supported","options":[{"route":"gpu","quality_tier":"accepted","quality_source":"legacy_parity"}]},{"language_class":"gpu_unsupported","options":[{"route":"soniox","quality_tier":"accepted","quality_source":"public_eval_1127"},{"route":"modulate","quality_tier":"accepted","quality_source":"legacy_parity"}]},{"language_class":"*","options":[{"route":"gpu","quality_tier":"accepted","quality_source":"legacy_parity"}]}]}', | ||
| category: rollout} | ||
| BATCH_VENDOR_OVERFLOW_PRIORITIES: |
There was a problem hiding this comment.
P1: This re-adds BATCH_VENDOR_OVERFLOW_PRIORITIES=fresh,recent, which the SCA-5986 change retired after admission-time RECENT overflow tripped the Modulate breaker. The retirement doc and the listen_pusher_pipeline.mdx contract both say this key is no longer read. Confirm the SCA-5986 rule still allows admission-time RECENT overflow for backend-sync, or drop this entry and keep the retired contract.
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/deploy/runtime_env.yaml, line 4975:
<comment>This re-adds `BATCH_VENDOR_OVERFLOW_PRIORITIES=fresh,recent`, which the SCA-5986 change retired after admission-time RECENT overflow tripped the Modulate breaker. The retirement doc and the `listen_pusher_pipeline.mdx` contract both say this key is no longer read. Confirm the SCA-5986 rule still allows admission-time RECENT overflow for backend-sync, or drop this entry and keep the retired contract.</comment>
<file context>
@@ -4972,6 +4972,9 @@ environments:
category: ops_kill
BATCH_VENDOR_ROUTE_TABLE: {value: '{"schema_version":1,"table_version":"soniox-unsupported-1127","selection":"ordered","gpu_floor_percent":0.0,"routes":{"gpu":{"price_usd_per_audio_hour":null,"daily_audio_hours_cap":null,"monthly_budget_usd":null,"failover_only":false,"speaker_turns":"discard"},"modulate":{"price_usd_per_audio_hour":0.06,"daily_audio_hours_cap":5000.0,"monthly_budget_usd":null,"failover_only":false,"speaker_turns":"discard"},"soniox":{"price_usd_per_audio_hour":0.12,"daily_audio_hours_cap":null,"monthly_budget_usd":null,"failover_only":false,"speaker_turns":"discard"}},"rows":[{"language_class":"en","options":[{"route":"gpu","quality_tier":"accepted","quality_source":"legacy_parity"},{"route":"modulate","quality_tier":"accepted","quality_source":"legacy_parity"},{"route":"soniox","quality_tier":"accepted","quality_source":"staging_drill"}]},{"language_class":"gpu_supported","options":[{"route":"gpu","quality_tier":"accepted","quality_source":"legacy_parity"}]},{"language_class":"gpu_unsupported","options":[{"route":"soniox","quality_tier":"accepted","quality_source":"public_eval_1127"},{"route":"modulate","quality_tier":"accepted","quality_source":"legacy_parity"}]},{"language_class":"*","options":[{"route":"gpu","quality_tier":"accepted","quality_source":"legacy_parity"}]}]}',
category: rollout}
+ BATCH_VENDOR_OVERFLOW_PRIORITIES:
+ value: fresh,recent
+ category: config
</file context>
| # RECENT English also overflows while its own GPU backlog is past the SLO (David 2026-11-16, | ||
| # L4 stockout: ~35k RECENT ready, FRESH ~4). Modulate cap 3000 -> 5000 audio-h/day in the same | ||
| # ruling. Rollback: 'fresh' (today's FRESH-only overflow). | ||
| BATCH_VENDOR_OVERFLOW_PRIORITIES: {value: 'fresh,recent', category: config} |
There was a problem hiding this comment.
P1: This re-enables BATCH_VENDOR_OVERFLOW_PRIORITIES, which the 2026-11-30 one-rule ruling (SCA-5986) retired because admission-time FRESH and RECENT overflow caused the vendor slowdown and Soniox 429s. The retirement doc, the listen_pusher_pipeline.mdx section, and the feature-flag registry still say production drops this key. Either update those docs and the ruling reference in the PR description, or drop this line and keep the one-rule behavior.
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/deploy/runtime_env/prod.overlay.yaml, line 1184:
<comment>This re-enables `BATCH_VENDOR_OVERFLOW_PRIORITIES`, which the 2026-11-30 one-rule ruling (SCA-5986) retired because admission-time FRESH and RECENT overflow caused the vendor slowdown and Soniox 429s. The retirement doc, the `listen_pusher_pipeline.mdx` section, and the feature-flag registry still say production drops this key. Either update those docs and the ruling reference in the PR description, or drop this line and keep the one-rule behavior.</comment>
<file context>
@@ -1181,6 +1181,7 @@ overlay:
# RECENT English also overflows while its own GPU backlog is past the SLO (David 2026-11-16,
# L4 stockout: ~35k RECENT ready, FRESH ~4). Modulate cap 3000 -> 5000 audio-h/day in the same
# ruling. Rollback: 'fresh' (today's FRESH-only overflow).
+ BATCH_VENDOR_OVERFLOW_PRIORITIES: {value: 'fresh,recent', category: config}
# Allowance-exhausted batch units park 2 h between admission re-checks instead of 30 min
# (David 065da8, 2026-11-04; interim pending the upgrade-latency ruling). Authorize-compute
</file context>
| 'BATCH_VENDOR_ROUTING_SHADOW_PERCENT': ('B', 'decisions computed and counted, routing unchanged; default 0'), | ||
| 'BATCH_VENDOR_ROUTE_TABLE': ('B', 'runtime RouteTable payload; unset serves BUILTIN_TABLE'), | ||
| 'BATCH_VENDOR_OVERFLOW_ENABLED': ('B', 'ops_kill, on unless false; false never moves a capable unit off GPU'), | ||
| 'BATCH_VENDOR_OVERFLOW_PRIORITIES': ( |
There was a problem hiding this comment.
P2: This re-registers BATCH_VENDOR_OVERFLOW_PRIORITIES, which the repo documents as retired by SCA-5986 and no longer read. The mdx contract, the 11-30 change note, and the select_route docstring still say admission never overflows. Either update those contract docs and the retirement notes in this PR, or drop this registry entry and the admission-time reader if the retirement still stands.
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/vendor_route_contracts.py, line 596:
<comment>This re-registers `BATCH_VENDOR_OVERFLOW_PRIORITIES`, which the repo documents as retired by SCA-5986 and no longer read. The mdx contract, the 11-30 change note, and the `select_route` docstring still say admission never overflows. Either update those contract docs and the retirement notes in this PR, or drop this registry entry and the admission-time reader if the retirement still stands.</comment>
<file context>
@@ -593,6 +593,10 @@ def is_vendor_policy_hold(
'BATCH_VENDOR_ROUTING_SHADOW_PERCENT': ('B', 'decisions computed and counted, routing unchanged; default 0'),
'BATCH_VENDOR_ROUTE_TABLE': ('B', 'runtime RouteTable payload; unset serves BUILTIN_TABLE'),
'BATCH_VENDOR_OVERFLOW_ENABLED': ('B', 'ops_kill, on unless false; false never moves a capable unit off GPU'),
+ 'BATCH_VENDOR_OVERFLOW_PRIORITIES': (
+ 'B',
+ 'backend-sync immediate overflow priorities fresh|recent|deep; default fresh, always included',
</file context>
| - {"key":"BATCH_VENDOR_ROUTE_TABLE","aliases":[],"kind":"env","lifecycle":"config_switch","surfaces":["backend"],"summary":"JSON route table (vendor_route_contracts.RouteTable schema 1): per-route prices, caps, failover-only flags, GPU floor percent and per-language-class rows; unset serves today's routing","fail":"closed","owner":"two-lane lead","created":"2026-11-01","terminal":"keep","decision":"keep","notes":"Validated per payload; an invalid payload serves the last valid table in that process, else the builtin table (today's routing). Prices, caps, floor share and quality rows are values here, never code constants. Capability stays code-owned in config/stt_provider_policy.py, so a table can never route to a vendor policy does not admit. Rejections log fixed text only."} | ||
| - {"key":"BATCH_VENDOR_OVERFLOW_ENABLED","aliases":[],"kind":"env","lifecycle":"ops_kill","surfaces":["backend"],"summary":"Default on; inside the vendor-routing cohort, a GPU unit stamped at admission that has waited for the GPU past BATCH_VENDOR_OVERFLOW_ENTER_SECONDS moves to a vendor, oldest first and whatever its priority, only into a free fleet-wide vendor in-flight slot (max_in_flight in BATCH_VENDOR_HEALTH_THRESHOLDS). false keeps every capable unit on GPU","fail":"open","owner":"two-lane lead","created":"2026-11-01","terminal":"keep","decision":"keep","notes":"utils/batch_pipeline/overflow_pump.py (SCA-5986, David 11-30: one rule for every recording; replaces admission-time per-priority overflow and BATCH_VENDOR_OVERFLOW_PRIORITIES). Dormant with no configured route table or a zero routing percent. The GPU floor share and units admitted before the stamp never move. Counter omi_batch_pipeline_vendor_overflow_diverted_total{provider,priority}; gauges omi_batch_pipeline_vendor_in_flight and _in_flight_limit."} | ||
| - {"key":"BATCH_VENDOR_OVERFLOW_ENABLED","aliases":[],"kind":"env","lifecycle":"ops_kill","surfaces":["backend"],"summary":"Default on; backend-sync upload can overflow immediately at its predecessor priority gate. On the deferred path, inside the vendor-routing cohort, a GPU unit stamped at admission that has waited for the GPU past BATCH_VENDOR_OVERFLOW_ENTER_SECONDS moves to a vendor, oldest first and whatever its priority, only into a free fleet-wide vendor in-flight slot (max_in_flight in BATCH_VENDOR_HEALTH_THRESHOLDS). false keeps every capable unit on GPU","fail":"open","owner":"two-lane lead","created":"2026-11-01","terminal":"keep","decision":"keep","notes":"utils/batch_pipeline/overflow_pump.py (SCA-5986, David 11-30: one rule for every recording; the deferred path retains its slot and pump controls). Dormant with no configured route table or a zero routing percent. The GPU floor share and units admitted before the stamp never move. Counter omi_batch_pipeline_vendor_overflow_diverted_total{provider,priority}; gauges omi_batch_pipeline_vendor_in_flight and _in_flight_limit."} | ||
| - {"key":"BATCH_VENDOR_OVERFLOW_PRIORITIES","aliases":[],"kind":"env","lifecycle":"config_switch","surfaces":["backend"],"summary":"Default fresh; comma-separated fresh|recent|deep priorities eligible for vendor overflow when that priority is saturated; FRESH is always included; unset, empty or malformed lists keep fresh only","fail":"closed","owner":"two-lane lead","created":"2026-11-17","terminal":"keep","decision":"keep","notes":"config/batch_pipeline_vendor_overflow.py; read per admission. fresh,recent explicitly enables RECENT vendor overflow inside the routing cohort with legacy draining or dark. The legacy-sync capacity fallback remains FRESH-only. BATCH_VENDOR_OVERFLOW_ENABLED remains the kill switch. David approved prod enablement 2026-11-16 (L4 stockout): the Sync recovery overlay restores fresh,recent on backend-sync only; rollback fresh."} |
There was a problem hiding this comment.
P2: This entry revives BATCH_VENDOR_OVERFLOW_PRIORITIES, which the contract doc and change note both mark as retired and no longer read. Update listen_pusher_pipeline.mdx and the 2026-11-30 change note in this PR, or they will describe the opposite of the registry and code.
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 config/feature-flags.yaml, line 159:
<comment>This entry revives BATCH_VENDOR_OVERFLOW_PRIORITIES, which the contract doc and change note both mark as retired and no longer read. Update listen_pusher_pipeline.mdx and the 2026-11-30 change note in this PR, or they will describe the opposite of the registry and code.</comment>
<file context>
@@ -155,7 +155,8 @@ flags:
- {"key":"BATCH_VENDOR_ROUTE_TABLE","aliases":[],"kind":"env","lifecycle":"config_switch","surfaces":["backend"],"summary":"JSON route table (vendor_route_contracts.RouteTable schema 1): per-route prices, caps, failover-only flags, GPU floor percent and per-language-class rows; unset serves today's routing","fail":"closed","owner":"two-lane lead","created":"2026-11-01","terminal":"keep","decision":"keep","notes":"Validated per payload; an invalid payload serves the last valid table in that process, else the builtin table (today's routing). Prices, caps, floor share and quality rows are values here, never code constants. Capability stays code-owned in config/stt_provider_policy.py, so a table can never route to a vendor policy does not admit. Rejections log fixed text only."}
- - {"key":"BATCH_VENDOR_OVERFLOW_ENABLED","aliases":[],"kind":"env","lifecycle":"ops_kill","surfaces":["backend"],"summary":"Default on; inside the vendor-routing cohort, a GPU unit stamped at admission that has waited for the GPU past BATCH_VENDOR_OVERFLOW_ENTER_SECONDS moves to a vendor, oldest first and whatever its priority, only into a free fleet-wide vendor in-flight slot (max_in_flight in BATCH_VENDOR_HEALTH_THRESHOLDS). false keeps every capable unit on GPU","fail":"open","owner":"two-lane lead","created":"2026-11-01","terminal":"keep","decision":"keep","notes":"utils/batch_pipeline/overflow_pump.py (SCA-5986, David 11-30: one rule for every recording; replaces admission-time per-priority overflow and BATCH_VENDOR_OVERFLOW_PRIORITIES). Dormant with no configured route table or a zero routing percent. The GPU floor share and units admitted before the stamp never move. Counter omi_batch_pipeline_vendor_overflow_diverted_total{provider,priority}; gauges omi_batch_pipeline_vendor_in_flight and _in_flight_limit."}
+ - {"key":"BATCH_VENDOR_OVERFLOW_ENABLED","aliases":[],"kind":"env","lifecycle":"ops_kill","surfaces":["backend"],"summary":"Default on; backend-sync upload can overflow immediately at its predecessor priority gate. On the deferred path, inside the vendor-routing cohort, a GPU unit stamped at admission that has waited for the GPU past BATCH_VENDOR_OVERFLOW_ENTER_SECONDS moves to a vendor, oldest first and whatever its priority, only into a free fleet-wide vendor in-flight slot (max_in_flight in BATCH_VENDOR_HEALTH_THRESHOLDS). false keeps every capable unit on GPU","fail":"open","owner":"two-lane lead","created":"2026-11-01","terminal":"keep","decision":"keep","notes":"utils/batch_pipeline/overflow_pump.py (SCA-5986, David 11-30: one rule for every recording; the deferred path retains its slot and pump controls). Dormant with no configured route table or a zero routing percent. The GPU floor share and units admitted before the stamp never move. Counter omi_batch_pipeline_vendor_overflow_diverted_total{provider,priority}; gauges omi_batch_pipeline_vendor_in_flight and _in_flight_limit."}
+ - {"key":"BATCH_VENDOR_OVERFLOW_PRIORITIES","aliases":[],"kind":"env","lifecycle":"config_switch","surfaces":["backend"],"summary":"Default fresh; comma-separated fresh|recent|deep priorities eligible for vendor overflow when that priority is saturated; FRESH is always included; unset, empty or malformed lists keep fresh only","fail":"closed","owner":"two-lane lead","created":"2026-11-17","terminal":"keep","decision":"keep","notes":"config/batch_pipeline_vendor_overflow.py; read per admission. fresh,recent explicitly enables RECENT vendor overflow inside the routing cohort with legacy draining or dark. The legacy-sync capacity fallback remains FRESH-only. BATCH_VENDOR_OVERFLOW_ENABLED remains the kill switch. David approved prod enablement 2026-11-16 (L4 stockout): the Sync recovery overlay restores fresh,recent on backend-sync only; rollback fresh."}
- {"key":"BATCH_VENDOR_OVERFLOW_ENTER_SECONDS","aliases":[],"kind":"env","lifecycle":"config_switch","surfaces":["backend"],"summary":"Default 1200; seconds a unit waits for the GPU before the overflow pump may move it to a free vendor slot (any priority), and the FRESH backlog age at which the legacy capacity fallback reads saturated (it stops below half of this) (60-21600, else default)","fail":"closed","owner":"two-lane lead","created":"2026-11-01","terminal":"keep","decision":"keep","notes":"The transcript-delay SLO for the GPU ring (batchdesign 2026-11-01 section 5); exit at half is the hysteresis so saturation does not flap each 30 s sample. config/batch_pipeline_vendor_overflow.py."}
- {"key":"BATCH_VENDOR_OVERFLOW_MIN_READY_UNITS","aliases":[],"kind":"env","lifecycle":"config_switch","surfaces":["backend"],"summary":"Default 300; admissible FRESH units that must be waiting in the GPU ring before an old head counts as saturation for the legacy capacity fallback; saturation ends below half of it (1-100000, else default)","fail":"closed","owner":"two-lane lead","created":"2026-11-01","terminal":"keep","decision":"keep","notes":"Keeps stuck heads from reading as backlog: 2026-11-01 18:01Z the ring held 111 admissible fresh units 42 h old (4 parked owners) while idle. Same count as omi_batch_pipeline_admissible_ready_units. config/batch_pipeline_vendor_overflow.py."}
</file context>
|
|
||
|
|
||
| def overflow_priorities() -> frozenset[int]: | ||
| """Priorities eligible for vendor overflow; malformed lists keep FRESH only. |
There was a problem hiding this comment.
P3: This docstring overstates the scope. overflow_priorities() only gates backend-sync admission overflow; the deferred pump moves units of any priority. Name the admission scope in the docstring.
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_vendor_overflow.py, line 35:
<comment>This docstring overstates the scope. `overflow_priorities()` only gates backend-sync admission overflow; the deferred pump moves units of any priority. Name the admission scope in the docstring.</comment>
<file context>
@@ -23,13 +24,27 @@
+def overflow_priorities() -> frozenset[int]:
+ """Priorities eligible for vendor overflow; malformed lists keep FRESH only.
+
+ FRESH is always included. Read at admission so expanding beyond FRESH requires an explicit config.
</file context>
| """Priorities eligible for vendor overflow; malformed lists keep FRESH only. | |
| """Priorities eligible for admission-time Sync overflow; malformed lists keep FRESH only. |
|
|
||
| def admit_staged_audio(store, items, *args, **kwargs): | ||
| # The fixture stages synthetic bytes, so provide the reservation that its fake stager omits. | ||
| from database.batch_pipeline_intake import artifact_id |
There was a problem hiding this comment.
P3: Move this import to the module import block. Import artifact_id from its defining module, database.batch_pipeline_staging, rather than the re-export in batch_pipeline_intake. AGENTS.md requires backend imports at module 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_vendor_overflow.py, line 236:
<comment>Move this import to the module import block. Import `artifact_id` from its defining module, `database.batch_pipeline_staging`, rather than the re-export in `batch_pipeline_intake`. AGENTS.md requires backend imports at module top level.</comment>
<file context>
@@ -149,6 +154,130 @@ def test_cohort_is_rechecked_at_the_current_percent(monkeypatch):
+
+ def admit_staged_audio(store, items, *args, **kwargs):
+ # The fixture stages synthetic bytes, so provide the reservation that its fake stager omits.
+ from database.batch_pipeline_intake import artifact_id
+
+ for item in items:
</file context>
| exists once legacy is draining or dark (intake), so those owners keep today's routing. | ||
| ``gpu_saturated`` is retired (SCA-5986: overflow is the pump's, never admission's); it is | ||
| accepted and ignored so pinned older intake callers (sync parity tests) still route. | ||
| The backend-sync upload passes its predecessor sampler explicitly as ``immediate_gpu_overflow``. |
There was a problem hiding this comment.
P3: The added sentence documents the backend-sync exception, but the docstrings directly above it still say admission never reacts to GPU saturation. Update the select_route and module docstrings to state that overflow at admission applies only when immediate_gpu_overflow is passed.
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/route_selection.py, line 265:
<comment>The added sentence documents the backend-sync exception, but the docstrings directly above it still say admission never reacts to GPU saturation. Update the `select_route` and module docstrings to state that overflow at admission applies only when `immediate_gpu_overflow` is passed.</comment>
<file context>
@@ -235,13 +254,15 @@ def select_route(
exists once legacy is draining or dark (intake), so those owners keep today's routing.
``gpu_saturated`` is retired (SCA-5986: overflow is the pump's, never admission's); it is
accepted and ignored so pinned older intake callers (sync parity tests) still route.
+ The backend-sync upload passes its predecessor sampler explicitly as ``immediate_gpu_overflow``.
"""
del gpu_saturated
</file context>
| The backend-sync upload passes its predecessor sampler explicitly as ``immediate_gpu_overflow``. | |
| The backend-sync upload passes its predecessor sampler explicitly as ``immediate_gpu_overflow``; only that caller | |
| may divert GPU-selected units to a vendor at admission. Otherwise overflow stays the pump's. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c9ffc57265
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| store, dispatches = MemoryStore(), [] | ||
| store.namespace = 'batch_pipeline_dev' |
There was a problem hiding this comment.
Exercise admission with a constraint-enforcing Firestore fake
The new enqueue-boundary test uses MemoryStore, whose transaction simply mutates a dictionary, and replaces the provider outbox with an append-only callback. Consequently, it cannot catch Firestore read/write ordering violations or verify that the provider job and durable dispatch actually commit together—the production boundary this test is intended to protect. backend/AGENTS.md requires constraint-enforcing transaction fakes at this boundary. Exercise the real store adapter and transactional outbox against StrictFirestore, or use the emulator if the required operations exceed that fixture's supported surface.
AGENTS.md reference: backend/AGENTS.md:L235-L235
Useful? React with 👍 / 👎.
| if vendors and immediate_gpu_overflow(): | ||
| selected, reason = _primary(table, capable, vendors)[0], VendorRouteReason.GPU_OVERFLOW |
There was a problem hiding this comment.
Record immediate overflow in shared fallback telemetry
When a saturated backend-sync upload switches from GPU to a vendor here, the new path records only the vendor-route decision metric; neither this selector nor its intake caller invokes record_fallback for the diversion. This leaves admission-time capacity recovery absent from the shared omi_fallback_total telemetry, despite changing providers. Emit the shared fallback event for the served overflow decision, outside shadow-only evaluation, as required for new fallbacks by backend/AGENTS.md.
AGENTS.md reference: backend/AGENTS.md:L326-L326
Useful? React with 👍 / 👎.
Co-authored-by: multica-agent <[email protected]>
Co-authored-by: multica-agent <[email protected]>
One conflict with #26866 (predecessor intake overflow on backend-sync), in the imports of utils/batch_pipeline/intake.py: both sides' names are imported. The overflow choice applies to the FRESH sync lane and the fresh-class promotion to the backfill lane, so the two do not meet. Failure-Class: none
What changed and why
Restore the serving predecessor's admission-time GPU overflow at the
backend-syncupload call for SCA-5315. The original parser includes FRESH and reads the predecessor'sfresh,recentproduction 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
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.