feat(api): return BYOC cluster domain from volume endpoints - #3490
Conversation
When a team is connected to a custom (BYOC) cluster, the volume create and get endpoints now include the cluster's domain in the VolumeAndToken response. SDKs use this domain as the destination for volume content requests instead of the default api.<E2B_DOMAIN> host. Teams on the default cluster get no domain and keep their configured default. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01212WCmNz1prPKrjhTv2PDj
PR SummaryMedium Risk Overview Volume content JWTs now use Reviewed by Cursor Bugbot for commit 02f41af. Bugbot is set up for automated code reviews on this repo. Configure here. |
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bf93ab7dd3
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| return nil, fmt.Errorf("%w: %s", ErrClusterNotFound, team.ClusterID.String()) | ||
| } | ||
|
|
||
| return cluster.SandboxDomain, nil |
There was a problem hiding this comment.
Reject BYOC clusters that have no volume domain
When a team is assigned to a cluster whose sandbox_proxy_domain is null—which remains valid under AdminClusterCreateRequest in spec/openapi-dashboard.yml:422-424—this returns (nil, nil), so omitempty removes domain and the SDK falls back to the default control-plane host. Volume-content requests are then routed to the wrong cluster; return a configuration error here or make the domain mandatory for BYOC clusters.
AGENTS.md reference: AGENTS.md:L22-L26
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
This is acceptable, it's deep into undefined behavior. If there's no client proxy domain, the whole cluster doesn't work, so this is the least of that cluster's problem.
| Domain to use as the destination for volume content requests, | ||
| replacing the default `api.<E2B_DOMAIN>`. Only returned when the | ||
| team is connected to a custom (BYOC) cluster; absent otherwise, in | ||
| which case the default domain is used. |
There was a problem hiding this comment.
Document the BYOC volume-content route
This contract redirects SDK volume-content traffic from the configured control-plane API host to the BYOC cluster domain, but docs/ARCHITECTURE.md:33-46 still models SDK traffic only through the main load balancer and API and contains no volume-content path. Add this cross-service routing flow to the architecture document as required for routing and topology changes.
AGENTS.md reference: AGENTS.md:L7-L9
Useful? React with 👍 / 👎.
The volume content JWT's `aud` claim was the cluster ID. Set it to the origin the SDK actually targets — `https://api.<domain>` — using the team's BYOC cluster domain when set and the deployment default (DOMAIN_NAME) otherwise, so it matches the host the token is presented to. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01212WCmNz1prPKrjhTv2PDj
The volume-content contract redirects SDK content traffic from the control-plane API host to a team's BYOC cluster domain, but ARCHITECTURE.md modeled SDK traffic only through the main load balancer and API. Add the volume-content path to the system overview and a "Volume content" core-flow section covering domain selection and the api.<domain>-audience token. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01212WCmNz1prPKrjhTv2PDj
When a team is connected to a custom (BYOC) cluster, the volume create and get endpoints now include the cluster's domain in the VolumeAndToken response. SDKs use this domain as the destination for volume content requests instead of the default api.<E2B_DOMAIN> host. Teams on the default cluster get no domain and keep their configured default. --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
When a team is connected to a custom (BYOC) cluster, the volume create and get endpoints now include the cluster's domain in the VolumeAndToken response. SDKs use this domain as the destination for volume content requests instead of the default api.<E2B_DOMAIN> host. Teams on the default cluster get no domain and keep their configured default.