Bug Description
The Python SDK contains numerous hardcoded default values in sdk/sandbox/config.py and sdk/sandbox/client.py. These values cannot be customized via environment variables, reducing flexibility for different deployment scenarios.
Key hardcoded values include:
In sdk/sandbox/config.py:
| Configuration |
Hardcoded Value |
Line |
image |
"python:3.11" |
L23 |
auto_clear_seconds |
60 * 5 (300) |
L24 |
memory |
"8g" |
L27 |
cpus |
2 |
L28 |
cluster |
"zb" |
L31 |
size (SandboxGroup) |
2 |
L35 |
start_concurrency |
2 |
L36 |
start_retry_times |
3 |
L37 |
In sdk/sandbox/client.py:
| Configuration |
Hardcoded Value |
Location |
| Status check interval |
3 seconds |
await asyncio.sleep(3) in start() |
wait_timeout default |
300 seconds |
arun() parameter |
wait_interval default |
10 seconds |
arun() parameter |
| Nohup command timeout |
30 seconds |
BashAction(..., timeout=30) |
| Minimum check interval |
5 seconds |
max(5, wait_interval) |
Steps to Reproduce
- Review the source code at
sdk/sandbox/config.py and sdk/sandbox/client.py
- Observe that default values are directly embedded in the code
- Try to change
cluster default from "zb" to another cluster without modifying code - not possible via environment variable
Expected Behavior
- Default values should be configurable via environment variables (e.g.,
ROCK_DEFAULT_CLUSTER, ROCK_DEFAULT_IMAGE, ROCK_DEFAULT_MEMORY, ROCK_DEFAULT_CPUS)
- The
env_vars.py module should support these configuration environment variables with sensible fallback defaults
- Consistency with existing pattern:
ROCK_BASE_URL, ROCK_SANDBOX_STARTUP_TIMEOUT_SECONDS are already configurable via environment variables
Actual Behavior
cluster defaults to "zb" - a China-specific cluster that may not be appropriate for international users or different deployment environments
- Resource defaults (
memory=8g, cpus=2) may not suit all use cases
- No way to change these defaults without modifying the source code
Suggested Solution
- Add new environment variables to
env_vars.py:
"ROCK_DEFAULT_CLUSTER": lambda: os.getenv("ROCK_DEFAULT_CLUSTER", "zb"),
"ROCK_DEFAULT_IMAGE": lambda: os.getenv("ROCK_DEFAULT_IMAGE", "python:3.11"),
"ROCK_DEFAULT_MEMORY": lambda: os.getenv("ROCK_DEFAULT_MEMORY", "8g"),
"ROCK_DEFAULT_CPUS": lambda: float(os.getenv("ROCK_DEFAULT_CPUS", "2")),
"ROCK_DEFAULT_AUTO_CLEAR_SECONDS": lambda: int(os.getenv("ROCK_DEFAULT_AUTO_CLEAR_SECONDS", "300")),
- Update
sdk/sandbox/config.py to use these environment variables:
class SandboxConfig(BaseConfig):
image: str = env_vars.ROCK_DEFAULT_IMAGE
auto_clear_seconds: int = env_vars.ROCK_DEFAULT_AUTO_CLEAR_SECONDS
memory: str = env_vars.ROCK_DEFAULT_MEMORY
cpus: float = env_vars.ROCK_DEFAULT_CPUS
cluster: str = env_vars.ROCK_DEFAULT_CLUSTER
# ...
Error Logs
N/A - This is a configuration flexibility issue, not a runtime error.
Environment Information
- OS: Any
- Python Version: Any
- ROCK Version: Current (as of March 2026)
- Installation Method: pip install rl-rock
- Docker Version: N/A
- Deployment Type: Any
ROCK Configuration
- Runtime Environment Type: Any
- Sandbox Image: Default
python:3.11
- Resource Allocation: Default
memory=8g, cpus=2
Component Affected
Additional Context
This issue was identified during the TypeScript SDK code review (PR #492). The TypeScript SDK mirrors the Python SDK's behavior and has the same hardcoded defaults. Fixing this in the Python SDK would also guide the TypeScript SDK implementation.
Bug Description
The Python SDK contains numerous hardcoded default values in
sdk/sandbox/config.pyandsdk/sandbox/client.py. These values cannot be customized via environment variables, reducing flexibility for different deployment scenarios.Key hardcoded values include:
In
sdk/sandbox/config.py:image"python:3.11"auto_clear_seconds60 * 5(300)memory"8g"cpus2cluster"zb"size(SandboxGroup)2start_concurrency2start_retry_times3In
sdk/sandbox/client.py:3secondsawait asyncio.sleep(3)instart()wait_timeoutdefault300secondsarun()parameterwait_intervaldefault10secondsarun()parameter30secondsBashAction(..., timeout=30)5secondsmax(5, wait_interval)Steps to Reproduce
sdk/sandbox/config.pyandsdk/sandbox/client.pyclusterdefault from"zb"to another cluster without modifying code - not possible via environment variableExpected Behavior
ROCK_DEFAULT_CLUSTER,ROCK_DEFAULT_IMAGE,ROCK_DEFAULT_MEMORY,ROCK_DEFAULT_CPUS)env_vars.pymodule should support these configuration environment variables with sensible fallback defaultsROCK_BASE_URL,ROCK_SANDBOX_STARTUP_TIMEOUT_SECONDSare already configurable via environment variablesActual Behavior
clusterdefaults to"zb"- a China-specific cluster that may not be appropriate for international users or different deployment environmentsmemory=8g,cpus=2) may not suit all use casesSuggested Solution
env_vars.py:sdk/sandbox/config.pyto use these environment variables:Error Logs
N/A - This is a configuration flexibility issue, not a runtime error.
Environment Information
ROCK Configuration
python:3.11memory=8g, cpus=2Component Affected
Additional Context
This issue was identified during the TypeScript SDK code review (PR #492). The TypeScript SDK mirrors the Python SDK's behavior and has the same hardcoded defaults. Fixing this in the Python SDK would also guide the TypeScript SDK implementation.