Skip to content

feat: extend the unbounded lifetime to container sandboxes - #2413

Merged
mikasenghaas merged 2 commits into
mainfrom
feat/prime-container-no-timeout
Aug 20, 2026
Merged

feat: extend the unbounded lifetime to container sandboxes#2413
mikasenghaas merged 2 commits into
mainfrom
feat/prime-container-no-timeout

Conversation

@mikasenghaas

@mikasenghaas mikasenghaas commented Aug 20, 2026

Copy link
Copy Markdown
Member

Summary

Follow-up to #2412, addressing review feedback that containers also support an unbounded lifetime.

  • Container sandboxes now also get timeout_minutes=-1 — with one platform constraint: a container that sets an idle timeout must carry a finite lifetime as a safety fallback (422: container idle_timeout_minutes requires a finite timeout_minutes as a safety fallback). Those get IDLE_FALLBACK_LIFETIME (30 days, effectively unbounded; raised above the idle timeout when one exceeds it); containers without an idle timeout get a true -1.
  • The container-only idle_timeout <= 24h validator and the 24h CONTAINER_LIFETIME are gone.
  • cap_remote_agent_timeout skips Prime configs entirely; Modal keeps the 24h cap.
  • run() polls start_background_job + get_background_job directly instead of passing a sentinel deadline to run_background_job, which requires a finite timeout. The rollout's stage timeouts bound it via cancellation.

Verification

Live against the API, through PrimeRuntime from this branch (each ran echo hello through the new run() poll, then deleted):

  • container + idle timeout: created with timeout_minutes=43200 (30d), exec exit 0
  • container without idle timeout: created with timeout_minutes=-1, exec exit 0
  • VM default: created with timeout_minutes=-1, exec exit 0

🤖 Generated with Claude Code

Note

Extend unbounded lifetime to container sandboxes

  • Replaces CONTAINER_LIFETIME with a 30-day IDLE_FALLBACK_LIFETIME constant in prime.py
  • PrimeRuntime.start requests timeout_minutes=-1 for containers when no idle timeout is set, otherwise requests a finite lifetime that is the greater of 30 days or idle timeout plus 1 minute
  • Removes the _validate_idle_timeout validator that previously rejected idle timeouts exceeding the fixed lifetime
  • cap_remote_agent_timeout in compile.py skips the 24-hour cap for all Prime containers, not just VMs
  • PrimeRuntime.run polls background jobs manually without a client-side deadline
  • Behavioral Change: Prime containers without an idle timeout now run indefinitely instead of terminating after 24 hours; idle timeouts greater than the old fixed lifetime are now accepted.

Macroscope summarized 4c99739.


Note

Medium Risk
Changes sandbox lifetime and job-wait behavior for Prime containers, so misconfigured idle timeouts or failed teardown can leave boxes running much longer. Not auth/security-critical, but it affects remote resource usage.

Overview
Prime container sandboxes can now live without a 24h hard cap, matching VMs. Creation uses timeout_minutes=-1 unless an idle timeout is set; the platform then requires a finite fallback, so those boxes get a 30-day IDLE_FALLBACK_LIFETIME (raised above the idle timeout if needed).

The container-only idle_timeout validator is gone. cap_remote_agent_timeout skips all Prime configs, not just VMs (Modal still caps at 24h).

PrimeRuntime.run polls start_background_job / get_background_job instead of the SDK helper that required a finite deadline; rollout stage timeouts still cancel the wait.

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

Containers support timeout_minutes=-1 too, but the platform requires a
finite lifetime as a safety fallback when a container sets an idle
timeout; give those a 30-day lifetime, effectively unbounded. The
agent-timeout cap now skips prime entirely.

run() polls start/get_background_job directly instead of passing a
sentinel deadline to run_background_job, which cannot wait forever.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Comment thread verifiers/v1/runtimes/prime.py Outdated
Comment thread verifiers/v1/utils/compile.py
An idle timeout past 30 days would otherwise exceed the fallback
lifetime and fail the SDK's idle <= lifetime validation.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@mikasenghaas
mikasenghaas marked this pull request as ready for review August 20, 2026 20:58
@macroscopeapp

macroscopeapp Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — This PR makes significant changes to sandbox lifecycle management: extending container lifetimes from 24 hours to potentially unbounded, removing a safety validator, and switching to manual infinite polling for background jobs. These runtime behavior changes warrant careful review.

You can add or adjust custom eligibility rules. Learn more.

@mikasenghaas
mikasenghaas merged commit 673dab2 into main Aug 20, 2026
13 checks passed
@mikasenghaas
mikasenghaas deleted the feat/prime-container-no-timeout branch August 20, 2026 21:08
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