Repository navigation
hosted agents: add ListRegions - #1199
Merged
Merged
Conversation
Adds GET /v2/harness-runtime/regions, the per-team region catalog. The default region is always listed and marked is_default; every other open region is listed only when the team holds its grant, so the catalog agrees slug for slug with what CreateSession and CreateSessionFromEnvironment placement admit. The catalog is team-scoped rather than host-scoped: it is the same on every regional host, so one call enumerates the regions instead of one call per HostedAgentsRegionalBaseURL. DefaultRegion() reports the marked slug for callers rendering a picker, so they preselect from the catalog rather than hardcoding ric1. It reports not-found rather than falling back to the first entry: guessing a default would place sessions in a region the caller never chose. Implemented by the harness-api ListRegions endpoint.
ElanHasson
approved these changes
Oct 30, 2026
amandhaw
marked this pull request as ready for review
November 2, 2026 16:39
DO-rrao
approved these changes
Nov 4, 2026
This was referenced Nov 4, 2026
amandhaw
added a commit
that referenced
this pull request
Nov 10, 2026
Follow-up to #1199. The comments describe a slug as "the region a session or environment is created in" and IsDefault as "the region a create lands in when none is named". Both read as a placement choice. The API works the other way: a create is placed in the region of the host that served it, and the optional region field on a create request is a check against that host. Slug now names the regional API host to point a client at, IsDefault names the region the region-less host serves, and the interface comment points at HostedAgentsRegionalBaseURL for building the host. Comments only; no behaviour change. Matches the wording agreed on the OpenAPI spec in digitalocean/openapi#1296. Reported in review by @DO-rrao on that PR; it missed #1199 because the fix came after it merged. Co-authored-by: Radhika Rao <rrao@digitalocean.com>
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
Adds
ListRegions—GET /v2/harness-runtime/regions, the per-team region catalog.The default region is always listed and marked
is_default; every other open region is listed only when the team holds its grant. The set is exactly whatCreateSessionandCreateSessionFromEnvironmentplacement admit, so a slug returned here is accepted and a slug missing here is refused — a picker built from the catalog never offers a region a create rejects.This is the SDK support the CLI's
agents regionscommand needs; that work follows separately.Draft: do not merge yet
The endpoint is not in production. The implementing service change is merged but not yet deployed, and the route is still refused at the edge until the matching allow-list change lands. Opened early so CI runs and the CLI work has something to build against.
Changes
hosted_agent_regions.goListRegions,DefaultRegion()hosted_agent_regions_test.gohosted_agents.goTypes live in a per-concern file with the interface method central, matching
hosted_agent_checkpoints.go,hosted_agent_configs.goand the other siblings.Notes
HostedAgentsRegionalBaseURL.DefaultRegion()exists because every caller rendering a picker needs "which one is preselected", and the alternative is each of them looping over the slice. It reports not-found rather than falling back to the first entry: guessing a default would place a session in a region the caller never chose.CHANGELOG.mdor version bump, perCONTRIBUTING.mdstep 3 — those are a release-time change in their own PR.Testing
gofmtandgo vetclean. Four new tests: the catalog, the default-only case a team with no grants sees, the error path, and a table forDefaultRegion()including the nil receiver. Full root package suite passes with no regressions from the interface change.