A session's sandbox is made when its first turn runs, not at connect or folder pick.
The folder step restarts the Homebrew gateway on a Mac and checks the config in use.
The preparing line names the real sandbox.
Review of OPE-205/OPE-206 found three gaps:
- The client reconnects with backoff on ANY socket close, so a session refused for a
missing image would be retried every few seconds, adding an error notice each time
and showing the "reconnecting" strip forever. The server now closes a refused session
with code 4403; the client treats that as final (no reconnect, no strip) and the
error notice in the transcript says why.
- The image check only knew Docker, while docs promise Docker or Podman. It now maps the
gateway's driver to its own tool (`docker`/`podman image inspect`, `... pull`), and
the refusal and the setup hint name that tool.
- A local image store says nothing about a remote gateway's images: when the active
gateway is remote, the check answers "cannot tell" and never refuses.
Connecting a session's socket built its engine on the event loop. With OpenShell that
build creates a container, starts the runner and verifies the mounts: seconds normally,
minutes on first use. While it ran the server answered nothing, the GUI's health checks
failed, and the app fell back to its startup screen ("Starting OpenWorker...") instead of
showing the session. A build that raised (a refused sandbox, a timeout) died in the ASGI
stack and the socket just dropped.
Now the socket handler asks `pending_sandbox_build()` (config only, no preflight) whether
this connect will build a sandbox, sends `sandbox_preparing` if so, runs `get_engine` on
a worker thread, then sends `sandbox_ready` with the workspace's description, or an
`error` event with the reason and a clean close. Engine builds are serialized per session
with a lock, since two connects could now build concurrently and with OpenShell each
build is a container.
The GUI renders the two events: a waiting row "Preparing the openshell sandbox for this
session..." until `ready`, and one quiet transcript line naming the wall once it is up.
A refusal lands in the session view as the usual error notice.