background-agents icon indicating copy to clipboard operation
background-agents copied to clipboard

Modal sandbox fails to start after snapshot restoration

Open ffesseler opened this issue 4 months ago • 2 comments

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.

ffesseler avatar Jul 19 '26 19:07 ffesseler

Reproduction case: https://gist.github.com/ffesseler/0e93c39161cf248900c0aa6e8f2f35eb

ffesseler avatar Jul 19 '26 20:07 ffesseler

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.

open-inspect avatar Oct 31 '26 17:10 open-inspect