Issue Overview When the sandbox settings are configured to run for 30 minutes, the server shuts down the agent process inside the sandbox right before the 5 minute mark. As a result, the sandbox continues running until the full 30 minutes elapse, but there is no active agent inside it after the agent is stopped.
Technical Details
- The sandbox is created with a maximum runtime setting (e.g., 30 minutes).
- The agent process inside the sandbox is started and is expected to operate for the duration of the sandbox or until its tasks are completed.
- However, the agent is being terminated by the server specifically just before the 5 minute mark, regardless of the sandbox's timeout.
- After the agent is shut down, the sandbox container/process remains alive and continues to consume resources until the original timeout expires.
Impact
- Wasted compute resources: The sandbox continues to run without an agent, leading to unnecessary resource consumption.
- User confusion: Users expect the agent to be available for the entire sandbox period, but it shuts down prematurely.
- Potential cost increase: If running on paid infrastructure, this may result in higher costs due to idle sandbox time.
Expected Behavior
- The agent should run and remain available inside the sandbox for the entire duration specified by the sandbox timeout, unless manually stopped or its tasks are completed.
- If the agent must be shut down early, the sandbox should also be terminated to free up resources immediately.
Steps to Reproduce
- Set sandbox timeout to 30 minutes.
- Start an agent inside the sandbox.
- Observe that the agent is shut down by the server just before the 5 minute mark, but the sandbox continues running.
- Check logs or monitoring tools to confirm agent shutdown and sandbox persistence.
Additional Notes
- Please investigate why the server is terminating the agent just before 5 minutes and whether the sandbox lifecycle management can be improved to avoid unnecessary resource usage.
Activity
2Hey @ctate Thank you for your follow up! I appreciate your work, and if you tell me the rough roadmap you have in mind, I would gladly split some of the work with you.
I want to keep working on this project, but want to make sure our paths are not too divergent as to make it impossible to reconcile after a few cycles.
If you want we can use the GitHub Projects to coordinate. Let me know what works best for you.
Thank you,
Hey @shahabmohi - just added several improvements to timeout handling
Please check out
Maximum DurationandKeep Alive Settingtask options here: https://github.com/vercel-labs/coding-agent-template/blob/main/README.md#task-configurationTLDR - agents should no longer have their own timeout