Skip to content

Set up gcp cloud run compute config commands under worker deployment version tree - #1262

Open
mani-j9 wants to merge 2 commits into
mainfrom
mani/cli-cloud-run
Open

mani-j9 wants to merge 2 commits into
mainfrom
mani/cli-cloud-run

Conversation

@mani-j9

@mani-j9 mani-j9 commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Related issues

Follows #1235.

What changed?

Adds gcp-cloud-run to the experimental temporal worker deployment version compute-config tree from #1235, for GCP Cloud Run worker pools. The existing commands are unchanged.

temporal worker deployment version
├── create | describe | delete
└── compute-config
    ├── describe
    ├── remove [--scaling-group KEY] [--yes]
    ├── aws-lambda
    │   └── create | update
    ├── gcp-cloud-run      (new)
    │   └── create | update
    └── modal-function
        └── create | update

Existing commands and their new equivalents

Existing New What's different
create-version --gcp-cloud-run-* version compute-config gcp-cloud-run create Same request for the same inputs. New: --scaling-group and the two cooldown flags. If the Version exists, the error points to update.
update-version-compute-config --gcp-cloud-run-* version compute-config gcp-cloud-run update Same request for the same inputs: provider flags on their own keep the scaler settings, as before. New: --scaling-group and the two cooldown flags. If the Version is missing, the error points to create.
describe-version version compute-config describe Now also shows the rate-based scaler settings.

The Cloud Run commands work like the aws-lambda ones:

  • The provider prefix is dropped: --project, --worker-pool-region, --worker-pool, --service-account. The region flag is --worker-pool-region, so it can't be confused with --region-id.
  • The scaler flags drop the prefix too: --min-instances, --max-instances, --initial-instances, --utilization-target, and --scale-down-stabilization-ms, which takes milliseconds like the no-sync -ms flags instead of a duration.
  • New: --scale-up-cooldown-ms and --scale-down-cooldown-ms, the rate-based scaler's minimum time between two scale-ups or scale-downs.
  • The scaler flags stay all-or-none, as on main, and the cooldowns join the group. The server replaces the scaler settings as a whole, so passing them together means an update can't silently reset some of them to their defaults.
  • --scaling-group (default default) names the scaling group to create or update.

Also:

  • compute-config describe shows the rate-based settings in the Scaler line, e.g. rate-based (min_instances 1, max_instances 3, initial_instances 1, utilization_target 0.75, scale_down_stabilization_ms 300000, scale_up_cooldown_ms 2000, scale_down_cooldown_ms 60000), and in JSON (minInstances, …, scaleDownCooldownMs). This addresses the deferred Copilot comment on Adds compute-config commands under worker deployment version, with provider sub-commands #1235.
  • The new commands reject the same inputs as --gcp-cloud-run-* on the existing commands, with main's checks (min ≥ 0, max ≥ 1, min ≤ initial ≤ max, 0 < utilization ≤ 1, stabilization ≥ 0) plus non-negative cooldowns. Their errors name the new flags.
  • The help text keeps the existing Cloud Run wording. Only the parts about the new tree (scaling groups, scaler flags, partial updates) and the cooldowns are new.

Checklist

Design

  • This feature does not depend on Cloud-only APIs or behavior (it works against an OSS server)
  • New commands follow temporal <noun> <verb> structure (e.g. temporal workflow start)
  • New flags are named after the API concept, not the implementation mechanism (good: --search-attribute, bad: --index-field)
  • New flags don't duplicate an existing flag that serves the same purpose
  • New flags do not have short aliases without strong justification
  • Experimental features are marked with (Experimental) in commands.yaml

Help text (see style guide at the top of commands.yaml)

  • All flags shown in help text and examples are implemented and functional
  • Summaries use sentence case and have no trailing period
  • Long descriptions end with a period and include at least one example invocation
  • Examples use long flags (--namespace, not -n), one flag per line
  • Placeholder values use YourXxx form (YourWorkflowId, YourNamespace)

Behavior

  • Results go to stdout; errors and warnings go to stderr
  • Error messages are lowercase with no trailing punctuation

Tests

  • Added functional test(s) (SharedServerSuite)

Manual tests

I ran 10 scenarios against a Temporal Cloud test cell with a real GCP Cloud Run worker pool, running the existing and new commands side by side. The new commands behaved as expected: for the same inputs they succeeded or failed like the existing ones, and version describe printed the same output as describe-version in text and JSON, including the rate-based scaler summary.

Setup: a Worker Deployment YourDeploymentName, a Cloud Run worker pool, and a service account that the Temporal server can impersonate.

Happy path

$ temporal worker deployment version compute-config gcp-cloud-run create \
    --deployment-name YourDeploymentName \
    --build-id YourBuildID \
    --project YourGCPProject \
    --worker-pool-region us-west1 \
    --worker-pool YourWorkerPool \
    --service-account customer-sa@proj.iam.gserviceaccount.com
Successfully created worker deployment version

$ temporal worker deployment version compute-config describe \
    --deployment-name YourDeploymentName \
    --build-id YourBuildID
Compute Config Scaling Groups:
  ScalingGroup  default
  Provider      gcp-cloud-run
  Scaler        rate-based

Scaler flags on their own replace the scaler settings and keep the provider. --scale-down-stabilization-ms 300000 is stored like --gcp-cloud-run-scale-down-stabilization-duration 5m:

$ temporal worker deployment version compute-config gcp-cloud-run update \
    --deployment-name YourDeploymentName \
    --build-id YourBuildID \
    --min-instances 0 \
    --max-instances 2 \
    --initial-instances 0 \
    --utilization-target 0.75 \
    --scale-down-stabilization-ms 300000 \
    --scale-up-cooldown-ms 2000 \
    --scale-down-cooldown-ms 60000
Successfully updated worker deployment version compute config

$ temporal worker deployment version describe \
    --deployment-name YourDeploymentName \
    --build-id YourBuildID
...
  ComputeConfigSummary  gcp-cloud-run (min 0, initial 0, max 2, utilization 0.75, scale-down-stabilization 5m 0s)

$ temporal worker deployment version compute-config describe \
    --deployment-name YourDeploymentName \
    --build-id YourBuildID
Compute Config Scaling Groups:
  ScalingGroup  default
  Provider      gcp-cloud-run
  Scaler        rate-based (min_instances 0, max_instances 2, initial_instances 0, utilization_target 0.75, scale_down_stabilization_ms 300000, scale_up_cooldown_ms 2000, scale_down_cooldown_ms 60000)

Provider flags on their own keep the scaler settings, as with update-version-compute-config:

$ temporal worker deployment version compute-config gcp-cloud-run update \
    --deployment-name YourDeploymentName \
    --build-id YourBuildID \
    --project YourGCPProject \
    --worker-pool-region us-west1 \
    --worker-pool YourWorkerPool \
    --service-account customer-sa@proj.iam.gserviceaccount.com
Successfully updated worker deployment version compute config

$ temporal worker deployment version compute-config describe \
    --deployment-name YourDeploymentName \
    --build-id YourBuildID
Compute Config Scaling Groups:
  ScalingGroup  default
  Provider      gcp-cloud-run
  Scaler        rate-based (min_instances 0, max_instances 2, initial_instances 0, utilization_target 0.75, scale_down_stabilization_ms 300000, scale_up_cooldown_ms 2000, scale_down_cooldown_ms 60000)

Error cases

$ temporal worker deployment version compute-config gcp-cloud-run create \
    --deployment-name YourDeploymentName \
    --build-id YourBuildID \
    --project YourGCPProject \
    --worker-pool-region us-west1 \
    --worker-pool YourWorkerPool \
    --service-account customer-sa@proj.iam.gserviceaccount.com
Error: error creating worker deployment version: Worker Deployment Version "YourDeploymentName.YourBuildID" already exists; to set its compute config, use `temporal worker deployment version compute-config gcp-cloud-run update`

$ temporal worker deployment version compute-config gcp-cloud-run update \
    --deployment-name YourDeploymentName \
    --build-id YourMissingBuildID \
    --project YourGCPProject \
    --worker-pool-region us-west1 \
    --worker-pool YourWorkerPool \
    --service-account customer-sa@proj.iam.gserviceaccount.com
Error: error updating worker deployment version compute config: build ID 'YourMissingBuildID' not found in Worker Deployment 'YourDeploymentName'; to create it, use `temporal worker deployment version compute-config gcp-cloud-run create`

$ temporal worker deployment version compute-config gcp-cloud-run update \
    --deployment-name YourDeploymentName \
    --build-id YourBuildID \
    --worker-pool YourWorkerPool
Error: --project is required when changing the provider

$ temporal worker deployment version compute-config gcp-cloud-run update \
    --deployment-name YourDeploymentName \
    --build-id YourBuildID \
    --max-instances 2
Error: --min-instances, --max-instances, --initial-instances, --utilization-target, --scale-down-stabilization-ms, --scale-up-cooldown-ms, and --scale-down-cooldown-ms must be set together

$ temporal worker deployment version compute-config gcp-cloud-run update \
    --deployment-name YourDeploymentName \
    --build-id YourBuildID
Error: no compute configuration provided to update

$ temporal worker deployment version compute-config gcp-cloud-run update \
    --deployment-name YourDeploymentName \
    --build-id YourBuildID \
    --min-instances 0 \
    --max-instances 2 \
    --initial-instances 0 \
    --utilization-target 0.75 \
    --scale-down-stabilization-ms 300000 \
    --scale-up-cooldown-ms 120000 \
    --scale-down-cooldown-ms 60000
Error: error updating worker deployment version compute config: default: metrics_poll_interval_ms (60000) must be >= scale_up_cooldown_ms (120000), otherwise the scale-up cooldown blocks every poll

The existing commands rejected the same inputs. Only the wording differs where the CLI validates the flags, e.g. missing required GCP Cloud Run provider detail: project for --project is required when changing the provider.

Removing the scaling group:

$ temporal worker deployment version compute-config remove \
    --deployment-name YourDeploymentName \
    --build-id YourBuildID \
    --scaling-group default
Successfully removed worker deployment version compute config

$ temporal worker deployment version compute-config describe \
    --deployment-name YourDeploymentName \
    --build-id YourBuildID
Worker deployment version has no compute config

Risks

  • --scale-down-stabilization-ms takes milliseconds, where --gcp-cloud-run-scale-down-stabilization-duration took a duration (5m).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues block approval of the Cloud Run compute configuration changes.

No open issues 🎉

What changed in this PR

Extends the experimental worker deployment version command tree introduced in #1235 with GCP Cloud Run compute configuration commands, while leaving existing commands unchanged.

Changes:

  • Adds Cloud Run create and update commands with named scaling groups, provider validation, and all-or-none scaler flags, including cooldowns.
  • Displays rate-based scaler settings in text and JSON descriptions.
  • Adds tests for request payloads, partial updates, validation errors, and description output.
File Description
internal/​temporalcli/​commands.yaml Defines Cloud Run commands, scaler flags, and help text.
internal/​temporalcli/​commands.worker.deployment.version.go Decodes and formats rate-based scaler settings.
internal/​temporalcli/​commands.worker.deployment.version.gcp_cloud_run.go Implements Cloud Run create/update requests and validation.
internal/​temporalcli/​commands.worker.deployment.version.gcp_cloud_run_test.go Tests Cloud Run commands, partial updates, and error handling.
internal/​temporalcli/​commands.worker.deployment.version_test.go Tests rate-based scaler descriptions in text and JSON.
internal/​temporalcli/​commands.gen.go Registers generated commands and flag bindings.

Review effort: Balanced

@mani-j9
mani-j9 requested a review from seanbollin November 11, 2026 18:01

@ks-temporal ks-temporal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi, I am adding some comments, mostly to understand/explain the difference from other provider flags/commands. Please use a new incremental commit if any changes are applied/done, so that the differential changes can be reviewed incrementally, instead of doing a force-push or rebase with the changes, which loses the old vs. new changes difference.

Comment thread internal/temporalcli/commands.yaml Outdated
--project YourGCPProject \
--worker-pool-region us-central1 \
--worker-pool YourWorkerPool \
--service-account customer-sa@proj.iam.gserviceaccount.com

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should this be YourServiceAccountEmail instead of email format? Or if the account is always in this format after @ then keeping it like YourAccount@proj.iam... might be better?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Comment thread internal/temporalcli/commands.yaml Outdated
(--min-instances, --max-instances, --initial-instances,
--utilization-target, --scale-down-stabilization-ms,
--scale-up-cooldown-ms, and --scale-down-cooldown-ms) together. When
none are passed, the server defaults apply:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This appears different than aws-agentcore. "When none are passed..." => what if some are passed, will default for remaining apply? If yes, then reword to "Each one that is not set keeps the server default:" similar to agentcore help text. Or if it is an error to pass only some flags, but not all, then indicate so.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The flags are different across agentcore and cloudrun but the behavior is the same, here is where we call out similar behavior in the agentcore PR https://github.com/temporalio/cli/pull/1261/changes#diff-e1e06b576c4db2c77ee10bb962c28c8c3850f2d5f79ea2e3a9bfa114fa32786dR4391

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I initially left this the same as main but I'm changing it to keep it consistent with agentcore and lambda as below

  • anytime provider is modified and scaler details are not passed, they will be reset to defaults. it is no longer the all or none behavior.
  • scaler flags can be passed individually, and any flag not set keeps the server default.

Comment thread internal/temporalcli/commands.yaml Outdated
required: true
description: |
Customer GCP service account the Temporal server impersonates to
manage the Cloud Run worker pool.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this always an email format? If yes, then indicate so.

Comment thread internal/temporalcli/commands.yaml Outdated
```

To update only the scaler of an existing scaling group, supply the
scaler flags without the provider flags:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is scaler replaced as a whole similar to agentcore? If yes, indicate so - either pass all the scaler flags, or what happens for missing flags.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, scaler will be replaced with defaults if provider is modified without any scaler flags

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I initially left this the same as main but I'm changing it to keep it consistent with agentcore and lambda as below

anytime provider is modified and scaler details are not passed, they will be reset to defaults. it is no longer the all or none behavior.
scaler flags can be passed individually, and any flag not set keeps the server default.

Comment thread internal/temporalcli/commands.yaml Outdated
changing the compute provider, and they must all be passed together.
The scaler flags must also all be passed together. Changing the
provider keeps the scaler settings, unless the scaler flags are
passed with it to replace them.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This also appears to be different from other providers like agentcore. What happens if scaling group provider is changed from a previous one to this gcp one, and scaler flags are not passed. If you don't reset the scaler when changing the provider here, but do so in others, I think it could lead to some inconsistencies.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Right, I forgot to mention this in the PR. I tried to keep it the same as current main behavior to keep the changes minimal to just the command restructuring. But, now that I think about it kind of makes sense to keep it consistent, I will check with the team and see if there is any specific reasoning for cloudrun alone.

Comment thread internal/temporalcli/commands.yaml Outdated
type: int
description: |
Minimum time between two scale-ups of the Cloud Run worker pool, in
milliseconds. Must not exceed the scaler's metrics poll interval of

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is the metrics poll interval server side config? Is that update-able, or is the value 1m hardcoded? If update-able, then this may need re-wording to indicate so, e.g., "... poll interval, which defaults to ..."

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this should be configurable if we are opening up the scaling param t be configurable, let me check and fix that and the wording here.

Comment thread internal/temporalcli/commands.yaml Outdated
description: |
Minimum number of Cloud Run worker pool instances the scaler will
maintain. Must be passed with the other scaler flags. Defaults to 0
when unset.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this and other flags' text is not clear - "Must be passed... " vs. "... when unset" - which indicates that this is required vs. optional. May be because the default is applied by the server (?) May need rewording to indicate when should this be passed, and when and how the default is applied. e.g., "Must be passed if any other scalar flag is passed". and "If no scaler flags are passed, then defaults to ..." or "... then the server defaults it to ..." Or some other semantics/constraints.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this was actually replicating the existing main behavior where cloud-run enforces all or none kind of a behavior for scaler flags. I modified this to be consistent with the other two compute providers(lambda and agentcore) where we allow partial flags to be passed and use defaults for those that are not passed, and reset scaler flags that are not specified to defaults when provider is modified.

Comment thread internal/temporalcli/commands.yaml Outdated
- name: min-instances
type: int
description: |
Minimum number of Cloud Run worker pool instances the scaler will

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is the option set of rate-based-scaler only intended for GCP Cloud Run? Will it be better to just use "worker pool instances" without "Cloud Run" to make it generic? If yes, then in other flags of this option set as well...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes, this is for rate based scaler only. If we name it worker-poll specific(which is cloud run terminology), we won't be able to reuse it for other rate based compute like ECS.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah I misunderstood your comment, if you are referring to the description not stating cloud run - that is a good callout. let me reword it, so we can easily add future rate based compute.

@mani-j9
mani-j9 marked this pull request as ready for review November 30, 2026 19:26
@mani-j9
mani-j9 requested a review from a team as a code owner November 30, 2026 19:26
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-30T19:28:21.488558Z 6d72be7 Draft marked ready
ℹ️ 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.

@mani-j9
mani-j9 requested a review from ks-temporal November 30, 2026 19:33
@mani-j9

mani-j9 commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor Author

Hi, I am adding some comments, mostly to understand/explain the difference from other provider flags/commands. Please use a new incremental commit if any changes are applied/done, so that the differential changes can be reviewed incrementally, instead of doing a force-push or rebase with the changes, which loses the old vs. new changes difference.

thank you @ks-temporal, addressed your comments in the latest commit. I'm holding off on rebasing onto latest main which will mess up the commit hashes(including the incremental commit). I will rebase and squash before merging.

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.

3 participants