Skip to content

feat: default prime runtime idle timeout to 1h#1949

Merged
mikasenghaas merged 7 commits into
mainfrom
feat/prime-idle-timeout
Jul 8, 2026
Merged

feat: default prime runtime idle timeout to 1h#1949
mikasenghaas merged 7 commits into
mainfrom
feat/prime-idle-timeout

Conversation

@mikasenghaas

@mikasenghaas mikasenghaas commented Jul 8, 2026

Copy link
Copy Markdown
Member

Summary

  • Add idle_timeout to PrimeConfig (seconds, default 3600 = 1h) and thread it through PrimeRuntime.start into CreateSandboxRequest.
  • Prime sandboxes now self-terminate after 1h of inactivity by default, so a leaked sandbox is reclaimed well before its 24h max lifetime (timeout_minutes) instead of costing a full day.
  • The config surface is in seconds to match how time is expressed everywhere else in v1 (TimeoutConfig, task timeouts); it's converted to prime's whole-minute API in start (ceil'd, floored to the SDK's 1-minute minimum).
  • Reject an idle_timeout above the 24h max sandbox lifetime at config time (via a shared MAX_LIFETIME_MINUTES constant), instead of letting it fail at sandbox creation when the derived minutes exceed timeout_minutes.
  • Set tools.runtime.idle_timeout = null to disable, or to any positive number of seconds up to 24h to tune it.

🤖 Generated with Claude Code


Note

Medium Risk
Changes default Prime sandbox lifecycle (idle self-delete after 1h), which can terminate long-idle evals unless tuned or disabled via idle_timeout = null.

Overview
Prime sandboxes now get a configurable idle timeout so leaked sandboxes are reclaimed after inactivity instead of running until the 24h max lifetime.

PrimeConfig gains idle_timeout in seconds (default 3600, None disables). A validator rejects values above the shared MAX_LIFETIME (24h) cap. PrimeRuntime.start maps seconds to Prime’s whole-minute API (idle_timeout_minutes, ceil with a 1-minute floor) and uses MAX_LIFETIME for timeout_minutes instead of an inline constant.

Reviewed by Cursor Bugbot for commit 7f7c169. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Default prime runtime idle timeout to 1 hour

  • Adds an idle_timeout field to PrimeConfig (default 3600s) that is passed to sandbox creation as idle_timeout_minutes, causing sandboxes to self-delete after 60 minutes of inactivity by default.
  • A model-level validator enforces that idle_timeout does not exceed the 24h MAX_LIFETIME constant; set idle_timeout=None to disable idle timeout entirely.
  • Risk: existing sandboxes that relied on no idle timeout will now be terminated after 1 hour of inactivity unless idle_timeout is explicitly set to None.

Macroscope summarized 7f7c169.

Add `idle_timeout_minutes` to PrimeConfig (default 60) and pass it through
to CreateSandboxRequest so a leaked sandbox self-terminates well before its
24h max lifetime. Set to None to disable.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Comment thread verifiers/v1/runtimes/prime.py Outdated
Comment thread verifiers/v1/runtimes/prime.py Outdated
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jul 8, 2026
@macroscopeapp

macroscopeapp Bot commented Jul 8, 2026

Copy link
Copy Markdown

Approvability

Verdict: Needs human review

This PR changes the default runtime behavior by enabling a 1-hour idle timeout for sandboxes where none existed before. While well-implemented and properly validated, the default behavior change affects all existing users and warrants human review to confirm the intended impact on sandbox lifecycle.

You can customize Macroscope's approvability policy. Learn more.

Rename idle_timeout_minutes -> idle_timeout and take seconds (the unit used
for time elsewhere in v1), converting to whole minutes for prime's SDK.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 71a69c0. Configure here.

Comment thread verifiers/v1/runtimes/prime.py
Comment thread verifiers/v1/runtimes/prime.py Outdated
Comment thread verifiers/v1/runtimes/prime.py
mikasenghaas and others added 5 commits July 7, 2026 19:56
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
A tools.runtime.idle_timeout above 24h (seconds) would convert to
idle_timeout_minutes > timeout_minutes, which prime's API rejects at
sandbox creation. Validate it at config time against a shared
MAX_LIFETIME_MINUTES constant instead.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Rename MAX_LIFETIME_MINUTES -> MAX_LIFETIME and express it in seconds to
match the seconds-based config surface; convert to minutes at prime's API.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@mikasenghaas mikasenghaas requested a review from hallerite July 8, 2026 03:01
@mikasenghaas mikasenghaas merged commit 934bc4a into main Jul 8, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants