Skip to content

Add promotion-time settings flags to model deployment promote - #176

Open
mingminglang-baseten wants to merge 28 commits into
mainfrom
mingming/promotion-time-settings
Open

mingminglang-baseten wants to merge 28 commits into
mainfrom
mingming/promotion-time-settings

Conversation

@mingminglang-baseten

@mingminglang-baseten mingminglang-baseten commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

🚀 What

baseten model deployment promote can change the target environment's settings as part of the promotion (region, instance type, request backpressure, autoscaling, and autoscaling schedules as raw API JSON), and override promotion settings for that promotion only (--override-*). Autoscaling and override flags get their own help sections, and the confirmation prompt names the settings that will change. A promote without the new flags sends the same body as before.

💻 How

  • Fills environment_settings_update and promotion_settings_override, sending each group only when one of its flags is passed.
  • The autoscaling flags are the existing shared ones, now in their own help section, so update-autoscaling shows that heading too.

🔬 Testing

New promote tests for each settings group and for rejected input: --instance-type with --preserve-env-instance-type, and empty or trailing schedule JSON (the server rejects unknown keys itself). go mod tidy, go fmt, go vet and the model tests pass.

🤖 Generated with Claude Code

youngzheng-oss and others added 23 commits October 15, 2026 09:42
…listing

The usage command listed your teams and your Code settings in each with
GET /v1/routes/settings/users/me/teams, which is being removed. Use
GET /v1/teams for your teams and GET /v1/routes/settings/teams/{team}/users/me
for your settings in each, which say the same things. Org admins are
members of every team, so they still see every team.

Claude-Session: https://claude.ai/code/session_01UkWMh7GwDgbmR88spBWMEm
Pins baseten-go to the client regenerated for the renamed Grid API, so
every call site moves to the GetGrid*/PostGrid*/PatchGrid*/DeleteGrid*
methods. grid usage now reads your settings from
GET /v1/grid/team_settings/users/me and passes --team straight through
as team_id: the server uses your only team, or asks for --team when you
belong to several. The client-side team listing and name matching are
gone, along with the "No usage this month" branch they fed.

Claude-Session: https://claude.ai/code/session_01UkWMh7GwDgbmR88spBWMEm
Preserve the source PR's all-team usage and team name/ID filtering while using the current Grid API and Grid-named files. Resolve the usage implementation and test conflicts without restoring legacy command files.
* adding functionality to cli

* Update go.sum

* adding functionality to cli
`grid usage` listed your teams and fetched your settings in each to draw
your spend against your limit, the one place the CLI still stitched teams
together client-side. Per the review on this PR, usage is one command:
`grid route usage [--team] [--user-id]`, whose arguments behave as the API
does. Without --team, usage spans the teams you can see; without --user-id,
members see their own usage and admins see everyone's. Your spend against
your limit in a team is `grid user-settings describe`.

Claude-Session: https://claude.ai/code/session_01UkWMh7GwDgbmR88spBWMEm
The list spans every team you can see unless --team narrows it, so two
rows can share a name. A TEAM column, as the connection list already
has, tells them apart.

Claude-Session: https://claude.ai/code/session_01UkWMh7GwDgbmR88spBWMEm
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mingminglang-baseten
mingminglang-baseten marked this pull request as ready for review October 21, 2026 02:09
…nges in the prompt

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI 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.

🟡 Changes recommended

Schedule validation can bypass explicitly empty input and nested misspellings, permitting promotion without intended settings changes.

2 open issues
What changed in this PR

Extends deployment promotion to update environment settings and apply one-time promotion overrides, reusing existing settings mappings.

Changes:

  • Adds grouped flags, help examples, and settings-aware confirmation.
  • Builds optional settings payloads and adds validation tests.
  • Updates the Go SDK and adapts promotion settings types.
File Description
internal/​cmd/​command.model_environment.go Adapts SDK types and shared mappings.
internal/​cmd/​command.model_deployment.go Builds promotion payloads and validates schedule JSON.
internal/​cmd/​command.model_deployment_test.go Tests settings payloads and rejected inputs.
go.sum Updates SDK checksums.
go.mod Updates the SDK dependency.
cmd/​command.model.go Defines reusable settings flag groups.
cmd/​command.model_environment.go Embeds shared promotion flags.
cmd/​command.model_deployment.go Adds promotion flags, help, and examples.

Review effort: Balanced

Comment thread internal/cmd/command.model_deployment.go
Comment thread internal/cmd/command.model_deployment.go
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@talyaacovi talyaacovi 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.

lgtm!

@cretz cretz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks great, only minor things (most non-blocking)

Comment thread cmd/command.model_deployment.go Outdated
Comment thread cmd/command.model.go Outdated
Comment thread cmd/command.model_deployment.go Outdated
PreserveEnvInstanceType bool `flag:"preserve-env-instance-type" desc:"Keep the target environment's current instance type instead of applying the promoted deployment's."`

Region OptionalFlag[string] `flag:"region" desc:"Region slug to set on the environment. Pass an empty string for Global. Run 'baseten org regions' to see the slugs available."`
InstanceTypeID OptionalFlag[string] `flag:"instance-type-id" desc:"Instance type to set on the environment. Cannot be combined with --preserve-env-instance-type."`

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is rough on users, we don't expose instance type IDs and we don't expect users to have to provide IDs. When you create a model for example, you provide the instance type name (I know we had discussed this internally during API review, though I forget where we landed). I wonder if the API can't change, if we should accept --instance-type here and go look up the ID (unsure if that replaces or is in addition to this).

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 seems to be more of a naming issue I think

When you create a model for example, you provide the instance type name

What user provides in truss is what the REST API calls id (e.g. "A10Gx4x16" in truss https://docs.baseten.co/reference/truss-configuration#resources). The name in REST looks like "L4:4x16 - 1 L4 GPU, 24 GiB video memory, 4 vCPU, 16 GiB" (I don't think users would want to pass this). In addition, instance_type in REST is the full struct including id, name and some other fields.

I can update this to --instance-type to align with truss convention. For reference, is it ok to use docs since we don't have a baseten model instance-types command yet?

CPU: https://docs.baseten.co/deployment/resources#cpu-only-instances
GPU: https://docs.baseten.co/deployment/resources#gpu-instances

@cretz cretz Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Oh interesting, yes, I think we should update the flag name to --instance-type. Yes, we can just point to docs (though would totally support baseten model instance-types in a followup).

Comment thread cmd/command.model_deployment.go Outdated
Comment thread internal/cmd/command.model_deployment.go Outdated
Comment thread internal/cmd/command.model_deployment.go Outdated
Comment thread cmd/command.model.go Outdated
// --autoscaling-* prefix, for commands that set more than autoscaling. Its
// fields mirror [AutoscalingSettingsFlags] so one converts to the other.
type PrefixedAutoscalingSettingsFlags struct {
MinReplica OptionalFlag[int] `flag:"autoscaling-min-replica" desc:"Minimum number of replicas." group:"autoscaling" group-pri:"200"`

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Not a requirement, but IMO the field name matching the flag name is ideal (even if it is an annoying prefix everywhere, but out users suffer that too)

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.

Yeah I'll keep the field name and flag name aligned. On the naming, I'm thinking maybe we should remove the prefix as we discussed in the other thread on push-time settings.

Arguments for prefixing:

  1. Precedence of prefixing (admittedly this is an example prefixing makes lots of sense): https://github.com/basetenlabs/baseten-cli/blob/main/cmd/command.volume_sync.go#L152-L158
  2. We don't need to worry about colliding field names under different parent fields
  3. Structurally analogous to how we handle request backpressure policy in the existing environment update command, as --autoscaling-min-replica is similar to --request-backpressure-policy; --min-replica is similar to --policy (the latter sounds a bit too general?)
baseten model environment update-autoscaling ... --min-replica 2
baseten model environment update-request-backpressure ... --policy reject-on-full

(That said, if the same logic is applied to promotion setting, --promotion-rolling-deploy or --override-promotion-rolling-deploy seems verbose, so maybe we can treat --request-backpressure-policy as a special case.)

Arguments for not prefixing:

  1. Simplicity
  2. Users might be used to --min-replica etc flag that already exists for update

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I concur with removing the prefix, and we won't have it on model push either looking at #180

Comment thread internal/cmd/command.model_deployment_test.go Outdated
Base automatically changed from shivain/grid-rename to main October 21, 2026 19:58
mingminglang-baseten and others added 2 commits October 21, 2026 21:04
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@cretz cretz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM, I do concur with making the flag name --instance-type and removing the --autoscaling- prefix on promote flags

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

6 participants