Cohub
中文Start a Space

Run Codex in a Cohub Space via Local Runtime or cloud CLI

If your task needs Codex to run shell commands, connect a trusted project host through Cohub Local Runtime and keep Codex’s sandbox enabled. Installing the CLI in a cloud Space puts it next to the cloud files, but even a working login won’t help if the host cannot start the inner sandbox.

An orange folder rests on a white page opposite a matching recess cut into charcoal board.
Who
For developers deciding which machine should run Codex commands for a shared project.
When
You want to use your Codex login from a Space, or the cloud CLI starts but its shell tools do not.
Why
The host determines which files Codex works on and whether it can isolate a command.
The local Runtime uses Codex installed and signed in on its host. In the tested cloud Space, a zero user namespace limit stopped the CLI’s inner sandbox. Move the task to a host that supports it.
Two places to run Codex. The cloud result comes from one Space tested in November 2026.

Choosing where to run Codex in a Cohub Space comes down to two facts: which machine holds the files, and whether that host can start Codex’s own Linux command sandbox. If Codex needs to run shell commands on a project folder, connect a trusted host through Cohub Local Runtime; if you install the CLI inside a cloud Space, check host namespace support before supplying credentials.

Local Runtime vs cloud CLI: what changes for you

Dimension Local Runtime (--harness codex) Codex CLI in a cloud Space
Target files A local project directory on the connected host Cloud project files under /workspace
Chat harness picker Select Codex directly in the Space chat Does not add Codex to the cloud chat harness picker
Session model Space messages execute on your machine while connected Standalone CLI inside the Space Linux environment, not an OpenAI-hosted Codex cloud session
Command isolation Uses the connected host’s normal Codex sandbox In the tested cloud Space, max_user_namespaces was 0, blocking bwrap

A harness is the program that executes a Space chat turn. With Local Runtime, the Space forwards turns to the connected machine, so that host must stay online while you work.

Attach a trusted host with Local Runtime

Prepare a trusted machine with the Cohub CLI, Node.js 24 or later, and an authenticated Codex CLI on PATH, pointed at a folder you are comfortable sharing with Space collaborators. Cohub login and Codex login stay completely separate; ai agent cli covers installing and signing in to the Cohub CLI. Start the Runtime from your project directory:

cohub auth login
cd ~/projects/my-project
codex --version
codex login status
cohub runtime up --harness codex

Keep that terminal running, verify the link from another terminal with cohub runtime status, and pick Codex in the Space chat. For an initial code review pass, pick Read only where offered (documented for Codex app-server 0.162.1 and newer). Before allowing edits, configure the host for workspace-scoped writes and approvals. If an explicitly requested harness fails startup checks, Runtime refuses to fall back silently to a different executor. These steps follow official documentation; we did not execute an authenticated local chat turn for this page.

Separate interactive login from unattended API keys

Interactive host sessions: Run codex login on the project machine to sign in with an eligible ChatGPT account (using your plan’s Codex access), or supply an OpenAI API key billed separately to your API account. Signing in to Cohub handles neither step. For headless machines without a browser, OpenAI documents device-code sign-in where the account or workspace allows it; that flow was not tested here.

Non-interactive runs: codex exec normally expects a Git repository. OpenAI documents setting CODEX_API_KEY for a headless invocation—scope that variable strictly to the single command on a trusted runner. Space environment variables are readable by other processes in the sandbox, so keep personal keys out of shared Spaces and never copy login files into the project folder. Confirm the host can execute the task before handing it any secret.

What blocked shell commands in the tested cloud sandbox

Recorded on November 17, 2026: Inside one Cohub cloud sandbox, Codex CLI 0.169.0 answered --version, and a placeholder key reached OpenAI and returned HTTP 401. In a separate check, when Codex attempted to launch its Linux command sandbox, bwrap failed with Creating new namespace failed (ENOSPC) while the host reported max_user_namespaces equal to 0. Receiving 401 only confirmed outbound reachability to OpenAI—it proved neither valid authentication nor working command execution.

Check these three facts on Linux without sending prompts or exposing keys:

codex --version
codex login status
cat /proc/sys/user/max_user_namespaces

Checked again on November 18, 2026: Inside our worker sandbox, the same 0.169.0 binary started cleanly, a clean profile reported Not logged in, and max_user_namespaces still read 0. We did not re-run the inner sandbox or any model turn, and a nonzero number on a different host does not by itself guarantee compatibility.

Swapping accounts or API keys cannot bypass a zero user-namespace limit. Move shell-executing Codex work to a Local Runtime host that supports Codex’s normal sandbox, or—when code must stay in the cloud—ask your administrator for a supported environment that preserves both isolation layers.

Evaluating Claude Code for cloud-only headless runs

If your cloud workflow only needs a headless CLI against /workspace and does not depend on Codex-specific behavior, Claude Code is worth testing. In the cloud setup walkthrough, Claude Code 2.1.326 installed, started in print mode reporting a missing login, and returned Invalid API key with a placeholder Anthropic key. That check stopped at authentication; it did not test authenticated file edits, tool permissions, or equivalent isolation. Validate your required commands and permissions inside a disposable project first.

Reference in the docs

This page: Whether to connect your project host, use an administrator-provided environment, or evaluate Claude Code for a cloud-only task.

  • Files & Sandbox: where a cloud process finds the project's files
  • CLI: how the Cohub CLI connects to a Space

Sources

Published · Updated