Modal sandbox fails to start after snapshot restoration
Prerequisites:
- Launch a session from a prebuilt environment.
- Have tunnel ports configured globally or for the environment/repository.
- Have a start hook that uses
.tunnels.env.
When launching a session from a prebuilt environment, the Modal sandbox is restored from a snapshot. The runtime removes the snapshot's stale .tunnels.env, but the replacement file may not become visible inside the restored sandbox.
The start hook then runs without the required tunnel configuration, fails, and prevents the sandbox from connecting to the control plane.
The runtime should retrieve the new tunnel URLs from the control plane and recreate .tunnels.env before running the start hook.
Reproduction case: https://gist.github.com/ffesseler/0e93c39161cf248900c0aa6e8f2f35eb
Fixed by #2409. When .tunnels.env is missing or incomplete after a snapshot restore, the sandbox runtime now fetches GET /sessions/:id/tunnel-urls and rewrites the file before the start hook runs. Please reopen if you still see this on a current runtime image.