Skip to content

Revert seal repair workers to 16 (gate missed) - #24966

Merged
Git-on-my-level merged 1 commit into
mainfrom
revert/seal-repair-workers-16
Nov 9, 2026
Merged

Git-on-my-level merged 1 commit into
mainfrom
revert/seal-repair-workers-16

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Change

Revert production recordSealRepair.workers from 24 to 16 and restore the rendered-chart test pin. Repair workers decrease from 24 to 16. This reverses #24962 (merge 8703d57009d3928af99af9297644a5f6630738ff) and adds the requested failed-gate comment. Later changes, including age-order discovery, remain intact.

Lead2 ruling f1ffa1 (2026-11-08 18:37Z), recorded in #24962, authorized this values-only experiment with any gate miss -> revert to 16. The first three runs after the 2026-11-09 02:30Z combined roll missed the throughput gate; run 1 also missed the budget gate.

Gate evidence

Source: omi-workspace:data/run-2026-11-08-retro-fixnow/out-seal-gate.md, aggregate Cloud Logging summary events read through ro-prod 2026-11-09 ~04:30Z. These are existing recorded measurements; this PR author did not access production.

run end (UTC) job sealed budget_exhausted deferred mean s/sealed oldest_unsealed_h
01:26 (before) 29903100 186 16 817 120.7 50.9
01:56 (before) 29903130 187 19 813 115.4 64.1
02:26 (before) 29903160 176 20 822 120.2 51.6
02:56 (after) 29903190 126 41 847 210.9 498386.5 (corrupt)
03:26 (after) 29903220 170 28 810 177.0 498386.5 (corrupt)
03:56 (after) 29903250 167 30 813 178.6 498386.5 (corrupt)
04:26 (after, 4th) 29903280 168 29 811 173.3 498386.5 (corrupt)
  • sealed/run >=190: failed all first three runs (126, 170, 167).
  • budget_exhausted <=40/run: failed run 1 (41).
  • sealed-row p50 <200 s: not established by these summaries. The displayed row-time statistic is a mean, calculated as disposition_elapsed_ms.sealed / sealed; 210.9 s on run 1 is not a p50 measurement.
  • Firestore reads/attempted row 6–8: not measured in this gate record.

The row-time rise (~118 s to ~178 s in the source's summary) is consistent with contention, but the combined workers + age-order roll does not isolate causation. The ~178 s shorthand describes runs 2–3, rather than an average of all first three runs. The corrupt oldest-age gauge cannot establish a backlog trend. The independently measured throughput and budget misses trigger the revert without relying on the p50 proxy.

Rollback

Rollback of this revert: re-apply #24962 (restore workers=24 and its chart test pin). This task opens the PR only; no merge or production deployment is authorized here.

Validation

Offline chart/values validation on fb0e0b3b7d5327d1be2a8c1d0b2c809e8b348d62, observed by 2026-11-09T04:35:17Z:

/Users/dazheng/workspace/omi/bin/omi-heavy run -- backend/.venv/bin/python -m pytest backend/tests/unit/test_record_seal_cluster_repair_deploy.py backend/tests/unit/test_record_seal_sweeper_deploy.py backend/tests/unit/test_record_seal_worker_deploy.py backend/tests/unit/test_batch_pipeline_chart.py -q

122 passed in 66.55 s. git diff origin/main HEAD --check passed. Credentials were unset for validation. scripts/pr-preflight --pr-body-file <body> passed all 38 checks (427.97 s); OMI_PR_BODY_FILE=<body> make preflight passed all 38 checks (346.68 s). Both ran through omi-heavy, verified by 2026-11-09T04:45:37Z. Tests establish rendered configuration, not production performance.

Product invariants affected

none

Failure-Class: none

Capacity failure addressed: worker increase raised per-row contention (inferred mechanism; combined rollout prevents isolated attribution). This values-only rollback does not add a registry definition or claim class-wide prevention.

View guided diff Turn on auto-fix

This reverts commit 8703d57, reversing changes made to 42448d3.

Failure-Class: capacity: worker increase raised per-row contention
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T05:08:15.082239Z fb0e0b3 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Git-on-my-level
Git-on-my-level merged commit fd1d5bb into main Nov 9, 2026
64 checks passed
@Git-on-my-level
Git-on-my-level deleted the revert/seal-repair-workers-16 branch November 9, 2026 05:19
Git-on-my-level added a commit that referenced this pull request Nov 11, 2026
…#25049)

# seal-speed: cut the per-row startup bill and give the repair pod real
CPU

## Why

A recording seal takes ~89 s per row (p50) and the seal itself is ~5 s
of it.
Measured 2026-11-10 on `origin/main` = `9c051da5be4b` (evidence:

`omi-workspace/data/run-2026-11-08-pipeline-refactor/findings-fable-seal-time.md`):

| stage | p50 | share |
| --- | ---: | ---: |
| `startup` (fork/exec + module imports) | 45.1 s | 51% |
| `clients` (lazy imports + Firestore/GCS construction) | 32.7 s | 37% |
| `proof` + `list` + `walk` + `apply` (the actual seal) | 5.3 s | 6% |

Two compounding causes, both fixed here:

1. **The row process imports the web framework.**
`record_seal_cluster_repair`
reaches `utils.observability.fallback` -> `utils.metrics` -> `from
fastapi
import Response`, and `database.batch_pipeline_store` ->
`utils.sync.stage`
-> `from fastapi import HTTPException`. fastapi/pydantic is ~60% of the
   import bill. A recording seal does no HTTP work.
2. **The pod is CPU-starved.** The CronJob's `nodeAffinity` deliberately
excluded `batch-pipeline-pool`, so repair landed on the monitoring pool
at
101% CPU and received ~2 of its 4-core limit. The batch-pipeline pool
sits at
   8-19% CPU. The image also shipped no `.pyc` and the CronJob set
`PYTHONDONTWRITEBYTECODE=1`, so every one of ~250 row processes per run
   re-parsed source.

**No worker-count change.** 16 -> 24 was already measured in prod and
lost
15-35% of seals per run (#24962, reverted by #24966); 48 was worse
(#24729).
More workers only split the same starved CPU.

## What changed

**1. Placement and CPU request (chart only).**

`backend/charts/batch-pipeline-worker/templates/record-seal-repair.yaml`
now
pins the repair pod to `batch-pipeline-pool` and carries that pool's two
taints
(`omi.ai/batch-pipeline=true`, `nvidia.com/gpu=present`). CPU request 2
-> 4,
which equals the unchanged CPU limit. Memory remains request 4 GiB /
limit
8 GiB, so the pod stays Burstable; the scheduler now reserves four CPU
cores. Both are values-driven
(`recordSealRepair.nodePool`, `recordSealRepair.tolerations`,
`recordSealRepair.cpuRequest`); setting `nodePool=` and `tolerations=[]`
restores the old exclusion from values alone.

**2. Precompiled bytecode.**
`backend/diarizer/Dockerfile.batch-pipeline` gains `RUN python -m
compileall -q
/app` after the last `COPY`, and the CronJob no longer sets
`PYTHONDONTWRITEBYTECODE=1`. The repair pod runs with
`readOnlyRootFilesystem: true`, so the `.pyc` must be baked at build
time.
`.dockerignore` now excludes `**/__pycache__` so host bytecode cannot
shadow
the build-time compile.

**3. No web framework in the row path.**
`utils/metrics.py` and `utils/sync/stage.py` import fastapi inside the
one
function that needs it (`metrics_response`, `require_http_stage`) and
annotate
with `TYPE_CHECKING`. Behaviour is unchanged: `/metrics` still returns
the same
`Response`, and the sync-stage HTTP dependency still raises
`HTTPException(503)`.

## Follow-up: Plan v3 L2 ordering

The bundle omitted the newest-first / near-dead-letter-first part of L2
(David ruling reference `6db8f2`). The follow-up adds:

- Urgent pending jobs first, ordered by their stored dead-letter
deadline and
document name. **Implementation choice: near = final 24 hours** before
the
stored 14-day barrier deadline; already overdue pending jobs are
included.
  Age never invents a deadline, and terminal jobs are excluded.
- Newest enqueue/name order for ordinary jobs and newest finish/name
order for
conversations. The existing half-worker reservation for conversations
stays.
- An independent encrypted urgent cursor and new recency cursor names,
keeping
old ascending frontiers out of the descending scans. Frozen recency
horizons,
wrap, minimum-age eligibility, exact numeric cursor clocks, and
checkpoints
  before proofs / after attempts remain covered.
- Five additive indexes in the batch registry and generated manifest:
job
recency/deadline for both stages, and completed-conversation recency.
The
deployment readiness gate must confirm them before an image ships. No
live
  index apply or deploy was run.
- Default-on behavior through the existing
`RECORD_SEAL_REPAIR_AGE_ORDER` kill
switch. Off skips urgency and restores the original hash jobs scan. The
ordinary missing-index fallback survives; a missing urgent index skips
only
that leg, emits content-free degraded telemetry, and continues ordinary
and
  conversation discovery.

The extra urgent page uses 128 rows **inside** the existing 10,000-row
aggregate
scan cap; candidate cap 1,024, worker count 16, row budget 270 seconds
and run
budget 1,500 seconds are unchanged. Roll back the follow-up commit to
restore
prior ordering; old frontier documents are untouched. No seal-proof or
custody
rules change. Also corrected the chart test's QoS wording and added
Starlette
to the coordinator-module import assertion.

## Tuning disclosure

| | before | expected after |
| --- | --- | --- |
| per-row p50 | 89 s | ~40-55 s |
| workers | 16 (unchanged) | 16 (unchanged) |
| CPU actually available | ~2 cores (node at 101%) | 4 cores
requested/reserved |
| seals/run | ~200 | ~330-450 (estimate) |
| throughput | ~390 seals/h | ~700-900 seals/h (estimate) |

The "after" numbers are estimates, not measurements: they extrapolate
the
measured import share and the 2 -> 4 core change. They must be confirmed
from
the CronJob's own `record_seal_repair_row` stage events over a full run
before
any further tuning. **This PR does not change worker count,
`rowSeconds`, the
run budget, or the seal rules.**

Local import measurement (warm Mac, image-shaped tree, 2,811 `.py`
files):

| | row import |
| --- | ---: |
| before, with `.pyc` | 8.0 s |
| after, with `.pyc` | 1.2 s |
| after, without `.pyc` | ~3.9 s |

So the fastapi removal is the larger lever (~6.7x) and `compileall` is
the
second (~2x on the remaining import). The absolute seconds are
indicative; the
*share* is the load-bearing part.

### Scheduling note the reviewer should weigh

`g2-standard-8` allocatable is ~7.8 vCPU and the GPU worker requests 4,
so a
4-CPU repair pod does **not** co-schedule with a worker: the pool
autoscaler
adds a node (pool max 16, currently 4 workers). That is the cost of a
four reserved CPU cores. If the lead prefers no extra node, set
`recordSealRepair.cpuRequest: "3"` — 4 + 3 = 7 fits beside a worker, and
the pod
still gets 3 guaranteed cores instead of today's ~2. This is a
values-only
change; the template does not need to move.

## Rollback

- **Placement only:** `--set recordSealRepair.nodePool= --set-json
  'recordSealRepair.tolerations=[]'` restores the old monitoring-pool
exclusion. `--set recordSealRepair.cpuRequest=2` restores the old
request.
- **Whole job:** `recordSealRepair.suspend: true` (already the
documented
  rollback in `prod_omi_batch_pipeline_worker_values.yaml`).
- **Code:** revert this commit. The lazy imports are
behaviour-preserving, so a
revert needs no data migration and no image rollback beyond the normal
digest
  pin.

## m1 verification (2026-11-10)

Merged `origin/main` through `986386ba0e48` without rebasing. Through
`bin/omi-heavy`
and `backend/test.sh` (file-isolated runner): import graph **4 passed**,
chart
render contracts **13 passed**. Worker count remains 16 in the
production render.

The completed follow-up also ran this explicit 12-file selection through
`bin/omi-heavy run -- env -u GOOGLE_APPLICATION_CREDENTIALS -u
CLOUDSDK_CONFIG
-u CLOUDSDK_CORE_ACCOUNT BACKEND_UNIT_TEST_FILE_LIST=<selection>
BACKEND_UNIT_FILE_BUDGET_SECONDS=3600 bash backend/test.sh`:

- `test_record_seal_row_import_graph.py`: 4 passed
- `test_record_seal_cluster_repair_deploy.py`: 13 passed
- `test_record_seal_cluster_repair.py`: 136 passed
- `test_record_pending_repair.py`: 60 passed
- `test_record_seal_priority.py`: 13 passed
- Seven selector-owned Firestore guard files: 842 passed, 1 deselected

**Total: 1,068 passed, 1 deselected.** These are hermetic checks; no
live cluster
or full CUDA image build was exercised. The actual push passed the full
repository pre-push hook with no skip
switches: 47 shared preflight checks, whole-backend type checking (0
errors),
and the selected backend test files and formatting checks.

## Original lane verification

New `backend/tests/unit/test_record_seal_row_import_graph.py` (4 tests):

- imports `scripts.record_seal_repair_job` in a clean interpreter and
asserts
  `fastapi`, `pydantic` and `starlette` are absent from `sys.modules`;
- the same for `utils.batch_pipeline.record_seal_cluster_repair`;
- `metrics_response()` still returns a `starlette.responses` object with
the
  Prometheus content type and `omi_*` samples;
- `require_http_stage()` still raises `HTTPException` 503 on an unknown
stage.

New chart tests in
`backend/tests/unit/test_record_seal_cluster_repair_deploy.py`:

- the repair pod's `nodeAffinity` requires `batch-pipeline-pool` and its
  tolerations match that pool's taints;
- request == limit == 4 CPU, and no GPU in the limits;
- `PYTHONDONTWRITEBYTECODE` is absent from the CronJob env;
- `nodePool=` + `tolerations=[]` renders the old exclusion exactly.

Commands run through `bin/omi-heavy` (the host was at load 150-350 from
other
lanes, so every run waited for a slot). Each file below was run in its
own
pytest process, as the backend contract requires:

```
backend/.venv/bin/python -m pytest -q tests/unit/test_record_seal_row_import_graph.py
  4 passed
backend/.venv/bin/python -m pytest -q tests/unit/test_record_seal_cluster_repair_deploy.py
  13 passed
backend/.venv/bin/python -m pytest -q tests/unit/test_record_seal_cluster_repair.py
  136 passed
backend/.venv/bin/python -m pytest -q tests/unit/test_record_partial.py
  67 passed
backend/.venv/bin/python -m pytest -q tests/unit/test_sync_stage_isolation.py
  6 passed
backend/.venv/bin/python -m pytest -q tests/unit/test_omi_flags.py
  84 passed
backend/.venv/bin/python -m pytest -q tests/unit/test_external_list_cache.py
  38 passed
backend/.venv/bin/python -m pytest -q tests/unit/test_episodes_metrics_export.py
  2 passed
backend/.venv/bin/python -m pytest -q tests/unit/test_llm_gateway_routers_metrics.py
  4 passed
backend/.venv/bin/python -m pytest -q tests/unit/test_metrics_sidecar_server.py
  2 passed
backend/.venv/bin/python -m pytest -q tests/unit/test_metrics_cardinality_contract.py
  4 passed
```

A single combined run of the record-seal and metrics files (604 passed)
also
covered `test_record_seal_sweeper_deploy`,
`test_record_seal_worker_deploy`,
`test_record_seal_worker_guards`, `test_record_seal_rules`,
`test_record_seal_fast`, `test_record_seal_nojob`,
`test_record_seal_sweep_budget`, `test_record_seal_sweeper` and
`test_record_seal_worker`. That combined run reported two failures in
`test_sync_stage_isolation.py` from cross-file `caplog` contamination,
which is
exactly why the contract isolates files; the file passes 6/6 on its own
(above).

Static checks:

```
backend/.venv/bin/python scripts/scan_import_time_side_effects.py
  Checked 2530 backend production file(s); 0 violation(s).
backend/.venv/bin/python scripts/check_module_stub_pollution.py
  Checked 2919 backend test file(s); 0 violation(s).
make runtime-image-source-closure
  Runtime-image contracts passed for 19 registered images.
python3 .github/scripts/check_failure_class_guard_ratchet.py
  OK: every class at or above the threshold names a guard artifact.
scripts/failure-class validate --pr-body-file .agent-brief/pr-body.md
  ok: true
helm template ... -f prod_omi_batch-pipeline-worker_values.yaml
  renders; rollback render verified
```

Not run: a full `docker build` of `Dockerfile.batch-pipeline`
(torch/CUDA
wheels) and any live cluster apply. The `compileall` step is verified by
inspection and by the local `.pyc` measurement above, not by a built
image.

## Product invariants affected

- INV-DATA-1 — preserves the existing customer data-plane authority. The
selected source SHA and `vars.RUNTIME_GCP_PROJECT_ID` bind the read-only
index gate to the release’s existing Firestore authority; this is not a
customer data-plane migration.

Failure-Class: new

Line-Count-Exception: backend/utils/metrics.py | 1722 -> 1730 | Keep the
HTTP Response import at its sole call boundary with a TYPE_CHECKING
annotation; splitting the shared metrics registry is outside this
startup fix.

Line-Count-Exception:
backend/utils/batch_pipeline/record_seal_cluster_repair.py | 791 -> 887
| Keep the bounded priority query and its cursor checkpoints with the
existing coordinator; the follow-up adds no separate seal or mutation
authority.


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/25049?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/25049?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F25049&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. -->

## Pre-review dispositions

Consolidated fix batch after merging current `origin/main` (no rebase).

- **Production safety P1-1 — fixed:** the existing `gcp_diarizer.yml`
stages immutable Firestore gate controls and invokes the same readiness
action/inputs as `gcp_backend.yml`, unconditional with its sparse
control checkout, registered in `_LANE_SOURCE_BINDINGS`, and bound to
`${{ steps.vars.outputs.source_sha }}` before build, digest promotion or
Helm. No new workflow.
- **Production safety P1-2 / correctness P2-3 — fixed:** catch
`FailedPrecondition` around urgent discovery only, emit content-free
`index_unavailable` and shared degraded fallback telemetry, then run
ordinary and conversation discovery. Regression covers plan/apply and
the real CronJob entrypoint returning 0; provider exception contents
never enter events.
- **Correctness P2-1 / Luna malformed-prefix FIX-FIRST at earlier head
`7c214814` — fixed:** urgent discovery uses
`record_dead_letter_deadline_at > 0` and the existing final-day upper
bound. Every examined row advances the encrypted query position before
eligibility checks. The urgent codec accepts raw scalar scan positions
while ordinary enqueue cursors keep numeric validation, so malformed
metadata cannot create an unreadable frontier. Examined invalid
deadlines add to the existing content-free `invalid_clock_rows` metric
and are not selected for urgent processing. A persistent full malformed
prefix cannot pin valid jobs; the existing saturated-page regression is
retained and now checks readable advancing progress.
- **Production safety P2-7 / correctness P2-2 — fixed:** runbook names
the v2 conversation/recency cursors and v1 urgent cursor, newest-first
ordering, gate and degraded behavior.
- **Correctness P2-4 — fixed:** direction-aware conversation query fake
verifies descending finish/name ties, encrypted resume, frozen horizon
and wrap.
- **Production safety P2-1 / Luna FIX-FIRST at earlier head `0711777f` —
fixed:** ordinary discovery runs every enabled run within the shared
discovery budget. For allocation `A = max(1, workers // 2)`, reserve `R
= max(1, A // 4)` ordinary places; urgent discovery gets at most `A -
min(R, ordinary candidates)`. With 16 workers, ordinary retains 2 of 8
job places under sustained urgency; with no ordinary candidates, urgent
can use all 8. Unused urgent capacity returns to ordinary candidates.
Urgent attempts remain deadline-first. Held ordinary candidates stay
ahead of their encrypted checkpoint. The hard bound is one run between
ordinary scans, with no finite settlement-time guarantee. The change doc
and runbook now state the bound.
- **Production safety P2-2 — follow-up:** review urgent cursor
wrap/fairness for newly urgent work behind the frontier.
- **Production safety P2-3 — follow-up:** measure newest-first candidate
yield against the unchanged 30-minute minimum age and append-proof
refusals.
- **Production safety P2-4 — follow-up:** validate GPU-pool scheduling,
4-CPU reservation, autoscaler headroom and cost before deployment.
- **Production safety P2-5 — follow-up:** verify compiled
bytecode/readability in the built batch worker image; full CUDA image
build was not performed locally.
- **Production safety P2-6 — follow-up:** old v1 frontiers remain stale
on code rollback; clarify the urgent numeric payload naming in a later
cursor change.
- **Production safety P2-8 — follow-up:**
`typing.get_type_hints(metrics_response)` needs a runtime `Response`
resolution if a caller is introduced.

## CI regression dispositions after earlier head `783ec7ff`

The complete logs for [run
42879396660](https://github.com/BasedHardware/omi/actions/runs/42879396660)
reveal regressions triggered by this PR. The earlier classification as
unrelated was incorrect.

- **Workflow policy — fixed:** removed both unsupported service
predicates from `gcp_diarizer.yml`. The sparse immutable-controls
checkout and readiness gate are unconditional. Registered the workflow's
real `${{ steps.vars.outputs.source_sha }}` expression in
`_LANE_SOURCE_BINDINGS`. The existing policy and all its enforcement
remain intact. Baseline: 2 workflow tests failed; corrected suite: 98
passed.
- **Lazy HTTP import / shard 3 — fixed:** `require_http_stage()` imports
`HTTPException` only inside `except InvalidSyncStage`; valid stage
checks remain free of FastAPI. The import trace for the slow test was
`database.conversations` → `utils.other.storage` → `utils.cloud_tasks` →
FastAPI, during a test-body import. Removing earlier framework warming
exposed that call-phase cost. The test now loads the real visibility
dependency in module-fixture setup, as required by the CPU guard's
setup/call boundary. The 1.00-second limit and all rollback/visibility
assertions remain unchanged. Local call CPU: 0.575309 s before, 0.000652
s after (2026-11-10, m1; repo guard measurements). Fixture/setup still
pays the dependency import.
- **Multipart / shard 8 — fixed:** the isolated
`test_sync_transcription_prefs.py` fixture itself replaced
`python_multipart` with a plain `ModuleType`, hiding
`python_multipart.exceptions`. Removed that unnecessary package shadow
and retained the installed lightweight parser. Existing `stub_modules`
teardown continues to restore its other fakes. Baseline isolated run: 59
setup errors; corrected file: 59 passed. CI launches one Python process
per file, so another file's module state cannot leak into this failure.
`test_action_items_conversation_list_malformed.py` already removes its
conditional fallback stub in `finally` and skips installing it when the
real package is present.
- **Gacrux desktop — no voice defect found:** the old shard log's
adjacent `FAILED [87%]` belongs to concurrent workflow-contract output.
The voice file's own terminal summary is **119 passed**, with no
failed-file status. Both baseline and corrected isolated local runs also
pass all 119 tests, including Gacrux desktop; voice code is untouched.
- **Row import graph — preserved:** 5 subprocess contracts pass,
including the new valid-stage path assertion that
FastAPI/Pydantic/Starlette stay absent and the existing invalid-stage
HTTP 503 behavior.

Local reproduction on the merged tree (2026-11-10, m1):

- Focused regression selection: **344 passed** across workflow
contracts, merge jobs, sync preferences, voices, row import graph, stage
isolation, deploy and priority tests, via `backend/test.sh`.
- Original shard 3: 345 original CI files, all passed locally (exit 0).
- Original shard 8: 345 original CI files, all passed locally (exit 0).
- Both original shard file sets contain 345 files, exactly matching the
complete old CI logs. Launch order is reconstructed with the unchanged
runner's LPT weights and shard-1 typecheck reservation over the original
2,741-file selection (including workflow-contract extras). Both use
`BACKEND_PYTEST_WORKERS=4`, file isolation, 0.1-second warning /
1.0-second failure CPU guards and
`BACKEND_UNIT_FILE_BUDGET_SECONDS=3600` through `backend/test.sh`, with
the three ambient GCP credential variables unset. No policy, budget,
allowlist or hook bypass.

The former prod P2 follow-ups above remain as listed. No deployment or
PR merge. CI correction at earlier head
`0711777f1cbc2fc2c92eb833497a8a94b6affb4f`.

Full local shard evidence recorded 2026-11-10T19:28:30+00:00 in
`backend/docs/listen_pusher_pipeline/changes/2026-11-10-record-seal-priority.md`,
including manifest hashes and the exact runner settings.


Full push-hook receipt (2026-11-10T19:37:43+00:00): **passed** at
earlier head `0711777f1cbc2fc2c92eb833497a8a94b6affb4f`. All 56 selected
preflight checks and the bounded unit selection passed with the required
credential-unset/body-file/3600-second recipe. GitHub received one
update from earlier head `783ec7ff49` to that earlier head; no
force-push or hook bypass. The `sealfix2` worktree was removed via lane
finish. [Backend Unit Tests run
42886859875](https://github.com/BasedHardware/omi/actions/runs/42886859875)
owns that earlier head's CI result.


## Luna FIX-FIRST: ordinary-job reserve

The urgent leg previously filled the entire job allocation before
ordinary discovery was considered. A sustained urgent backlog could
suppress the ordinary query forever. Ordinary discovery now runs first
with one bounded page, urgent discovery is capped by the ordinary
reserve, and attempt order remains urgent deadline-first, then ordinary,
then conversations. Both legs retain their existing encrypted frontiers
and combined worker reservation; held ordinary candidates cannot be
checkpointed past. No extra query or scan budget is added.

Regression coverage uses real bounded job queries and encrypted cursors
at 2, 4 and 16 workers: repeated runs under sustained urgency retain the
ordinary reserve, an empty ordinary pass allows full urgent capacity,
and a partially used ordinary reserve returns unused places to urgency.
The one-place allocation edge, pre-attempt checkpoints, urgent index
degradation and conversation capacity are covered. L1 #25018 was open at
the main merge; no L1 conflict was present.

Local reserve verification (2026-11-10T20:21:16+00:00, m1): all 15
record-seal unit files through `backend/test.sh` under `omi-heavy`:
**436 passed, 3 skipped** (Firestore emulator unavailable), including 35
priority, 136 coordinator and 5 import-graph tests. Credential variables
unset; file isolation, four file workers, 3600-second file budget and
unchanged 0.1/1.0-second CPU guards. Main merged through
`85de1985f0fb4fddd05e0de4b36c1ac68108d81e`, without rebasing. `git diff
--check` and required invariant metadata validation pass.

Ordinary-reserve fix at earlier head
`d991957cab4ed220198e859660af33dec156510a`.

Full push-hook receipt (2026-11-10T20:25:33+00:00): **passed** at
earlier head `d991957cab4ed220198e859660af33dec156510a`. All **56
selected preflight checks** and the bounded unit selection passed with
the credential-unset/body-file/3600-second recipe. Exactly one non-force
push updated earlier head `0711777f1c` to that earlier head; no hook
bypass. [Backend Unit Tests run
42895041539](https://github.com/BasedHardware/omi/actions/runs/42895041539)
owns that earlier head's CI result.


## Sibling merge refresh after #25020 and #25063

Earlier head `7c214814536c30c5fb6b9d3f97ab5453571933a4` merged main;
main parent: `75dc53a81df78643cf74c7638350fecc9082ebfc`. Fetched and
merged main with `git merge --no-ff origin/main`, without rebasing or
new feature scope, under lead2 ruling `1c606e`.

The only textual conflict was `config/feature-flags.yaml`: retained this
PR's current `RECORD_SEAL_REPAIR_AGE_ORDER` declaration and main's new
`PIPELINE_LEDGER` declaration. Main's `NO_SPEECH_TERMINAL_ENABLED` entry
also remains. The index sources merged automatically, retaining #25063's
`record_no_speech_newest` and all five seal-repair indexes (prod/dev
newest, prod/dev deadline, newest completed conversation).

Regenerated `firestore.indexes.json` with `backend/.venv/bin/python
backend/scripts/generate_firestore_indexes.py --write` and
`backend/docs/feature-flag-registry.md` with `backend/.venv/bin/python
scripts/render_feature_flag_registry.py`. Neither generated output was
hand-merged. Semantic verification confirms every composite and field
override from both parents remains in the manifest, all six required
declarations are generated, and both parent flag registries are
preserved with the current seal-order description taking precedence over
main's older text. The Firestore generator's check mode also passes.

Verification recorded 2026-11-10T23:22:56+00:00 on m1: **1470 passed, 3
skipped, 1 deselected** across 28 files through `backend/test.sh` under
`omi-heavy`. Includes all 15 record-seal files (including import graph),
Firestore index tests and the canonical seven query guards, plus
`test_flag_budget.py` (24 passed). Emulator tests skip without an
emulator; the standard runner deselects the slow-marked case. Credential
variables unset, file isolation, four file workers, unchanged CPU guards
and 3600-second file budget. `git diff --check` passes.

`MERGE-OK 0175e5` applied to earlier head `d991957c`; it is not carried
forward as approval for any later head. The merge desk re-verifies at
the current PR head. PR remains unmerged.

Sibling merge push receipt (2026-11-10T23:26:21+00:00): **passed** at
earlier head `7c214814536c30c5fb6b9d3f97ab5453571933a4`. All **56
selected preflight checks** and the bounded unit selection passed with
the required credential-unset/body-file/3600-second recipe. Exactly one
non-force push updated earlier head `d991957cab` to that earlier head,
with no hook bypass. [Backend Unit Tests run
42923202562](https://github.com/BasedHardware/omi/actions/runs/42923202562)
owns that earlier head's unit CI result.

Firestore CI queue observed 2026-11-10T23:36:37+00:00: earlier head
`7c214814`'s [index workflow
42923203481](https://github.com/BasedHardware/omi/actions/runs/42923203481)
was pending behind the shared `firestore-schema-prod` concurrency lock
held by [main reconciliation
42920647780](https://github.com/BasedHardware/omi/actions/runs/42920647780)
from #25063. The main run was executing, with no pending environment
approval at that observation. These owning run links carry the current
state; no index apply, cancellation, approval or lock change was
performed as part of this conflict refresh.




## Luna FIX-FIRST: persistent malformed urgent prefix

Disposition: fixed. The urgent query now has a positive lower bound and
its existing final-day upper bound on the same deadline field; the
current `(state ASC, record_dead_letter_deadline_at ASC, __name__ ASC)`
index serves this range without a new declaration. Cursor advancement
happens for every examined row before local eligibility validation. Raw
scalar urgent scan positions round-trip through the encrypted
maintenance codec; ordinary enqueue cursor validation is unchanged.
Examined invalid deadlines contribute to the existing
`invalid_clock_rows` summary, without identifiers or payloads and
without urgent processing. Query-excluded rows are not enumerated or
counted.

The persistent-prefix regression leaves 128 malformed rows in place and
proves the real query floor discovers valid urgent jobs in one run. A
separate adversarial projected-page case bypasses the floor and proves
encrypted cursor advancement discovers valid urgent jobs in two runs
while counting all 128 examined malformed rows. The earlier
saturated-page test remains, including null, boolean, string,
non-positive and non-finite cases; it now asserts a readable advancing
cursor. Coordinator coverage verifies discovery invalid-clock counts are
combined with the existing aggregate. No worker, scan, query-count or
proof budgets change.

Fetched main before work; main remains the already merged parent, so no
additional main merge or rebase was needed. Prior approvals apply to
their earlier heads; the merge desk must re-verify the new published
head.

Local malformed-prefix verification (2026-11-11T00:26:25+00:00, m1):
**1,310 passed, 3 skipped, 1 deselected** through the repo runner across
23 files. Includes all 15 record-seal files, the canonical seven
Firestore guards and `test_flag_budget.py`; all 39 priority cases and
all five row-import contracts pass. The earlier ordinary-reserve batch's
priority-file subtotal is corrected from 38 to 35; its recorded total
remains 436. The Firestore generator check passes with no new registry
or manifest change. Credential variables unset, file isolation, four
file workers, unchanged CPU guard and 3600-second per-file budget.

Current head: `e47911c994d6fb0fd7b30ec5cb45da1b8761dff1`. All historical
receipts above refer to earlier heads.

Malformed-prefix push receipt (2026-11-11T00:31:41+00:00): **passed** at
current head `e47911c994d6fb0fd7b30ec5cb45da1b8761dff1`. All **56
selected preflight checks** and the bounded unit selection passed with
the required credential-unset/body-file/3600-second recipe. Exactly one
non-force push updated earlier head `7c21481453` to the current head,
with no hook bypass. [Backend Unit Tests run
42931834561](https://github.com/BasedHardware/omi/actions/runs/42931834561)
owns the current head's unit CI result.
MichaelC001 pushed a commit to MichaelC001/omi that referenced this pull request Nov 11, 2026
A recording seal takes ~89 s per row (p50) and the seal itself is ~5 s.
~88% is per-process fixed cost: a fresh `python scripts/record_seal_repair_job.py
--row` subprocess re-imports the backend, and the pod is CPU-starved.

Three changes, no worker-count change (16 -> 24 already lost 15-35% of
seals/run in prod, BasedHardware#24962/BasedHardware#24966; 48 was worse, BasedHardware#24729):

- Chart: pin record-seal-repair to batch-pipeline-pool (8-19% CPU) with that
  pool's taints instead of the monitoring pool at 101% CPU, and raise the CPU
  request 2 -> 4 (== the unchanged limit) so 16 row workers are not starved to
  ~2 cores. Both are values-driven, so placement rolls back from values alone.
- Image: `python -m compileall -q /app` at build, and drop
  PYTHONDONTWRITEBYTECODE=1 from the CronJob. The pod has a read-only root
  filesystem, so .pyc must be baked at build time.
- Code: utils/metrics.py and utils/sync/stage.py import fastapi inside the one
  function that needs it. fastapi/pydantic was ~60% of the row's import bill
  and a recording seal does no HTTP work. Behaviour is unchanged.

Row import on a warm Mac, image-shaped tree: 8.0 s -> 1.2 s with .pyc,
~3.9 s without.

Guarded by a new import-graph test that imports the row entrypoint in a clean
interpreter and asserts fastapi/pydantic/starlette never load, plus chart
tests for the affinity, tolerations, request and the values-only rollback.

Failure-Class: new
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant