← Back to Pull requests

fix(infrastructure): retry region infra deploy on transient Cosmos RequestTimeout (ARO-30635) #8330

Open
moisescassidy opened this pull request with 190 lines diff across 5 files
View on GitHub
moisescassidy moisescassidy commented on Nov 30, 2026 17:55 UTC
Author

Summary

The regional/infra step in the region pipeline deploys region.bicep, which provisions the RP's Cosmos DB account through the rp-cosmos-account module. Occasionally Azure's Cosmos control plane gives up creating the account server-side (~6.5 minutes in) and ARM reports the deployment as terminally failed. That failure arrives as an HTTP 200 whose body says status: Failed with a nested RequestTimeout code — so no transport-level retry policy can act on it, and re-polling returns the same terminal result. The only recovery is re-submitting the deployment, which the step-level automatedRetry loop already does; its token list just didn't match this error, so the whole e2e provision went red.

This adds "RequestTimeout" and "exceeded maximum alloted time" to the infra step's errorContainsAny, and locks the tokens to real captured error text with tests.

Why now: 16 failed provisions across three DEV CI jobs between 2026-10-29 and 2026-11-12 (e2e-parallel ×12, healthcheck-provision-canadacentral ×3, healthcheck-provision-centralus ×1). None retried — no token matched. There has been no occurrence since 2026-11-12 (the trigger is transient Cosmos control-plane behavior, clustered on a few canadacentral backends), so this is insurance against recurrence rather than an active fire: landing it costs two YAML lines, not landing it costs a full red provision every time the Azure issue returns.

Changes

dev-infrastructure/region-pipeline.yaml (CI/CD pipeline configuration — called out explicitly per PR standards): two new errorContainsAny tokens on regional/infra, plus a comment explaining why. maximumRetryCount: 4 and durationBetweenRetries: 2m are untouched.

tooling/templatize/pkg/pipeline/region_infra_retry_test.go + testdata/:

  • TestRegionInfraAutomatedRetryConfig loads the real region-pipeline.yaml, finds the regional/infra step, and asserts the retry config (4 attempts, 2m, both tokens present).

  • TestShouldRetryErrorRegionInfraARO30635 runs real error strings captured from CI through the real shouldRetryError against that real step config: the Cosmos RequestTimeout from build 2118429933473632256 → retries; a stack BadRequest validation failure and a stack 409 non-terminal-state conflict (both from real runs) → no retry. Fixtures are synthetic mirrors of the captured errors — every identifier and host replaced with synthetic or reserved-example values, preserving the nesting, codes and casing the retry decision depends on. If ARM rewords the error or a refactor drops the tokens, these tests fail instead of the retry silently disappearing.
  • Operational contract

  • Retry budget unchanged: 4 total attempts, 2 minutes apart — but the whole retry sequence shares the pipeline's 30-minute step deadline, a sanity cap that ARM steps cannot override. A transient timeout recovers after one 2-minute wait. At ~6.5 minutes per timeout attempt, three attempts complete inside the deadline and the fourth is cut short (worst case ~30 minutes, vs ~6.5 minutes today); the fast-failing InternalServerError class still gets all four attempts, well inside the deadline. If the deadline cuts the final attempt, the step's terminal error is the step timeout rather than the underlying ARM error — each attempt's own error is still logged before it. The job timeout is 8h.

  • Each retry deploys under a fresh deployment name on the ARM path, so it never lands on the failed deployment.

  • Matching is a case-sensitive substring match (strings.Contains); the fixtures pin the exact casing ARM emits.

  • Production environments: this repository's pipelines are also consumed by the production deployment process. Whether that process honors this retry configuration — including its token matching — is unverified here; propagating the change to production is a separate rollout task outside this PR (see the repository documentation for that process).
  • Security

    Reviewed from a security perspective — no findings. Properties worth recording:

  • The two new errorContainsAny tokens are inert string literals: shouldRetryError compares each token against ARM-returned error text with a case-sensitive strings.Contains and uses the result only as a boolean retry decision. Tokens are never compiled to regex, interpolated, or executed, so matched error text cannot alter pipeline behavior beyond the retry itself.

  • A retry re-submits the same declarative ARM deployment — same identity, same template, same parameters, fresh deployment name — bounded by the unchanged 4-attempt / 2-minute budget inside the 30-minute step deadline. Worst case is bounded re-submission, not a security primitive.

  • The fixtures are synthetic mirrors of captured CI errors: zeroed GUIDs, synthetic-* resource names, 2026-01-01 timestamps, and reserved example.com hosts everywhere (including the rntbd:// backend address). No credentials, real identifiers, or internal endpoints; only the nesting, codes and casing the retry decision depends on are preserved.

  • No new log exposure: retry-path errors pass through the existing subscription-ID redaction (redactSubscriptionError) before logging, exactly as final failures already do.
  • Non-goals

  • No Go retry-policy changes: azcore's default retry already covers transport-level 408/429, and the failure here lives inside a 200 body where policies can't see it.

  • No 429 tokens: zero deployment-level 429 failures observed in 1,500 scanned builds.

  • Not fixing the Azure-side trigger (Cosmos control-plane timeouts; correlation IDs, operation IDs and backend hosts for all 16 occurrences are catalogued in ARO-30635 for a support case if wanted).

  • Not retrying other nested RequestTimeout sources more narrowly: the token is intentionally broad, bounded by the 4-attempt budget.
  • Verification

  • go test ./... in tooling/templatize — full module passes, including the new tests.

  • make verify-yamlfmt, make verify-bicep-fixtures, make validate-config-pipelines — pass.

  • golangci-lint on tooling/templatize/pkg/pipeline — 0 issues.

  • Beyond the unit tests, the 16/16 token match and 0/4 negative controls were measured against the real executeNode loop with the real error text (attempt 0 fails → 2-minute wait → fresh deployment attempt succeeds); see ARO-30635.
  • Links

  • Jira: ARO-30635 (Fixes)

  • Supersedes #7976 — the same YAML change, bot-authored and unreviewed since 2026-11-06, rebased here onto current main (post-ARMStack-revert) with the tests added. Please close it in favor of this PR.
  • Suggested reviewers: @geoberle, @stevekuznetsov (OWNERS for both dev-infrastructure/ and tooling/templatize/).

    🤖 Generated with Claude Code

    Diff: 190 lines (+190 / -0) across 5 files Reviewer: moisescassidy Review duration: 3803m
    All Vouch review confidence checks passed
    Residual risk 0.11 = Change Risk (0.77) × (1 − Review Confidence (0.86)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.77 · 190 lines diff across 5 files
    0.77
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.96 · 5 substantive comment(s)
    0.96
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    85%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.314
    Self Review self_review
    0.140
    Sensitive Paths sensitive_paths
    0.077
    Real PR Conversation Timeline
    18 items
    openshift-merge-bot[bot] openshift-merge-bot[bot] commented on Nov 30, 2026 17:55 UTC
    Bot

    Pipeline controller notification

    This PR uses the pipeline controller for second-stage tests. Selection and triggering follow the repository configuration.

    Use /test ? to list jobs and /pipeline help for commands.

    openshift-ci[bot] openshift-ci[bot] commented on Nov 30, 2026 17:55 UTC
    Bot

    [APPROVALNOTIFIER] This PR is NOT APPROVED

    This pull-request has been approved by: <a href="https://github.com/Azure/ARO-HCP/pull/8330#" title="Author self-approved">moisescassidy</a>
    Once this PR has been reviewed and has the lgtm label, please assign stevekuznetsov for approval. For more information see the Code Review Process.

    The full list of commands accepted by this bot can be found here.

    <details open>
    Needs approval from an approver in each of these files:

  • dev-infrastructure/OWNERS

  • tooling/templatize/OWNERS
  • Approvers can indicate their approval by writing /approve in a comment
    Approvers can cancel approval by writing /approve cancel in a comment
    </details>
    <!-- META={"approvers":["stevekuznetsov"]} -->

    openshift-ci[bot] openshift-ci[bot] commented on Nov 30, 2026 17:55 UTC
    Bot

    Hi @moisescassidy. Thanks for your PR.

    I'm waiting for a Azure member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

    Regular contributors should join the org to skip this step.

    Once the patch is verified, the new status will be reflected by the ok-to-test label.

    I understand the commands that are listed here.

    <details>

    Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.
    </details>

    Copilot Copilot commented on code on Nov 30, 2026 18:01 UTC
    Code Review
    tooling/templatize/pkg/pipeline/testdata/aro30635-cosmos-requesttimeout.txt:1
    @@ -0,0 +1,20 @@
    +failed to run ARM step: failed to poll deployment: failed to wait for deployment completion: GET https://management.azure.com/subscriptions/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/resourcegroups/hcp-underlay-ci01-j3632256/providers/Microsoft.Resources/deployments/defc77bd68adc8477fd7cb2a91f96b10aa0a3be1972d667ad59de2a7534a396f/operationStatuses/08584076964031022218
    +--------------------------------------------------------------------------------
    +RESPONSE 200: 200 OK
    +ERROR CODE: DeploymentFailed
    +--------------------------------------------------------------------------------
    +{
    +  "status": "Failed",
    +  "error": {
    +    "code": "DeploymentFailed",
    +    "message": "At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details. Correlation ID: 365e19d5-a4b3-481b-bed6-76c5a8853ec8",
    +    "details": [
    +      {
    +        "code": "Conflict",
    +        "message": "{\r\n  \"status\": \"Failed\",\r\n  \"error\": {\r\n    \"code\": \"ResourceDeploymentFailure\",\r\n    \"message\": \"The resource write operation failed to complete successfully, because it reached terminal provisioning state 'Failed'.\",\r\n    \"details\": [\r\n      {\r\n        \"code\": \"DeploymentFailed\",\r\n        \"target\": \"/subscriptions/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/resourceGroups/hcp-underlay-ci01-j3632256/providers/Microsoft.Resources/deployments/rp-cosmos-account\",\r\n        \"message\": \"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details. Correlation ID: 365e19d5-a4b3-481b-bed6-76c5a8853ec8\",\r\n        \"details\": [\r\n          {\r\n            \"code\": \"ResourceDeploymentFailure\",\r\n            \"target\": \"/subscriptions/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/resourceGroups/hcp-underlay-ci01-j3632256/providers/Microsoft.DocumentDB/databaseAccounts/arohcpci01-rp-j3632256\",\r\n            \"message\": \"The resource write operation failed to complete successfully, because it reached terminal provisioning state 'Failed'.\",\r\n            \"details\": [\r\n              {\r\n                \"code\": \"RequestTimeout\",\r\n                \"message\": \"Database account creation failed. Operation Id: 0f2a8296-0c2e-4f08-9175-c65826effe4a, Error : Message: {\\\"Errors\\\":[\\\"The requested operation exceeded maximum alloted time. Learn more: https://aka.ms/cosmosdb-tsg-service-request-timeout\\\"]}\\r\\nActivityId: 679856c6-32c2-405a-ac0b-785ffbfbf879, Request URI: /apps/769daae8-c2aa-4372-89e4-b35316eefb4f/services/6e578474-148e-4126-8582-33da74cd7b73/partitions/bed2c846-2a06-479c-8664-aa5251e89616/replicas/134376072626305227s, RequestStats: \\r\\nRequestStartTime: 2026-11-05T20:33:42.3146237Z, RequestEndTime: 2026-11-05T20:33:47.4084704Z,  Number of regions attempted:1\\r\\n{\\\"systemHistory\\\":[{\\\"dateUtc\\\":\\\"2026-11-05T20:32:50.8700803Z\\\",\\\"cpu\\\":1.385,\\\"memory\\\":25154004.000,\\\"threadInfo\\\":{\\\"isThreadStarving\\\":\\\"False\\\",\\\"threadWaitIntervalInMs\\\":0.0203,\\\"availableThreads\\\":32764,\\\"minThreads\\\":8,\\\"maxThreads\\\":32767},\\\"numberOfOpenTcpConnection\\\":138},{\\\"dateUtc\\\":\\\"2026-11-05T20:33:00.8724889Z\\\",\\\"cpu\\\":13.667,\\\"memory\\\":25150136.000,\\\"threadInfo\\\":{\\\"isThreadStarving\\\":\\\"False\\\",\\\"threadWaitIntervalInMs\\\":0.0651,\\\"availableThreads\\\":32764,\\\"minThreads\\\":8,\\\"maxThreads\\\":32767},\\\"numberOfOpenTcpConnection\\\":138},{\\\"dateUtc\\\":\\\"2026-11-05T20:33:10.8762502Z\\\",\\\"cpu\\\":1.290,\\\"memory\\\":25156484.000,\\\"threadInfo\\\":{\\\"isThreadStarving\\\":\\\"False\\\",\\\"threadWaitIntervalInMs\\\":0.0476,\\\"availableThreads\\\":32765,\\\"minThreads\\\":8,\\\"maxThreads\\\":32767},\\\"numberOfOpenTcpConnection\\\":138},{\\\"dateUtc\\\":\\\"2026-11-05T20:33:20.8919959Z\\\",\\\"cpu\\\":1.521,\\\"memory\\\":25159088.000,\\\"threadInfo\\\":{\\\"isThreadStarving\\\":\\\"False\\\",\\\"threadWaitIntervalInMs\\\":0.1088,\\\"availableThreads\\\":32765,\\\"minThreads\\\":8,\\\"maxThreads\\\":32767},\\\"numberOfOpenTcpConnection\\\":138},{\\\"dateUtc\\\":\\\"2026-11-05T20:33:30.9077718Z\\\",\\\"cpu\\\":3.899,\\\"memory\\\":25148500.000,\\\"threadInfo\\\":{\\\"isThreadStarving\\\":\\\"False\\\",\\\"threadWaitIntervalInMs\\\":0.0638,\\\"availableThreads\\\":32764,\\\"minThreads\\\":8,\\\"maxThreads\\\":32767},\\\"numberOfOpenTcpConnection\\\":138},{\\\"dateUtc\\\":\\\"2026-11-05T20:33:40.9083820Z\\\",\\\"cpu\\\":5.863,\\\"memory\\\":25212784.000,\\\"threadInfo\\\":{\\\"isThreadStarving\\\":\\\"False\\\",\\\"threadWaitIntervalInMs\\\":0.0604,\\\"availableThreads\\\":32765,\\\"minThreads\\\":8,\\\"maxThreads\\\":32767},\\\"numberOfOpenTcpConnection\\\":138}]}\\r\\nRequestStart: 2026-11-05T20:33:42.3146237Z; ResponseTime: 2026-11-05T20:33:47.4084704Z; StoreResult: StorePhysicalAddress: rntbd://cdb-ms-prod-canadacentral1-be156.documents.azure.com:11010/apps/769daae8-c2aa-4372-89e4-b35316eefb4f/services/6e578474-148e-4126-8582-33da74cd7b73/partitions/bed2c846-2a06-479c-8664-aa5251e89616/replicas/134376072626305227s, LSN: -1, GlobalCommittedLsn: -1, PartitionKeyRangeId: , IsValid: False, StatusCode: 408, SubStatusCode: 0, RequestCharge: 0, ItemLSN: -1, SessionToken: , UsingLocalLSN: False, TransportException: null, BELatencyMs: 5085.183, ActivityId: 679856c6-32c2-405a-ac0b-785ffbfbf879, RetryAfterInMs: , globalNRegionCommittedGLSN: -1, ReplicaHealthStatuses: [(port: 11010 | status: Connected | lkt: 11/5/2026 8:33:47 PM)], TransportRequestTimeline: {\\\"requestTimeline\\\":[{\\\"event\\\": \\\"Created\\\", \\\"startTimeUtc\\\": \\\"2026-11-05T20:33:42.3146237Z\\\", \\\"durationInMs\\\": 0.0025},{\\\"event\\\": \\\"ChannelAcquisitionStarted\\\", \\\"startTimeUtc\\\": \\\"2026-11-05T20:33:42.3146262Z\\\", \\\"durationInMs\\\": 0.0105},{\\\"event\\\": \\\"Pipelined\\\", \\\"startTimeUtc\\\": \\\"2026-11-05T20:33:42.3146367Z\\\", \\\"durationInMs\\\": 0.1449},{\\\"event\\\": \\\"Transit Time\\\", \\\"startTimeUtc\\\": \\\"2026-11-05T20:33:42.3147816Z\\\", \\\"durationInMs\\\": 5086.2527},{\\\"event\\\": \\\"Received\\\", \\\"startTimeUtc\\\": \\\"2026-11-05T20:33:47.4010343Z\\\", \\\"durationInMs\\\": 0.1243},{\\\"event\\\": \\\"Completed\\\", \\\"startTimeUtc\\\": \\\"2026-11-05T20:33:47.4011586Z\\\", \\\"durationInMs\\\": 0}],\\\"serviceEndpointStats\\\":{\\\"inflightRequests\\\":1,\\\"openConnections\\\":1},\\\"connectionStats\\\":{\\\"waitforConnectionInit\\\":\\\"False\\\",\\\"callsPendingReceive\\\":0,\\\"lastSendAttempt\\\":\\\"2026-11-05T20:31:29.0652717Z\\\",\\\"lastSend\\\":\\\"2026-11-05T20:31:29.0652717Z\\\",\\\"lastReceive\\\":\\\"2026-11-05T20:31:29.0964806Z\\\"},\\\"requestSizeInBytes\\\":875,\\\"responseMetadataSizeInBytes\\\":30,\\\"responseBodySizeInBytes\\\":133};\\r\\n ResourceType: Replica, OperationType: ForceConfigRefresh\\r\\n, SDK: Microsoft.Azure.Documents.Common/2.14.0, Microsoft.Azure.Documents.Common/2.14.0, Microsoft.Azure.Documents.Common/2.14.0, Microsoft.Azure.Documents.Common/2.14.0, Microsoft.Azure.Documents.Common/2.14.0, Microsoft.Azure.Documents.Common/2.14.0, Microsoft.Azure.Documents.Common/2.14.0, Microsoft.Azure.Documents.Common/2.14.0, Microsoft.Azure.Documents.Common/2.14.0, Microsoft.Azure.Documents.Common/2.14.0\"\r\n              }\r\n            ]\r\n          }\r\n        ]\r\n      }\r\n    ]\r\n  }\r\n}"

    Blocking: the captures retain prohibited service URLs, and this fixture also exposes a production Cosmos backend address and topology diagnostics. Sanitize this fixture and line 1 of aro30635-stack-badrequest-rulescount.txt and aro30635-stack-conflict-409-nonterminal.txt, using reserved example hosts and removing backend diagnostics without changing the retry tokens or error nesting. Rewrite the introducing commits so the original captures do not remain in history.

    Copilot Copilot commented on code on Nov 30, 2026 18:01 UTC
    Code Review
    dev-infrastructure/region-pipeline.yaml:1
    @@ -340,12 +340,20 @@ resourceGroups:
         # first-time region rollout this can also fail with the ARM RP
         # propagation-lag variants seen elsewhere in this repo (e.g. shortly after
         # rpRegistration completes for a brand new subscription). See AROSLSRE-1708.
    +    # RequestTimeout matches transient Azure-side resource creation timeouts

    Blocking: the PR description's Operational contract discusses an internal Microsoft rollout system and its retry rendering. Please have that disclosure reviewed and replace it with a neutral statement about the separate production rollout dependency. If the same information is in commit messages, replace those commits rather than leaving it in history.

    copilot-pull-request-reviewer[bot] copilot-pull-request-reviewer[bot] commented on Nov 30, 2026 18:01 UTC
    Reviewer

    <!-- ccr-overview-v2 -->

    🟡 Changes recommended

    Captured fixtures expose prohibited service URLs and production backend diagnostics that require sanitization and history cleanup, while internal rollout details in the PR description need disclosure review.

    <details open>
    <summary><strong>2 open issues</strong></summary>

  • <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/high-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/high-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/high-v2-light.png" alt="High severity" width="62" height="18" align="texttop"></picture> Sanitize captured service URLs and backend diagnostics from fixtures and history · New

  • <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-light.png" alt="Low severity" width="62" height="18" align="texttop"></picture> Remove internal rollout details from the PR description and commit history · New

  • </details>

    <details>
    <summary><strong>What changed in this PR</strong></summary>

    Extends the regional infrastructure pipeline’s existing retries to recover from transient Cosmos DB provisioning timeouts (ARO-30635), building on #7976 with regression coverage.

    Changes:

  • Adds timeout-code and message matching without changing the configured attempt limit or retry delay.

  • Adds tests against the real pipeline configuration and captured errors, covering the timeout and two non-retry cases.
  • | File | Description |
    | ---- | ----------- |
    | dev-infrastructure/​region-pipeline.yaml | Adds two timeout retry tokens and explains deployment resubmission. |
    | tooling/​templatize/​pkg/​pipeline/​region_infra_retry_test.go | Checks retry configuration and fixture-based error classification. |
    | tooling/​templatize/​pkg/​pipeline/​testdata/​aro30635-cosmos-requesttimeout.txt | Supplies the nested Cosmos timeout positive case. |
    | tooling/​templatize/​pkg/​pipeline/​testdata/​aro30635-stack-badrequest-rulescount.txt | Supplies a validation-failure negative case. |
    | tooling/​templatize/​pkg/​pipeline/​testdata/​aro30635-stack-conflict-409-nonterminal.txt | Supplies a deployment-stack conflict negative case. |
    </details>

    <sub>Review effort: Balanced</sub>

    moisescassidy moisescassidy commented on code on Nov 30, 2026 20:52 UTC
    Code Review
    tooling/templatize/pkg/pipeline/testdata/aro30635-cosmos-requesttimeout.txt:1
    @@ -0,0 +1,20 @@
    +failed to run ARM step: failed to poll deployment: failed to wait for deployment completion: GET https://management.azure.com/subscriptions/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/resourcegroups/hcp-underlay-ci01-j3632256/providers/Microsoft.Resources/deployments/defc77bd68adc8477fd7cb2a91f96b10aa0a3be1972d667ad59de2a7534a396f/operationStatuses/08584076964031022218
    +--------------------------------------------------------------------------------
    +RESPONSE 200: 200 OK
    +ERROR CODE: DeploymentFailed
    +--------------------------------------------------------------------------------
    +{
    +  "status": "Failed",
    +  "error": {
    +    "code": "DeploymentFailed",
    +    "message": "At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details. Correlation ID: 365e19d5-a4b3-481b-bed6-76c5a8853ec8",
    +    "details": [
    +      {
    +        "code": "Conflict",
    +        "message": "{\r\n  \"status\": \"Failed\",\r\n  \"error\": {\r\n    \"code\": \"ResourceDeploymentFailure\",\r\n    \"message\": \"The resource write operation failed to complete successfully, because it reached terminal provisioning state 'Failed'.\",\r\n    \"details\": [\r\n      {\r\n        \"code\": \"DeploymentFailed\",\r\n        \"target\": \"/subscriptions/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/resourceGroups/hcp-underlay-ci01-j3632256/providers/Microsoft.Resources/deployments/rp-cosmos-account\",\r\n        \"message\": \"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details. Correlation ID: 365e19d5-a4b3-481b-bed6-76c5a8853ec8\",\r\n        \"details\": [\r\n          {\r\n            \"code\": \"ResourceDeploymentFailure\",\r\n            \"target\": \"/subscriptions/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/resourceGroups/hcp-underlay-ci01-j3632256/providers/Microsoft.DocumentDB/databaseAccounts/arohcpci01-rp-j3632256\",\r\n            \"message\": \"The resource write operation failed to complete successfully, because it reached terminal provisioning state 'Failed'.\",\r\n            \"details\": [\r\n              {\r\n                \"code\": \"RequestTimeout\",\r\n                \"message\": \"Database account creation failed. Operation Id: 0f2a8296-0c2e-4f08-9175-c65826effe4a, Error : Message: {\\\"Errors\\\":[\\\"The requested operation exceeded maximum alloted time. Learn more: https://aka.ms/cosmosdb-tsg-service-request-timeout\\\"]}\\r\\nActivityId: 679856c6-32c2-405a-ac0b-785ffbfbf879, Request URI: /apps/769daae8-c2aa-4372-89e4-b35316eefb4f/services/6e578474-148e-4126-8582-33da74cd7b73/partitions/bed2c846-2a06-479c-8664-aa5251e89616/replicas/134376072626305227s, RequestStats: \\r\\nRequestStartTime: 2026-11-05T20:33:42.3146237Z, RequestEndTime: 2026-11-05T20:33:47.4084704Z,  Number of regions attempted:1\\r\\n{\\\"systemHistory\\\":[{\\\"dateUtc\\\":\\\"2026-11-05T20:32:50.8700803Z\\\",\\\"cpu\\\":1.385,\\\"memory\\\":25154004.000,\\\"threadInfo\\\":{\\\"isThreadStarving\\\":\\\"False\\\",\\\"threadWaitIntervalInMs\\\":0.0203,\\\"availableThreads\\\":32764,\\\"minThreads\\\":8,\\\"maxThreads\\\":32767},\\\"numberOfOpenTcpConnection\\\":138},{\\\"dateUtc\\\":\\\"2026-11-05T20:33:00.8724889Z\\\",\\\"cpu\\\":13.667,\\\"memory\\\":25150136.000,\\\"threadInfo\\\":{\\\"isThreadStarving\\\":\\\"False\\\",\\\"threadWaitIntervalInMs\\\":0.0651,\\\"availableThreads\\\":32764,\\\"minThreads\\\":8,\\\"maxThreads\\\":32767},\\\"numberOfOpenTcpConnection\\\":138},{\\\"dateUtc\\\":\\\"2026-11-05T20:33:10.8762502Z\\\",\\\"cpu\\\":1.290,\\\"memory\\\":25156484.000,\\\"threadInfo\\\":{\\\"isThreadStarving\\\":\\\"False\\\",\\\"threadWaitIntervalInMs\\\":0.0476,\\\"availableThreads\\\":32765,\\\"minThreads\\\":8,\\\"maxThreads\\\":32767},\\\"numberOfOpenTcpConnection\\\":138},{\\\"dateUtc\\\":\\\"2026-11-05T20:33:20.8919959Z\\\",\\\"cpu\\\":1.521,\\\"memory\\\":25159088.000,\\\"threadInfo\\\":{\\\"isThreadStarving\\\":\\\"False\\\",\\\"threadWaitIntervalInMs\\\":0.1088,\\\"availableThreads\\\":32765,\\\"minThreads\\\":8,\\\"maxThreads\\\":32767},\\\"numberOfOpenTcpConnection\\\":138},{\\\"dateUtc\\\":\\\"2026-11-05T20:33:30.9077718Z\\\",\\\"cpu\\\":3.899,\\\"memory\\\":25148500.000,\\\"threadInfo\\\":{\\\"isThreadStarving\\\":\\\"False\\\",\\\"threadWaitIntervalInMs\\\":0.0638,\\\"availableThreads\\\":32764,\\\"minThreads\\\":8,\\\"maxThreads\\\":32767},\\\"numberOfOpenTcpConnection\\\":138},{\\\"dateUtc\\\":\\\"2026-11-05T20:33:40.9083820Z\\\",\\\"cpu\\\":5.863,\\\"memory\\\":25212784.000,\\\"threadInfo\\\":{\\\"isThreadStarving\\\":\\\"False\\\",\\\"threadWaitIntervalInMs\\\":0.0604,\\\"availableThreads\\\":32765,\\\"minThreads\\\":8,\\\"maxThreads\\\":32767},\\\"numberOfOpenTcpConnection\\\":138}]}\\r\\nRequestStart: 2026-11-05T20:33:42.3146237Z; ResponseTime: 2026-11-05T20:33:47.4084704Z; StoreResult: StorePhysicalAddress: rntbd://cdb-ms-prod-canadacentral1-be156.documents.azure.com:11010/apps/769daae8-c2aa-4372-89e4-b35316eefb4f/services/6e578474-148e-4126-8582-33da74cd7b73/partitions/bed2c846-2a06-479c-8664-aa5251e89616/replicas/134376072626305227s, LSN: -1, GlobalCommittedLsn: -1, PartitionKeyRangeId: , IsValid: False, StatusCode: 408, SubStatusCode: 0, RequestCharge: 0, ItemLSN: -1, SessionToken: , UsingLocalLSN: False, TransportException: null, BELatencyMs: 5085.183, ActivityId: 679856c6-32c2-405a-ac0b-785ffbfbf879, RetryAfterInMs: , globalNRegionCommittedGLSN: -1, ReplicaHealthStatuses: [(port: 11010 | status: Connected | lkt: 11/5/2026 8:33:47 PM)], TransportRequestTimeline: {\\\"requestTimeline\\\":[{\\\"event\\\": \\\"Created\\\", \\\"startTimeUtc\\\": \\\"2026-11-05T20:33:42.3146237Z\\\", \\\"durationInMs\\\": 0.0025},{\\\"event\\\": \\\"ChannelAcquisitionStarted\\\", \\\"startTimeUtc\\\": \\\"2026-11-05T20:33:42.3146262Z\\\", \\\"durationInMs\\\": 0.0105},{\\\"event\\\": \\\"Pipelined\\\", \\\"startTimeUtc\\\": \\\"2026-11-05T20:33:42.3146367Z\\\", \\\"durationInMs\\\": 0.1449},{\\\"event\\\": \\\"Transit Time\\\", \\\"startTimeUtc\\\": \\\"2026-11-05T20:33:42.3147816Z\\\", \\\"durationInMs\\\": 5086.2527},{\\\"event\\\": \\\"Received\\\", \\\"startTimeUtc\\\": \\\"2026-11-05T20:33:47.4010343Z\\\", \\\"durationInMs\\\": 0.1243},{\\\"event\\\": \\\"Completed\\\", \\\"startTimeUtc\\\": \\\"2026-11-05T20:33:47.4011586Z\\\", \\\"durationInMs\\\": 0}],\\\"serviceEndpointStats\\\":{\\\"inflightRequests\\\":1,\\\"openConnections\\\":1},\\\"connectionStats\\\":{\\\"waitforConnectionInit\\\":\\\"False\\\",\\\"callsPendingReceive\\\":0,\\\"lastSendAttempt\\\":\\\"2026-11-05T20:31:29.0652717Z\\\",\\\"lastSend\\\":\\\"2026-11-05T20:31:29.0652717Z\\\",\\\"lastReceive\\\":\\\"2026-11-05T20:31:29.0964806Z\\\"},\\\"requestSizeInBytes\\\":875,\\\"responseMetadataSizeInBytes\\\":30,\\\"responseBodySizeInBytes\\\":133};\\r\\n ResourceType: Replica, OperationType: ForceConfigRefresh\\r\\n, SDK: Microsoft.Azure.Documents.Common/2.14.0, Microsoft.Azure.Documents.Common/2.14.0, Microsoft.Azure.Documents.Common/2.14.0, Microsoft.Azure.Documents.Common/2.14.0, Microsoft.Azure.Documents.Common/2.14.0, Microsoft.Azure.Documents.Common/2.14.0, Microsoft.Azure.Documents.Common/2.14.0, Microsoft.Azure.Documents.Common/2.14.0, Microsoft.Azure.Documents.Common/2.14.0, Microsoft.Azure.Documents.Common/2.14.0\"\r\n              }\r\n            ]\r\n          }\r\n        ]\r\n      }\r\n    ]\r\n  }\r\n}"

    Fixed. All three fixtures are now synthetic mirrors of the captured errors, and the introducing commit was amended and force-pushed, so the original captures are not in the branch history.

    What changed in the fixtures:

  • management.azure.com → management.example.com; the Cosmos backend address → rntbd://cosmos-backend.example.com:11010 (reserved example hosts)

  • subscription, resource-group, deployment, stack and Cosmos-account identifiers; correlation/operation/activity IDs; replica paths; and timestamps → synthetic values

  • the Cosmos backend diagnostics span (systemHistory, transport request timeline, replica health statuses) is elided entirely, keeping the same escape level and the diagnostic's cut-off tail so the rendering shape is unchanged
  • What is preserved exactly is what the retry decision depends on: the azcore rendering (failed to run ARM step: failed to poll deployment: …, RESPONSE 200, ERROR CODE: DeploymentFailed), the nesting chain DeploymentFailed → Conflict{ResourceDeploymentFailure → DeploymentFailed(rp-cosmos-account) → ResourceDeploymentFailure → RequestTimeout}, and the token text itself. The tests still pass and golangci-lint is clean on the package.

    moisescassidy moisescassidy commented on code on Nov 30, 2026 20:52 UTC
    Code Review
    dev-infrastructure/region-pipeline.yaml:1
    @@ -340,12 +340,20 @@ resourceGroups:
         # first-time region rollout this can also fail with the ARM RP
         # propagation-lag variants seen elsewhere in this repo (e.g. shortly after
         # rpRegistration completes for a brand new subscription). See AROSLSRE-1708.
    +    # RequestTimeout matches transient Azure-side resource creation timeouts

    Fixed. The operational-contract bullet no longer names the rollout system or links its documentation; it now states neutrally that production rollout is a separate process outside this PR and points at the repository documentation. The PR description is updated in place.

    For the record: the specifics that were there are already public in this repository — CLAUDE.md and the CI-integration doc under docs/ci/ both describe the rollout system and the pipelines repo it flows through — so nothing non-public was disclosed. Flagging it for review was still correct per the review policy, and the description is cleaner without it.

    The commit messages never contained this information, so no history change was needed for this finding (the force-push in the other thread is for the fixture sanitization only).

    Copilot Copilot commented on code on Nov 30, 2026 20:56 UTC
    Code Review
    dev-infrastructure/region-pipeline.yaml:1
    @@ -340,12 +340,20 @@ resourceGroups:
         # first-time region rollout this can also fail with the ARM RP
         # propagation-lag variants seen elsewhere in this repo (e.g. shortly after
         # rpRegistration completes for a brand new subscription). See AROSLSRE-1708.
    +    # RequestTimeout matches transient Azure-side resource creation timeouts
    +    # (e.g. Cosmos DB account creation via the rp-cosmos-account module,
    +    # ARO-30635). ARM reports those as a terminal DeploymentFailed with the
    +    # nested RequestTimeout code inside an otherwise-200 response, so no
    +    # transport-level retry policy can act on them; only re-submitting the
    +    # deployment can recover, which is what this step-level retry does.
         automatedRetry:
           errorContainsAny:
           - "Internal error"
           - "InternalServerError"
           - "Internal server error"
           - "500 Internal Server Error"
    +      - "RequestTimeout"
    +      - "exceeded maximum alloted time"

    The PR description's operational contract promises up to ~34 minutes for four timeout failures, but RunPipeline wraps the entire retry loop in a 30-minute step deadline (run.go:730–740), and ARM steps cannot override it (stepContextTimeout). With 6.5-minute failures and 2-minute waits, the fourth attempt starts at 25.5 minutes and is cancelled before its expected completion at 32 minutes; the 8-hour job timeout does not extend this deadline. Please correct the operational contract to describe the shared 30-minute cap, or explicitly address the step deadline if four full attempts are required.

    copilot-pull-request-reviewer[bot] copilot-pull-request-reviewer[bot] commented on Nov 30, 2026 20:56 UTC
    Reviewer

    <!-- ccr-overview-v2 -->

    🟡 Changes recommended

    The operational contract promises four timeout attempts over roughly 34 minutes, but a shared 30-minute step deadline cancels the fourth attempt early and is not extended by the job timeout.

    <details open>
    <summary><strong>3 open issues</strong></summary>

  • <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/high-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/high-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/high-v2-light.png" alt="High severity" width="62" height="18" align="texttop"></picture> Sanitize captured service URLs and backend diagnostics from fixtures and history

  • <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.png" alt="Medium severity" width="62" height="18" align="texttop"></picture> 30-minute step deadline prevents four full retry attempts · New

  • <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-light.png" alt="Low severity" width="62" height="18" align="texttop"></picture> Remove internal rollout details from the PR description and commit history

  • </details>

    <sub>Review effort: Balanced</sub>

    moisescassidy moisescassidy commented on code on Dec 01, 2026 04:39 UTC
    Code Review
    dev-infrastructure/region-pipeline.yaml:1
    @@ -340,12 +340,20 @@ resourceGroups:
         # first-time region rollout this can also fail with the ARM RP
         # propagation-lag variants seen elsewhere in this repo (e.g. shortly after
         # rpRegistration completes for a brand new subscription). See AROSLSRE-1708.
    +    # RequestTimeout matches transient Azure-side resource creation timeouts
    +    # (e.g. Cosmos DB account creation via the rp-cosmos-account module,
    +    # ARO-30635). ARM reports those as a terminal DeploymentFailed with the
    +    # nested RequestTimeout code inside an otherwise-200 response, so no
    +    # transport-level retry policy can act on them; only re-submitting the
    +    # deployment can recover, which is what this step-level retry does.
         automatedRetry:
           errorContainsAny:
           - "Internal error"
           - "InternalServerError"
           - "Internal server error"
           - "500 Internal Server Error"
    +      - "RequestTimeout"
    +      - "exceeded maximum alloted time"

    Confirmed — good catch, and verified in the code before changing anything: defaultStepContextTimeout = 30 time.Minute (run.go:56) is applied by the consumer loop around the whole executeNode call (run.go:739-741), so it bounds the entire retry sequence — attempts and* waits — not each attempt; and stepContextTimeout (run.go:975) only honors a Timeout override on Istio-upgrade and ARMStack-delete steps, so a plain ARM step like infra cannot raise it. The arithmetic in the operational contract was wrong exactly as you describe: at ~6.5 min per timeout attempt with 2-minute waits, attempts complete at 6.5 / 15 / 23.5 minutes, the fourth starts at 25.5 and is cut at the 30-minute deadline (and with the slowest observed ~8-minute attempts, it never starts).

    Resolved by correcting the contract rather than the mechanism: the PR description and the commit message now state that the sequence shares the 30-minute step deadline — three complete attempts for the slow RequestTimeout class, worst case ~30 minutes — and that a deadline-cut final attempt surfaces the step-timeout error while each attempt's own error is still logged.

    Why not address the deadline itself:

  • The count and interval predate this PR (AROSLSRE-1708 widening) and also serve the fast-failing InternalServerError class, where all four attempts run in ~8 minutes, well inside the deadline. Lowering maximumRetryCount to make the slow class fit would take a real attempt away from the class that can use it; shortening durationBetweenRetries would halve the propagation window that class relies on.

  • A complete fourth timeout attempt would need a per-step timeout override for ARM steps — new mechanism in templatize plus the vendored pipeline types and schema, with the same EV2-rendering question the existing fields already carry. No evidence justifies it: nothing has ever retried on this error yet, so there is no data that a fourth attempt has recovery value, and the truncation only occurs on runs where every attempt has already failed.

  • The post-merge watch (re-running the recurrence scan, looking for Retrying step + RequestTimeout followed by a completed provision) will produce real attempt-outcome data; if it ever shows recoveries clustering on late attempts, that is the point to revisit the budget or the deadline.
  • The corrected description and commit (amended, so the wrong arithmetic is not left in history) are force-pushed.

    copilot-pull-request-reviewer[bot] copilot-pull-request-reviewer[bot] commented on Dec 01, 2026 18:21 UTC
    Reviewer

    <!-- ccr-overview-v2 -->

    🟢 Approval recommended

    No active review issues were identified for the targeted Cosmos DB timeout retry change.

    No open issues 🎉

    <details>
    <summary><strong>3 resolved since last review</strong></summary>

  • <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/high-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/high-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/high-v2-light.png" alt="High severity" width="62" height="18" align="texttop"></picture> Sanitize captured service URLs and backend diagnostics from fixtures and history

  • <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.png" alt="Medium severity" width="62" height="18" align="texttop"></picture> 30-minute step deadline prevents four full retry attempts

  • <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-light.png" alt="Low severity" width="62" height="18" align="texttop"></picture> Remove internal rollout details from the PR description and commit history

  • </details>

    <sub>Review effort: Balanced</sub>

    miquelsi miquelsi commented on Dec 02, 2026 08:04 UTC
    Contributor

    /assign @geoberle

    miquelsi miquelsi commented on Dec 02, 2026 08:04 UTC
    Contributor

    /ok-to-test

    openshift-merge-bot[bot] openshift-merge-bot[bot] commented on Dec 02, 2026 08:35 UTC
    Bot

    Scheduling tests matching the pipeline_run_if_changed or not excluded by pipeline_skip_if_only_changed parameters:
    /test e2e-parallel
    /test e2e-parallel-inplace-upgrade

    geoberle geoberle commented on code on Dec 03, 2026 08:31 UTC
    Code Review
    dev-infrastructure/region-pipeline.yaml:1
    @@ -340,12 +340,20 @@ resourceGroups:
         # first-time region rollout this can also fail with the ARM RP
         # propagation-lag variants seen elsewhere in this repo (e.g. shortly after
         # rpRegistration completes for a brand new subscription). See AROSLSRE-1708.
    +    # RequestTimeout matches transient Azure-side resource creation timeouts
    +    # (e.g. Cosmos DB account creation via the rp-cosmos-account module,
    +    # ARO-30635). ARM reports those as a terminal DeploymentFailed with the

    have you verified these errors are recoverable?
    not all resources on azure can be retried once they failed during deployment, e.g. postgres, eventgrid

    in that is the case for cosmosdb, a retry does not solve the problem but increases the time we spend on an unresolvable issue instead of failing fast

    geoberle geoberle commented on code on Dec 03, 2026 08:32 UTC
    Code Review
    tooling/templatize/pkg/pipeline/region_infra_retry_test.go:1

    tests like these are not necessary. the retry contract for errors is the list in pipeline.yaml and that mechanism is well tested already

    Reviewers
    Assignees
    moisescassidy moisescassidy
    Labels
    risk: low confidence: 86.0% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 77.5% (HIGH) · Higher = larger blast radius
    77.5%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 86.0% · Lower = rushed or shallow review
    86.0%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 10.9% · Safe to merge
    10.9%
    Repository