Skip to content

deploy: preserve live Cloud Run maxScale for sync/backfill - #21959

Merged
Git-on-my-level merged 2 commits into
mainfrom
lane/durable-run-caps
Oct 17, 2026
Merged

Git-on-my-level merged 2 commits into
mainfrom
lane/durable-run-caps

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

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:

  • Serial targeted tests (nice -n 19, one backend test worker): 50 cap/queue tests and 45 two-lane tests passed, no skips.
  • Tests execute the real resolver and queue shell with fake gcloud, including queue create/update, live 8→48, 16→90, 40→90, the 500 boundary, and 40-/400-digit oversized-cap fallback.
  • Normal pre-push source checks, typecheck, and selected workflow tests run without skip flags; see GitHub for current CI status.

Product invariants affected

none

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-17T02:38:31.953424Z 9c20e86 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +197 to +198
--max-instances=${{ steps.live-max-scale.outputs.max_scale }}
--max=${{ steps.live-max-scale.outputs.max_scale }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +733 to +735
# Bound digits before shell arithmetic; oversized annotations use the fresh-service default.
| if length > 3 then "50"
elif tonumber > 500 then "50" else . end')"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment on lines 203 to +205
--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 }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@Git-on-my-level
Git-on-my-level merged commit b293e54 into main Oct 17, 2026
60 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/durable-run-caps branch October 17, 2026 02:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant