Skip to content

fix(openshell): generate sandbox names within the gateway routable-name limit #2666

Description

@cwing-nvidia

Summary

The Gym OpenShell provider generates a 41-character sandbox name, but current OpenShell gateways enforce a maximum routable sandbox-name length of 19 characters. As a result, every sandbox creation fails before provisioning begins.

Reproduction

Create a sandbox through nemo_gym.sandbox.providers.openshell.provider.OpenShellProvider against a current OpenShell gateway.

Observed error:

OpenShellCreateError: CreateSandbox failed for image='python:3.12-slim':
status = StatusCode.INVALID_ARGUMENT
 details = \"name exceeds maximum length (41 > 19)\"

Root cause

nemo_gym/sandbox/providers/openshell/provider.py currently defines:

SANDBOX_NAME_PREFIX = \"nemo-gym-\"

and creates names with:

name = SANDBOX_NAME_PREFIX + uuid.uuid4().hex

This produces 9 + 32 = 41 characters. OpenShell's 19-character limit is intentional because the name participates in service-routing hostnames; the compatibility defect is in Gym's generated name.

Expected behavior

Gym should generate a DNS-safe, collision-resistant name no longer than 19 characters, for example ng- plus 16 UUID hex characters.

Retries and ALREADY_EXISTS recovery must continue reusing the same generated name so an ambiguous create response does not leak a second sandbox.

Acceptance criteria

  • Generated OpenShell sandbox names are at most 19 characters.
  • Names use a DNS-safe character set.
  • Unit tests cover length, format, uniqueness, and stable reuse across create retries.
  • No OpenShell gateway change is required.

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions