cloudflare / cloudflare/sandbox-sdk
Bridge: let long, quiet exec commands run past the 5-minute stream idle timeout
- Dominant language
- TypeScript
- Stars
- 1.1k
- Forks
- 114
- Avg merge
- 22h 42m
- Merged PRs (30d)
- 14
Description
### Problem
Through the Sandbox Bridge (`POST /v1/sandbox/:id/exec`), a command that prints nothing for five minutes is cut off, even when the request sets a longer `timeout_ms`. The cut comes from the SDK transport's `DEFAULT_STREAM_IDLE_TIMEOUT_MS` (300000) in `@cloudflare/sandbox` 0.12.9. The bridge exposes no env var or request field to change it (only `SANDBOX_INSTANCE_TIMEOUT_MS` and `SANDBOX_PORT_TIMEOUT_MS` exist).
Quiet long jobs are common for agents: video renders, builds, model downloads and data processing. Today every caller must wrap them in a heartbeat, for example `job & while kill -0 $!; do echo .; sleep 60; done`.
### Request
Either of these would help:
1. Let the bridge set the stream idle timeout, for example through a `SANDBOX_STREAM_IDLE_TIMEOUT_MS` env var or `bridge({ streamIdleTimeoutMs })`.
2. Have exec send periodic keepalive frames while the process is still running, so an explicit `timeout_ms` is the only limit.
### Versions
`@cloudflare/sandbox` 0.12.9 (bridge), Workers with Containers. The caller is `@mastra/cloudflare-sandbox`.
Contributor guide
Assessment
This issue has not been assessed yet.