Repository navigation
deploy: preserve live Cloud Run maxScale for sync/backfill - #21959
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: 79b1e684d0
ℹ️ 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".
| --max-instances=${{ steps.live-max-scale.outputs.max_scale }} | ||
| --max=${{ steps.live-max-scale.outputs.max_scale }} |
There was a problem hiding this comment.
Keep backfill dispatch concurrency within the preserved cap
When the live cap is below 15 instances—including the stated production value of 8—this deploy creates only cap × 6 request slots (48 at cap 8), but the subsequent Provision sync-backfill lane call still reconciles the queue to 90 concurrent dispatches. Google documents that --max-concurrent-dispatches is the number of tasks allowed to run simultaneously and that, once every Cloud Run instance is busy, an inbound request fails if no capacity becomes available within 30 seconds (Cloud Tasks limits, Cloud Run capacity behavior); long backfill requests therefore recreate the dispatch-abort/retry backlog that the comments at lines 241–248 say this bound must prevent. Either derive the queue limit from the preserved cap or reject caps whose six-request capacity is below 90.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9c20e865db
ℹ️ 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".
| # Bound digits before shell arithmetic; oversized annotations use the fresh-service default. | ||
| | if length > 3 then "50" | ||
| elif tonumber > 500 then "50" else . end')" |
There was a problem hiding this comment.
Preserve valid live caps above 500
When an operator has configured a live cap above 500, this branch silently replaces it with 50 instead of preserving it; the backfill resolver applies the same substitution with 40. Cloud Run accepts values up to the service's quota-dependent maximum, and Google's own example permits 1,000 instances after accounting for CPU and memory quota (Cloud Run maximum-instance limits), so 501 is not inherently malformed. A subsequent deployment can therefore unexpectedly reduce a valid production scaling cap; reject values that would actually overflow the arithmetic rather than treating every value above 500 as an unset cap.
Useful? React with 👍 / 👎.
| --min-instances=3 | ||
| --max-instances=40 | ||
| --max=40 | ||
| --max-instances=${{ steps.live-max-scale.outputs.max_scale }} | ||
| --max=${{ steps.live-max-scale.outputs.max_scale }} |
There was a problem hiding this comment.
Align the capacity runbook with dynamic caps
Once this flag is derived from the live service, backend/docs/runbooks/sync-backfill-concurrency.md is no longer an accurate operational guide: it still states that this action owns fixed 40-instance revision/service caps and that both queue branches persist 90 concurrent dispatches. For the stated production cap of 8, the action now deploys an 8-instance cap and reconciles only 48 dispatches, so operators following the ramp and rollback instructions can make decisions from the wrong capacity baseline. Update the runbook in the same change to describe the live-cap-derived limits.
Useful? React with 👍 / 👎.
Deploying sync/backfill currently resets runtime scaling caps to 50/40. Resolve each service's live cap immediately before deployment, preferring the service-level ops setting, then a legacy revision cap, and retaining 50/40 when no cap exists. Backfill uses the resolved value for both service and revision limits; sync's revision limit follows the live control.
Backfill queue reconciliation also resolves the live cap in platform/dispatch mode and sets concurrent dispatches to
max(1, min(90, cap * 6))for both create and update. A cap of 8 yields 48 dispatches; caps 16 and 40 yield 90. The 15/second start-rate limit remains because the concurrent-dispatch limit independently bounds in-flight work.The read is scoped to the exact service/project/region. API failures or malformed/non-positive caps stop deployment. Caps above 500 fall back to the service's existing default before shell arithmetic. No workflows or production settings change in this PR.
Validation on the Grok-fix head:
nice -n 19, one backend test worker): 50 cap/queue tests and 45 two-lane tests passed, no skips.Product invariants affected
none