Spaces:
Sleeping
Sleeping
Commit History
-
Keep the server alive across a restart, and persist its state
The hook was launching the server and losing it: the log file appeared, empty, and nothing listened. It runs under /bin/sh by default, where the detach does not hold and the process goes when the hook returns — a codespace that looks healthy and serves nothing. Running it through bash -c fixes it, which is why that wrapper is there rather than for quoting. Verified across a full stop/start cycle: the hook fires again on resume, opencode is serving within seconds, and from outside the codespace an anonymous request is still refused while a request carrying the user's GitHub token and the basic auth password returns a healthy 200. Also creates the state root. entrypoint.sh only uses it when it already exists and is writable, and nothing else made it, so every boot reported "persistence: NONE" and would have dropped sessions and provider logins at the next idle stop — the one thing a stopped codespace is otherwise supposed to keep. Drops the diagnostics that found this; the log the ent…a38523f -
Instrument the start hook to find where the server is lost
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>caf011b -
Load Codespaces secrets before starting the server
A codespace came up serving nothing. The image was fine and the hook did run, but the log was empty and OPENCODE_SERVER_PASSWORD was absent from the environment. Codespaces secrets are not passed to postStartCommand. They are written to /workspaces/.codespaces/shared/user-secrets-envs.json and applied to interactive shells, so a server started by a lifecycle hook sees none of them — and entrypoint.sh then refuses to run, exactly as it should, leaving a public port with nothing behind it. start-opencode.sh reads that file first, without overriding anything devcontainer.json set explicitly, and says so plainly when the password is still missing rather than failing silently. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>edf5b8c -
Make a codespace built from this image debuggable
The image has no SSH server, so gh codespace ssh and gh codespace logs both refuse. A codespace whose server fails to start is then a black box: the log the entrypoint writes cannot be read by any means the CLI offers. The sshd feature costs nothing at runtime and is what makes a failure diagnosable. Also detaches the server with setsid. postStartCommand's shell exits as soon as it returns, and a plain background job is not guaranteed to outlive it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>63ac17f -
Run as a GitHub Codespace
A third home for the same image, alongside Hugging Face Spaces and Railway, and the only one that needs no account the user does not already have. A dev container starts with its entrypoint overridden, so the image's ENTRYPOINT never runs and the server has to be started explicitly. That happens in postStartCommand rather than postCreateCommand because codespaces stop after 30 minutes idle: only postStartCommand runs again on resume, which is what makes this behave like a server instead of a dev box to be restarted by hand. The port is declared public in portsAttributes because there is no REST endpoint for port visibility — a client that provisions codespaces cannot otherwise expose anything without a human toggling it in the UI. Public is only safe here because entrypoint.sh refuses to start without OPENCODE_SERVER_PASSWORD; every route on this server runs shell commands, so a missing password has to fail loudly rather than publish an open shell. State goes under /workspaces rathe…930c3ef