Repository navigation
fix(batch): retry Firestore contention before batch leases expire - #23915
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d8c654ea9c
ℹ️ 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".
| return run_with_transaction_contention_retry( | ||
| lambda: client.transaction(max_attempts=1), | ||
| commit, | ||
| operation_name='batch_pipeline_store', | ||
| ) |
There was a problem hiding this comment.
Keep contention retries within the scheduler lease budget
When a read-time abort or expired transaction consumes more than 120 seconds, this wrapper can retry successfully but issue an already-expired lease: Scheduler._pull_shard captures now before calling the store and every replay writes lease_until=now + LEASE_SECONDS. No retry deadline is scoped by the pump's pull path, so the helper permits multiple long transaction chains, while heartbeats start only after the entire pull returns. Unlike the previous read-time failure path, this can commit a new lease that recovery immediately expires, consuming a worker attempt without usable processing time; earlier leases in the same pull can also expire while waiting. Bound pull retries by the remaining lease budget and refresh the lease timestamp when replaying the transaction.
Useful? React with 👍 / 👎.
Summary
Abortedcontention and expired transaction chains. Each SDK transaction gets one attempt so the outer retry budget stays bounded.BATCH_PIPELINE_CONTENTION_RETRY_ENABLED=falseas the batch worker kill switch.RCA evidence
The read-only census at 17:40Z found 33 of 36 wedges admitted before 16:35Z; 35 were projection obligations and one was in recovery. Sanitized worker logs from 16:30Z–17:40Z contained 504
Aborted, 128ValueError, and 11InvalidArgumentrecords. The logs had no traceback frames, source sites, or messages, so the exact hot document and any poison unit remain unproven. The observer reported audio custody present for 789/789 checked units, and the source/retention contract keeps accepted audio recoverable.Recovery proposal
No production nudge was run. If T3 projection obligations remain after the worker deployment, run the existing OIDC-protected
POST /v2/batch-pipeline/reconcileonbackend-integrationwith{"stage":"prod"}using the configured batch worker service identity. The handler performs the durable reconciliation and projection sweep. Read the observer again for T3 and custody afterward; do not edit individual job documents.Verification
backend/test.shandomi-heavy, undernice -n 19.helm templaterendered the production batch worker chart with a synthetic digest; the new environment value rendered as"true".scripts/check_feature_flag_registry.py: OK.Production deployment remains lead-owned through
gcp_diarizer.yml. This PR does not merge or deploy.Failure-Class: FC-retired-transaction-treated-as-fatal
Owns: #23915