Skip to content

revert(batch): back out the HPA retune from #24481 (fixes main) - #24493

Merged
Git-on-my-level merged 1 commit into
mainfrom
lane/hpa-retune-revert
Nov 3, 2026
Merged

Git-on-my-level merged 1 commit into
mainfrom
lane/hpa-retune-revert

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

What changed and why

Revert the batch worker HPA retune from #24481 (40/0.6 back to 32/0.5, plus its docs and replay tests). On main, tests/unit/test_batch_pipeline_hpa_max_replay.py::test_max_of_two_dominates_ready_only_when_backlog_binds_and_never_starves fails with the new targets: the replay finds 35 minutes where ready-only sizing starves the backlog. The new targets were never applied to the cluster.

The regenerated GMP query inventory that #24481 also carried stays as is.

Product invariants affected

None. It restores the chart values that are live today.

How it was verified

On origin/main e24fa48, test_batch_pipeline_hpa_max_replay.py fails. With this revert it passes, as do test_batch_pipeline_chart.py, test_batch_pipeline_hpa_retune_replay.py and test_monitoring_gmp_shadow.py.

Tests

BACKEND_UNIT_TEST_FILE_LIST=<those 4 files> bash test.sh: 1, 4, 35 and 69 passed.

UI evidence

None (no UI change).

Failure class (fixes)

Failure-Class: none

🤖 Generated with Claude Code

View guided diff Turn on auto-fix

The 40/0.6 targets fail test_batch_pipeline_hpa_max_replay on main: the
max-of-two replay finds 35 minutes where ready-only sizing starves the
backlog. The regenerated GMP inventory from #24481 stays.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-11-03T09:57:54.196737Z
We couldn’t complete this review. Comment @codex review to try again.
72cdbd4 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@Git-on-my-level
Git-on-my-level merged commit 8c37b6d into main Nov 3, 2026
65 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/hpa-retune-revert branch November 3, 2026 10:16
Git-on-my-level added a commit that referenced this pull request Nov 3, 2026
Replace the fixed record-seal-repair throughput buffer with CPU seal
workers that
claim completed unsealed record_pending obligations and scale from one
to sixteen
slots on fresh seal backlog. Discovery pages pending jobs oldest-first
instead of
rescanning 10,000 conversations. Keep canonical plan/apply, proof rules
and the
270-second child unchanged; GPU worker scheduling and its HPA are
unchanged.

Claims use expiring tokens on the existing obligation, stale-token
release checks
and one-hour retry backoff. Add backlog/oldest age, seals/minute counter
and seal-age
histogram through the existing Prometheus Adapter route. Retain the
repair CronJob
with `suspend: true` and move the sweeper to hourly, matching its alert
alignment
and absence window to that cadence. The worker switch ships on.

Validation: hermetic seal suites and the seven Firestore query/index
guards passed
via `omi-heavy run -- nice -n 19 env BACKEND_UNIT_TEST_FILE_LIST=...
bash test.sh`,
one pytest process per file (1,098 passed, one deselected; five later
worker guards
also passed, 19 total worker cases). Includes concurrent apply (one
seal), claim expiry,
reclaim, interrupted cleanup, budget/backoff, oldest-first keyset, kill
switch and
complete/fresh backlog samples. Concurrent hermetic tests serialize the
strict
fixture at its transaction boundary; real SDK contention is a staging
gate.
`make preflight` passed all 43 selected checks. The updated
hourly-sweeper alert
contract also passed (4 tests). Receipts are in
`/Volumes/scratch/ic-sealfold-a/`.
Additional review guards cover malformed-row progress, startup-error
privacy,
real dev/staging values, the monitoring target inventory and exact
adapter drift
acceptance. The 22 flag-budget cases pass; GPU chart contracts still
verify the
same scheduling and HPA settings alongside the new CPU Deployment/HPA.
Process metadata is read at entrypoint bootstrap and passed into the
worker;
the stage-env and logging-entrypoint ratchets pass with no baseline
exception.
After integrating current main (including the independently landed
#24493), the
12-file seal/monitoring/chart integration set passed, including both
existing GPU
HPA replays. No GPU HPA or scheduler changes are in this PR's diff.

Deployment/ramp (lead + infracost):

1. Verify composite indexes READY, deploy Prometheus scrape/adapter
wiring, and
qualify CPU placement, long-row memory and forced-death reclaim in
staging.
2. Deploy workers ON with an explicit `recordSealRepair.suspend=false`
override for
one evening peak. Shared canonical apply rechecks make cron overlap
safe.
3. Set suspend=true, then run one bounded catch-up sweep over chronic
classes,
preserving privacy/upload/proof refusals. No redrive is included in this
PR.
4. Gate: seal-age p95 <30 minutes across one evening peak, no manual
worker
changes. Also check oldest unfinished debt so refusals cannot disappear
from
the success histogram. Lead owns the peak gate; remove the retained cron
in
   a later PR after a recorded passing peak.

Rollback: `recordSealWorker.runtimeEnabled=false` and
`recordSealRepair.suspend=false` in one Helm values update. Worker slots
idle;
repair resumes. Current policy maps must be supplied to both worker and
repair
during overlap; invalid/absent maps refuse cloud IO.

The 16-slot maximum preserves repair's 4CPU/8Gi aggregate limit, split
into
250m/512Mi per slot. Throughput and memory at that split are unqualified
until
staging. No production/GCP credential use, deploy, live flag change or
Luna run
was performed on m1. Runbook:
`backend/docs/runbooks/record-seal-workers.md`.

Failure-Class: none
Workers reuse `RECORD_SEAL_REPAIR_ENABLED` in their own pods and
children;
`recordSealWorker.runtimeEnabled` controls that independently of the
retained
cron's runtime flag. No additional runtime flag or flag-budget
exception.
Git-on-my-level added a commit that referenced this pull request Nov 3, 2026
…arvation replay (#24499)

## What changed and why

Replace reverted #24481 (40/0.6; 35 starved minutes in the existing
max-of-two
replay, reverted by #24493 before cluster apply) with backlog target
**41** and
chain-wall occupancy target **0.56**. Preserve production min 4/max 16,
worker
processes 1, the adapter, and stockout-aware downscale 1800s / one pod
per 600s.
Production's existing enabled HPA consumes the new defaults; restoring
32/0.5
is the values kill switch. No new env name or flag registry entry is
required.

Local HEAD: `e419fccd85ef19b6c3db51d3bd893215e06f402d` on
`lane/hpa-retune-v2`,
from `origin/main` at `9b6a20abbb9c01de3e936ca33b49546dfe171b9a`.

The offline search evaluated **2,918 distinct configurations**, with 751
passing
its unchanged-model acceptance conditions. This is a bounded grid, not a
global
continuous optimum. Full details and the reproducer are in
`backend/docs/batch-pipeline-hpa-frontier.md`.

| Targets / window | Current mean/max; hot min | Synthetic 3.7x full
mean/max; hot min | Older measured24h mean/max; starved min |
|---|---|---|---|
|32/0.5 /1800s baseline|4.878/6;0|11.790/16;5|7.198/16;0|
|40/0.6 /1800s reverted|4.343/5;0|10.994/16;7|6.306/16;35|
|41/0.56 /60s numerical minimum|4.050/5;0|10.326/16;9|5.552/15;0|
|41/0.555 /780s sensitivity|4.116/5;0|10.829/16;6|6.006/15;0|
|41/0.56 /1320s sensitivity|4.166/5;0|11.254/16;6|6.211/15;0|
|**41/0.56 /1800s chosen**|**4.343/5;0**|**11.459/16;6**|**6.371/15;0**|

The chosen 0.56 target is exactly the older replay's measured capacity
boundary,
with no modeled headroom.

The chosen setting is the lowest current mean found with the existing
stockout
window/policy and the lead's prior full-model hot budget retained, with
ties
broken by full-model mean then older 24h mean. At 0.56 occupancy, ready
42 fails
the unchanged step wait bound; 0.561 already starves in the older 24h
replay.
Current step wait/catch-up: 3.355/10 min; synthetic full step: 4.302/20
min.

**Plan corrections and limits:** `worker_flight` is serialized chain
wall time,
including executor wait and host work, rather than ASR/GPU duty. The
pump takes
its GPU slot before timing, so pipelineDepth 2 does not double-count
slot wait.
The separate historical 24h fixture is not observed full-volume
qualification.
The 3.7x full scenario is synthetic. Zero-hot full-volume operation
cannot fit
max 16 at its 15.0/s peak: 18 workers are necessary at the 0.85 hot line
(not proof
that a cap raise alone suffices). The older max replay also downscales
per 60s
despite its stated 600s policy and omits current-sized recommendations
from the
window. Its unchanged assertions remain required, but do not qualify
shorter
stockout protection. Lower-window and faster-policy candidates are
reported,
not shipped. No existing replay file or assertion was changed or
loosened.

## Product invariants affected

none (confirmed by `scripts/pr-preflight --lane local --suggest`).

## How it was verified

Offline numeric search:

```bash
backend/.venv/bin/python backend/scripts/batch_pipeline_hpa_frontier.py --grid all --output /Volumes/Ephemeral/scratch/hpa-retune-v2-frontier.json
```

All selected backend tests passed: 112 tests, zero failures/skips, via
the exact
harness command below. The two existing replay files have no diff
against
origin/main. Full preflight passed all 36 checks in 979.86 seconds at
`e419fccd85ef19b6c3db51d3bd893215e06f402d`, with HEAD held stable. Luna
review
passed after clarifying the rollback floor. No production, cluster, or
GCP
access was used.

Lead apply steps (staged at **current volume only**):

1. Confirm actual current batch volume; hold the apply if already at
full
volume. Before streaming retirement doubles batch volume, decide whether
to
   qualify `maxReplicas` above 16. This PR does not change that ceiling.
2. Confirm both composite Firestore indexes READY and the pending
batch-timeliness
2h/no-terminal, stale-sample and scan-blind alarms applied/observing per
the
projection runbook. Confirm separate T3/hard-3 observer/response
authority:
in-cluster custody/proven-loss guards do not automatically roll back
latency.
3. Privately capture live Helm values/manifest/image and the adapter
rule.
Reconcile any min 6/max 12 overrides against the tree's min 4/max 16
ruling.
Render the merged chart with production values, remove stale target
overrides,
and inspect 41/0.56, 1800s, 1/600s, OD placement, profiling-on and 1500s
drain.
Preserve the image and all runtime bindings; perform the reviewed Helm
upgrade. No adapter redeploy is needed;
`backend/scripts/diff_prod_adapter.py`
   compares separately captured live rules, it does not fetch them.
4. Watch one complete shed cycle plus 24h: useful completed audio per
pod-hour,
throughput, admission-to-terminal timeliness/pending age, pull backoff
and
T3/hard-3 signals. The fresh-history test sheds 12 to 5 within 60 min;
retained
live recommendations can delay the cycle. Roll back on regression.
Respect
ADR-0001's obligation>900s/job>1800s cohort floors and hard-3 backstops:
p95 >30 min sustained 30 min; admitted unit 2h without terminal state;
wedged >5% for 30 min with >=20 admitted. Confirm current operator
authority before
   use because in-cluster wedge/latency signals are alert-only.

Rollback: use the same reviewed Helm upgrade with
`--set autoscaling.targetQueuedUnitsPerWorker=32 --set-string
autoscaling.targetChainBusyPerWorker=0.5`,
keeping min 4/max 16, window 1800, 1/600s, profiling and the pinned
image; or restore
the captured known-good Helm revision after checking its values/image.
No
adapter change is needed. Nothing was pushed, deployed, or applied here.

## Tests

The list contains every `test_batch_pipeline_*hpa*` /
`test_batch_pipeline_*chart*`
file plus `test_monitoring_gmp_shadow.py` (5 files):

```bash
cd backend && BACKEND_UNIT_TEST_FILE_LIST=/Volumes/Ephemeral/scratch/hpa-retune-v2-tests.txt nice bash test.sh
```

Executed through the workspace heavy runner. Results: chart 69, max
replay 1,
retune replay 4, new capacity replay 3, GMP shadow 35: **112 passed**.
The existing
max replay is the regression that would have caught #24481. The new
capacity
replay pins mean/max/current hot minutes, retains full hot <=7, and
bounds the
full-step wait/catch-up. The chart's exact assertions change only to
reflect
41/0.56 and latent doubled targets 82/1.12; its 1800s and 1/600s
assertions remain.

Required full check:

```bash
OMI_PR_BODY_FILE=$PWD/PR_BODY.md nice make preflight
```

**PASS: 36/36 checks in 979.86 seconds**, exit 0. Executed through the
workspace heavy runner with committed HEAD held stable. Final PR
metadata
validation is recorded separately after updating this untracked body.

## UI evidence

UI-Evidence: none -- HPA configuration, replay tooling/tests, and
operator docs.

## Failure class (fixes)

Failure-Class: none

## Scoped cleanups (optional)

Correct HPA metric comments and qualification claims; retain worker
processes 1
until the g2-standard-8 L4 throughput, cgroup-memory and 24h soak gate
is met.
No unrelated runtime, adapter, environment registry, capacity or
production edit.

🤖 Generated with [Claude Code](https://claude.com/claude-code)


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