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
-
Let the agent manage Hugging Face repos when HF_TOKEN is set
Installs the official hf CLI (in a venv, since Debian's Python is externally-managed) and, at boot, drops agents/hf-spaces.md in as opencode's global AGENTS.md — the config-dir path applies to every session regardless of which directory is open, so the guidance does not depend on a workspace file that an ephemeral container would lose. With no HF_TOKEN present the file is removed instead, so the instructions never advertise access the container does not have. The doc leads with "never print the token" because session transcripts are shareable, and it draws the line at creating repos: deleting, renaming or changing visibility needs the user's confirmation first. Image grows ~134MB for python3 plus the CLI. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>e1f9a64 -
Bump actions/checkout to v5
v4 is pinned to Node 20, which runners now force onto Node 24 with a deprecation warning on every run. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1933995 -
Sync the HF Space from CI on every push to main
Builds the image on a runner, boots it, and asserts the three things that matter — it exits nonzero without OPENCODE_SERVER_PASSWORD, answers /api/health with basic auth, and serves the web UI on / — before pushing anything. A Dockerfile that only breaks on the Space would otherwise leave it parked in BUILD_ERROR with no signal here. The push is forced because GitHub is the source of truth; a hand-edit in the Space's web UI should not be able to block a deploy. The HF username is derived from the token via whoami rather than stored, which also turns a bad token into a clear error instead of an opaque git failure. Finally the job polls the Space until it reports RUNNING so a red check means a broken deploy, not just a failed push. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>e85a4d4
-
Add deployable opencode server image for HF Spaces and Railway
One Dockerfile serving both hosts. entrypoint.sh resolves the port at runtime ($PORT on Railway, 7860 to match app_port on HF Spaces), detects a writable /data mount and points the XDG dirs and workspace at it so sessions, provider logins and code survive restarts, and refuses to start without OPENCODE_SERVER_PASSWORD — every route on this server allows shell execution, so basic auth is not optional on a public URL. opencode is installed at build time rather than on first boot, since a free Space's filesystem is ephemeral and would otherwise re-download the release on every cold start. The installer hardcodes $HOME/.opencode/bin and ignores OPENCODE_INSTALL_DIR, so the binary is moved onto the shared PATH afterwards. The node images already ship a uid-1000 user, which is what HF Spaces requires, so `node` is reused instead of adding a colliding one. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>5bd2d41