Repository navigation
Conversation
`brev create` never set location/subLocation outside the launchable path, so every plain create landed in the catalog's default location (for n2d-standard-2 that is asia-south1) with no way to change it or see it. - create: add --location and --sub-location. Types whose catalog available_locations do not include the location are skipped like any other unavailable type in a fallback chain. --location overrides a launchable's location and its sub-location. - create: dry-run and the pre-create log show where each type will land (requested location or catalog default). - search: add a LOCATION column and location, sub_location and available_locations JSON fields; add --location to list types available in a location. Piped tables keep TYPE and TARGET_DISK first. Fixes #454
theFong
force-pushed
the
codex/create-region-selection
branch
from
November 25, 2026 19:12
81c94d8 to
5e3479b
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #456 +/- ##
==========================================
+ Coverage 33.51% 40.11% +6.60%
==========================================
Files 153 137 -16
Lines 21654 20287 -1367
==========================================
+ Hits 7257 8139 +882
+ Misses 13624 11336 -2288
- Partials 773 812 +39
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
- 'brev search locations' lists every location with its providers and GPU and CPU type counts; --type shows where one type can be created, and --provider and --json work as in the other search commands. Counts match 'brev search gpu|cpu --location'. - 'brev search gpu' and create's auto-selection now read the CPU-inclusive public catalog and keep GPU types. The GPU-only listing returned a different region variant for 166 of 350 GPU types: a different default location and available locations than the org catalog 'brev create' validates against, and a different price for 54 of them. It also listed 3 types the org catalog does not have.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
brev createnever sentlocation/subLocationoutside the launchable path, so plain creates always landed in the catalog default location. Forn2d-standard-2, that default isasia-south1. Users had no way to change it, and nothing showed it before the instance existed. This PR fixes both:brev create --location <loc> [--sub-location <zone>]sends the location on the create request. If the catalog says a type isn't available in that location, the type is skipped like any other unavailable type, so a fallback chain moves on to the next one.--locationalso replaces a launchable's location and zone.--dry-runand the pre-create log show where each type will land: the requested location, or the catalog default.brev searchgets aLOCATIONcolumn,location/sub_location/available_locationsin--json, and a--locationfilter. Piped tables keepTYPEandTARGET_DISKfirst, sobrev search | brev create --stdinis unchanged.brev search locationslists every location with its providers and GPU/CPU type counts;--typeshows where one type can be created.brev search gpuand create's auto-selection now read the same catalog assearch cpu,search locations, andbrev createvalidation. See Catalog consistency fix for why.How locations work
LOCATIONmeansbrev search gpu|cpubrev createputs it without--locationbrev search gpu|cpu --location XX; the column showsX, wherebrev create --location Xwill put itbrev search locations [--type T]T) with type countsbrev create --location XXare skipped; the request carrieslocation/subLocationLocations come from the catalog, not live capacity, so a listed location can still fail at create time for lack of capacity. That failure is handled like any other create error.
Fixes #454
What it looks like
Discover locations
The counts match
brev search gpu|cpu --location <loc>. On the live catalog:us-west20/104,us-east-153/136,us-central1130/126, from both commands.Find where a type lands
With
--location, theLOCATIONcolumn (and JSONlocation) shows the requested location, because that's wherebrev create --locationwill put the instance. Location matching is exact; a non-matching location returns an empty list.Preview placement before creating
Errors
End-to-end evidence (real instance, 2026-11-25)
This reproduces #454 with a binary built from this branch. The instance was deleted right after the checks.
1. Create
2. Control plane (
GET /api/workspaces/6zzci9zex, location fields only)3. On the VM (GCP metadata server)
4. Cleanup:
brev delete loc-e2e-454. The API went DELETING → STOPPED → 404, andbrev lsno longer lists it.Without
--location, the same type still defaults toasia-south1/asia-south1-a, as the first dry-run above shows.Catalog consistency fix
The public catalog returns a different region variant for some GPU types depending on whether CPU types are requested. On 2026-11-25, 166 of 350 GPU types had a different default location, sub-location, available locations, and storage in the GPU-only listing, and 54 of them had a different price. The results were deterministic across repeated calls, so this isn't live capacity.
brev createvalidates against the org catalog. For all 166 types, the org catalog matches the CPU-inclusive listing, never the GPU-only one, on both default location and price. Before this change:brev search gpushowed default locations and prices that differ from whatbrev createuses. For example,n1-highmem-16:nvidia-tesla-p4:2showedus-east4at $2.719/hr, but creates useus-central1at $2.576/hr.brev search gpu --location us-west2would list 51 GPU types thatbrev create --location us-west2then rejects.So
brev search gpuand create's auto-selection now read the CPU-inclusive catalog and keep GPU types. User-visible effect: corrected default locations and prices for those GPU types. Three Nebiusgpu-l40s-d.*types that the org catalog doesn't have, and thatbrev createalready rejects as unrecognized, no longer appear. The server-side inconsistency in the GPU-only listing is worth fixing separately.Design notes
brev createalready loads. No extra fetch. The org catalog has one row per type, and every row lists itsavailable_locations: on 2026-11-25 it returned 556 rows for 556 distinct types, all with locations. So the existingGetCloudCredIDlookup is unchanged and needs no region awareness. If a type isn't in the catalog (for example a private launchable type), or the catalog lists no locations for it, the server stays the source of truth.--location, matching the API field), and the same matching rule insearchandcreate.uniqueInstanceType=truestays. Fetching the org catalog withuniqueInstanceType=falsealso returns one row per type, with identical locations, so de-duplication hides nothing.brev search locationsis built from that same catalog and the same NVIDIA filter assearch gpu, so its counts and the--locationfilters can't disagree.--dry-run --type Xnow makes one public catalog request to show placement.Validation
go test -race -count=1 ./pkg/cmd/gpucreate ./pkg/cmd/gpusearch ./pkg/storego test -count=1 ./...: all packages pass excepte2etest/setup, which panics on a hardcoded/home/ubuntu/brev-clipath, as it does onmain.golangci-lint run ./...(v2.0.2, the version intools/go.mod): 0 issues.locationscounts, sorting, filters, and placeholder, and which catalog each command reads. A test failed every time.--sub-locationvalidation.brev search→brev create --stdinround trip for both table and JSON output.brev search locations: counts, providers,--type/--provider/--json, empty results, and agreement withsearch gpu|cpu --location.Prior work
This replaces the earlier version of this PR (previous head
81c94d8e) with a smaller rewrite on currentmain. It builds on the region-flag work in #393 by @hakhandelwal11.