Repository navigation
SCA-5098: decouple held expiry from request paths - #26511
Git-on-my-level merged 5 commits into
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d3db129e26
ℹ️ 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".
| else: | ||
| # Periodic maintenance uses the leader lease; per-unit policy decides follow-ups. | ||
| await service.reconcile_async(periodic=True) | ||
| await service.reconcile_async(periodic=True, run_held_expiry=False) |
There was a problem hiding this comment.
Reserve expiry ownership for hosts that run the supervisor
On a same-stage host with serving and projection-pump loops disabled, this fallback still acquires and renews SERVING_MAINTENANCE through Serving.reconcile(periodic=True), but start_serving_from_env() starts no expiry supervisor there. This configuration is supported by the legacy-metrics tests and the non-serving production roles in backend/deploy/runtime_env.yaml. Since the actual supervisor's sweep_held_dead_letters(periodic=True) checks that same lease, repeated metrics requests reaching the non-serving process within the 60-second TTL can retain ownership indefinitely while neither process expires or redrives held rows. Previously, the lease-holding request performed the tick. Give expiry a supervisor-only lease or otherwise prevent non-supervising hosts from monopolizing its ownership.
Useful? React with 👍 / 👎.
| @router.post('/reconcile', include_in_schema=False) | ||
| async def reconcile(body: WorkerRequest): | ||
| await body.service().reconcile_async(recover_quarantine=True) | ||
| await body.service().reconcile_async(recover_quarantine=True, run_held_expiry=False) |
There was a problem hiding this comment.
Add the required held-expiry pipeline change note
This changes batch-audio maintenance and recovery by removing request-driven held expiry, but the commit adds no pipeline change note. backend/AGENTS.md requires a note under docs/listen_pusher_pipeline/changes/ in the same PR for audio, transcription, or lifecycle changes. Add one documenting supervisor ownership, the required serving configuration, and rollback/verification behavior so operators can discover that explicit reconciliation and legacy metrics requests no longer drive expiry.
AGENTS.md reference: backend/AGENTS.md:L164-L164
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9ceacb71ba
ℹ️ 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".
| @router.post('/reconcile', include_in_schema=False) | ||
| async def reconcile(body: WorkerRequest): | ||
| await body.service().reconcile_async(recover_quarantine=True) | ||
| await body.service().reconcile_async(recover_quarantine=True, run_held_expiry=False) |
There was a problem hiding this comment.
Keep explicit reconciliation off the supervisor lease
On a same-stage host with serving disabled, an authenticated /reconcile now skips expiry but still acquires SERVING_MAINTENANCE through _maintain() -> refresh_fresh_guard(). The new alternate-lease branch only handles periodic=True, whereas this call keeps the default False. Requests repeated within the 60-second TTL can therefore retain ownership indefinitely while the actual supervisor's sweep_held_dead_letters(periodic=True) refuses to tick; unlike before, the request does not expire or redrive those rows either. The owner-only-off recovery path has the same problem. Keep non-supervising request maintenance off the expiry lease, not just legacy metrics requests.
Useful? React with 👍 / 👎.
| if periodic and not run_held_expiry and self.legacy_metrics_leader is not None: | ||
| maintenance_leader = self.legacy_metrics_leader |
There was a problem hiding this comment.
Keep both fresh-guard callers on the same lease
With multiple serving replicas, this branch can give the two fresh-guard callers contradictory ownership decisions: supervise() also passes periodic=True, run_held_expiry=False, so its maintenance now uses the legacy-metrics lease, while _supervise_fresh_guard() still uses SERVING_MAINTENANCE. If different replicas acquire those leases, _maintain() refreshes a sampler that its independent guard loop deactivates, while the other replica's successful guard sample is cleared by its losing reconcile() call. FreshGuard.deactivate() clears the counts without resetting the 60-second refresh deadline, so healthy fresh-delivery counts and ratios disappear between ticks. Distinguish HTTP scrapes explicitly and preserve consistent ownership for both guard callers.
Useful? React with 👍 / 👎.
…96b (SCA-5954) (#26835) Prod Pusher moved from pusher@sha256:fd5fb969… to pusher@sha256:b2e9996b… in the 11-29 #26511 serving roll (SCA-5204). execute() requires the live Deployment image to equal BASELINE before any digest or qualification check, so every preview of a qualified candidate now refuses. Point BASELINE at the image serving now (read 2026-12-01T00:52Z, ro-prod) in the writer, the write detector and the runbook evidence example. Same shape as #26710. Co-authored-by: Claude Opus 5.5 <[email protected]>
Summary
The supervised held-expiry loop remains the sole owner of expiry work. Request-triggered reconciliation retains its other maintenance while skipping the expiry tick inline, including
/recover-quarantinewhen the owner-only recovery switch is disabled.Changes
/reconcile, fallback/metrics, and/recover-quarantineexplicitly opt out of inline held-expiry work.Cadence and cost
serving_tick_seconds()is clamped to 10–60 seconds; the checked-in production configuration sets 10 seconds. When enabled, the loop attempts one maintenance-lease acquisition per serving instance per tick. At 10 seconds, that is an upper bound of 6 lease transactions per minute (360 per hour) per instance. Only the lease holder performs the expiry cursor read, up to 6 per minute. At 60 seconds, each rate is 1 per minute. These are configuration-derived upper bounds; work time can lower the frequency, and no production measurements were taken.Verification on current head
Head:
01ea31ea943ab748de3fc221d2a34db3c66c5150./reconcileand owner-only-off/recover-quarantinemaintenance use the separate lease when they skip inline held expiry; the supervisor retainsserving_maintenance.omi-heavy:tests/unit/test_batch_pipeline_serving.py,test_batch_pipeline_quarantine_recovery.py,test_batch_pipeline_recovery_owner_only.py,test_batch_pipeline_fresh_guard.py,test_batch_pipeline_leader.py, andtest_revision_drain_harness.py.Earlier verification receipts
Earlier receipt — gates ran on d3db129
_maintainreceivedrun_held_expiry=True; it now assertsFalseand passes.BACKEND_PYTEST_WORKERS=1 bash test.sh tests/unit/test_batch_pipeline_serving.py tests/unit/test_batch_pipeline_quarantine_recovery.py tests/unit/test_batch_pipeline_recovery_owner_only.py tests/unit/test_revision_drain_harness.py— 261 passed under Python 3.11.15.mainat1628d27cbb5484d0aec8ee178074bbf89224bf83, including its selected backend tests and formatting checks.Earlier receipt — gates ran on 3abfab4
Product invariants affected
none
Failure class
Failure-Class: FC-observer-cadence-coupled-to-maintenance
Reviewer focus
Confirm the dedicated loop remains the only held-expiry driver when
BATCH_PIPELINE_RECOVERY_OWNER_ONLY_ENABLEDis off, while request paths preserve their other reconciliation work.