-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Labels
bugSomething isn't workingSomething isn't working
Description
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.pyandsdk/sandbox/client.py - Observe that default values are directly embedded in the code
- Try to change
clusterdefault 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.pymodule should support these configuration environment variables with sensible fallback defaults - Consistency with existing pattern:
ROCK_BASE_URL,ROCK_SANDBOX_STARTUP_TIMEOUT_SECONDSare already configurable via environment variables
Actual Behavior
clusterdefaults 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.pyto 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
- Sandbox
- Actions
- Deployments
- SDK & API
- Envhub
- CLI
- Performance & Optimization
- Documentation & Examples
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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working