Repository navigation
perf(batch): retune batch worker HPA targets to 41/0.56 within the starvation replay - #24499
Conversation
Search the target/window/policy frontier, retain unchanged starvation and timeliness replay contracts, and document the full-volume capacity limit. Preserve the four-worker floor and stockout-aware downscale policy. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis 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. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
3 issues found across 8 files
Confidence score: 3/5
- The prerequisite in
batch-pipeline-hpa-frontier.mdcannot be met while the timeliness rules are pending, which can stall the documented rollout. Put worker deployment and verification of metrics and READY indexes before promotion and provisioning. - The target in
batch-pipeline-worker.mdmatches the measured per-worker capacity ceiling, leaving no modeled headroom before queueing. Clarify that the replay’s zero-starvation result is not a production safety margin. - The reproduction command in
batch-pipeline-hpa-frontier.mdfails when/Volumes/Ephemeral/scratchdoes not exist. Use a repository-relative or standard temporary path, or create the parent directory.
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/docs/batch-pipeline-hpa-frontier.md">
<violation number="1" location="backend/docs/batch-pipeline-hpa-frontier.md:38">
P2: This reproduction command fails unless the operator already has the author’s `/Volumes/Ephemeral/scratch` directory. Use a repository-relative or standard temporary output path, or create the parent directory before writing.</violation>
<violation number="2" location="backend/docs/batch-pipeline-hpa-frontier.md:97">
P2: This prerequisite is impossible as written because the timeliness rules are intentionally inactive while pending. Follow the runbook order: deploy the worker, verify metrics and READY indexes, then promote and provision the pending rules before relying on them during the shed-cycle watch.</violation>
</file>
<file name="backend/docs/batch-pipeline-worker.md">
<violation number="1" location="backend/docs/batch-pipeline-worker.md:318">
P2: This target equals the measured per-worker capacity ceiling, so it provides no modeled occupancy headroom before queueing; the replay’s zero-starvation result should not read like a production safety margin. State explicitly that 0.56 is a boundary target with no modeled headroom and retain the throughput/headroom gate before applying it.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
|
|
||
| ```bash | ||
| backend/.venv/bin/python backend/scripts/batch_pipeline_hpa_frontier.py \ | ||
| --grid all --output /Volumes/Ephemeral/scratch/hpa-retune-v2-frontier.json |
There was a problem hiding this comment.
P2: This reproduction command fails unless the operator already has the author’s /Volumes/Ephemeral/scratch directory. Use a repository-relative or standard temporary output path, or create the parent directory before writing.
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/docs/batch-pipeline-hpa-frontier.md, line 38:
<comment>This reproduction command fails unless the operator already has the author’s `/Volumes/Ephemeral/scratch` directory. Use a repository-relative or standard temporary output path, or create the parent directory before writing.</comment>
<file context>
@@ -0,0 +1,124 @@
+
+```bash
+backend/.venv/bin/python backend/scripts/batch_pipeline_hpa_frontier.py \
+ --grid all --output /Volumes/Ephemeral/scratch/hpa-retune-v2-frontier.json
+```
+
</file context>
| hot minutes. The mathematical full-volume zero-hot goal is unresolved; do not | ||
| expand traffic based on this PR. | ||
|
|
||
| The lead applies at current volume only. First confirm pending timeliness |
There was a problem hiding this comment.
P2: This prerequisite is impossible as written because the timeliness rules are intentionally inactive while pending. Follow the runbook order: deploy the worker, verify metrics and READY indexes, then promote and provision the pending rules before relying on them during the shed-cycle watch.
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/docs/batch-pipeline-hpa-frontier.md, line 97:
<comment>This prerequisite is impossible as written because the timeliness rules are intentionally inactive while pending. Follow the runbook order: deploy the worker, verify metrics and READY indexes, then promote and provision the pending rules before relying on them during the shed-cycle watch.</comment>
<file context>
@@ -0,0 +1,124 @@
+hot minutes. The mathematical full-volume zero-hot goal is unresolved; do not
+expand traffic based on this PR.
+
+The lead applies at current volume only. First confirm pending timeliness
+rules and both composite indexes are active/READY per
+[the projection runbook](../charts/monitoring/batch-projection/README.md).
</file context>
| useful throughput, GPU duty and the cost ledger still gate cohort expansion. | ||
| The scaler sizes on the **higher of two signals**: admissible-ready backlog | ||
| (`targetQueuedUnitsPerWorker=41`) and fleet `worker_flight` wall seconds per | ||
| second (`targetChainBusyPerWorker=0.56`). The adapter deduplicates the two scrape |
There was a problem hiding this comment.
P2: This target equals the measured per-worker capacity ceiling, so it provides no modeled occupancy headroom before queueing; the replay’s zero-starvation result should not read like a production safety margin. State explicitly that 0.56 is a boundary target with no modeled headroom and retain the throughput/headroom gate before applying it.
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/docs/batch-pipeline-worker.md, line 318:
<comment>This target equals the measured per-worker capacity ceiling, so it provides no modeled occupancy headroom before queueing; the replay’s zero-starvation result should not read like a production safety margin. State explicitly that 0.56 is a boundary target with no modeled headroom and retain the throughput/headroom gate before applying it.</comment>
<file context>
@@ -313,44 +313,42 @@ maximum (3 -> 16) in the same reviewed
-useful throughput, GPU duty and the cost ledger still gate cohort expansion.
+The scaler sizes on the **higher of two signals**: admissible-ready backlog
+(`targetQueuedUnitsPerWorker=41`) and fleet `worker_flight` wall seconds per
+second (`targetChainBusyPerWorker=0.56`). The adapter deduplicates the two scrape
+jobs per pod and sums their 10m rates. Ready backlog protects claim-bound work;
+chain occupancy protects healthy drains with little ready backlog. The timer
</file context>
| second (`targetChainBusyPerWorker=0.56`). The adapter deduplicates the two scrape | |
| second (`targetChainBusyPerWorker=0.56`, the older replay's measured per-worker capacity boundary with no modeled headroom). The adapter deduplicates the two scrape |
…edHardware#24499) and drain coverage fix (BasedHardware#24503)
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:
e419fccd85ef19b6c3db51d3bd893215e06f402donlane/hpa-retune-v2,from
origin/mainat9b6a20abbb9c01de3e936ca33b49546dfe171b9a.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.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_flightis 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:
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 reviewpassed after clarifying the rollback floor. No production, cluster, or GCP
access was used.
Lead apply steps (staged at current volume only):
volume. Before streaming retirement doubles batch volume, decide whether to
qualify
maxReplicasabove 16. This PR does not change that ceiling.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.
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.pycompares separately captured live rules, it does not fetch them.
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):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:
OMI_PR_BODY_FILE=$PWD/PR_BODY.md nice make preflightPASS: 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