Repository navigation
Autoscale CPU record seal workers with fenced claims - #24491
Conversation
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.
1 issue found across 25 files
Confidence score: 4/5
test_record_seal_sweeper_deploy.pydoes not check that the new worker resources are disabled with all repair paths off, so the kill-switch test could miss them remaining deployed. Assert therecord-seal-workerDeployment, HPA, and PodMonitoring are absent.
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/tests/unit/test_record_seal_sweeper_deploy.py">
<violation number="1" location="backend/tests/unit/test_record_seal_sweeper_deploy.py:74">
P2: The new worker flag is not covered by this kill-switch assertion. Also assert that the `record-seal-worker` Deployment, HPA, and PodMonitoring are absent when all repair paths are disabled.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
| def test_chart_kill_switch_removes_job_and_rbac_and_plan_mode_is_explicit(): | ||
| result = render('--set', 'recordSealSweeper.enabled=false,recordSealRepair.enabled=false') | ||
| result = render( | ||
| '--set', 'recordSealSweeper.enabled=false,recordSealRepair.enabled=false,recordSealWorker.enabled=false' |
There was a problem hiding this comment.
P2: The new worker flag is not covered by this kill-switch assertion. Also assert that the record-seal-worker Deployment, HPA, and PodMonitoring are absent when all repair paths are disabled.
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_record_seal_sweeper_deploy.py, line 74:
<comment>The new worker flag is not covered by this kill-switch assertion. Also assert that the `record-seal-worker` Deployment, HPA, and PodMonitoring are absent when all repair paths are disabled.</comment>
<file context>
@@ -70,7 +70,9 @@ def test_ship_on_cpu_cron_reuses_worker_identity_and_image():
def test_chart_kill_switch_removes_job_and_rbac_and_plan_mode_is_explicit():
- result = render('--set', 'recordSealSweeper.enabled=false,recordSealRepair.enabled=false')
+ result = render(
+ '--set', 'recordSealSweeper.enabled=false,recordSealRepair.enabled=false,recordSealWorker.enabled=false'
+ )
assert result.returncode == 0
</file context>
An absent or invalid serverFlags map left the pod Ready while every startup attempt failed. Validate runtime and policy before /metrics, and exit nonzero so the Deployment shows a crash loop instead. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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: trueand move the sweeper to hourly, matching its alert alignmentand 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 preflightpassed all 43 selected checks. The updated hourly-sweeper alertcontract 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):
qualify CPU placement, long-row memory and forced-death reclaim in staging.
recordSealRepair.suspend=falseoverride forone evening peak. Shared canonical apply rechecks make cron overlap safe.
preserving privacy/upload/proof refusals. No redrive is included in this PR.
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=falseandrecordSealRepair.suspend=falsein 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_ENABLEDin their own pods and children;recordSealWorker.runtimeEnabledcontrols that independently of the retainedcron's runtime flag. No additional runtime flag or flag-budget exception.