-
Notifications
You must be signed in to change notification settings - Fork 477
Add SandboxMixin to CliAgentEnv #785
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
|
||
| async def get_timeout_seconds(self, state: State) -> float: | ||
| """Get timeout for this rollout. Override for per-task timeouts.""" | ||
| return self.timeout_seconds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method returns None but callers expect float
High Severity
The get_timeout_seconds method returns self.timeout_seconds which can be None (since timeout_seconds now defaults to None instead of 3600.0), but the return type annotation claims float. Callers don't handle None, causing runtime TypeError when formatting strings with .0f (line 310) or comparing with > (lines 342, 814). While HarborEnv properly overrides with a fallback to 3600.0, the base CliAgentEnv lacks this default.
Additional Locations (2)
e830b56 to
a0e709d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| disk_size_gb: int = 5, | ||
| cpu_cores: int = -1, # -1 = use per-task config or default | ||
| memory_gb: int = -1, # -1 = use per-task config or default | ||
| disk_size_gb: int = -1, # -1 = use per-task config or default |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resource parameters default to -1 breaking sandbox creation
Medium Severity
The cpu_cores, memory_gb, and disk_size_gb parameters now default to -1 instead of their previous values of 1, 2, and 5. These values are passed directly to CreateSandboxRequest in get_sandbox_request without any fallback logic. While HarborEnv overrides this to apply per-task config, the base CliAgentEnv does not provide defaults, potentially causing sandbox creation failures when the API receives invalid negative values.
Description
Extract sandbox lifecycle management into a reusable mixin for CliAgentEnv.
Can be used in
SandboxEnvtoo.Changes
Type of Change
Testing
uv run pytestlocally.Checklist
Additional Notes
Note
Introduces a reusable sandbox lifecycle layer and refactors agent environments to use it.
SandboxMixinwithThreadedAsyncSandboxClient, exponential backoff retries, active sandbox tracking, bulk delete, and teardown helpers (exported inexperimental/__init__.py)CliAgentEnvto inheritSandboxMixin: pooled client, retryingcreate/delete, new tuning params (max_retries,sandbox_client_max_workers/connections), per-turn logging, configurable rollout timeout viaget_timeout_seconds, and robust cleanup/teardownHarborEnv: derive docker image/CPU/memory/disk fromtask.tomlwhen not explicitly set, support per-task timeouts, and accept threaded client in setup hooksenvironments.md,environments/AGENTS.md): expandCliAgentEnvoptions (labels, retry/pooling viaSandboxMixin), and update experimental envs listWritten by Cursor Bugbot for commit a0e709d. This will update automatically on new commits. Configure here.