bug(examples): make Codex app-server setup runnable and image-safe

未关闭
#5,875 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
32/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
docker, shell

调研方向

Start in examples/codex-app-server: read the image Dockerfile, the codex.yaml provider profile, the start-codex-app-server entry point, and the README commands. Build the image, import the profile, and create a sandbox against a local Docker gateway; the acceptance criteria act as the checklist. Done means a clean build leaves no .codex/installation_id or .codex/.tmp/plugins, each sandbox makes its own runtime ID, the profile authorizes only the Codex WebSocket path, and the sandbox reaches /readyz and completes a model request.

由索引模型根据 Issue 内容生成。

描述

state:triage-needed

User Story

I use a local, Docker-backed OpenShell gateway to run the Codex app server from examples/codex-app-server. I followed the example and directly encountered startup, credential-routing, and network-policy failures. I need the example to produce a working sandbox without embedding shared identity or plugin state in the image.

Problem Statement

The Codex app-server example does not complete a clean setup with current Codex behavior:

  1. Codex must initialize its SQLite schemas before the runtime Landlock boundary applies. Without that initialization, the app server does not become ready.
  2. Starting codex app-server during the image build with default features creates /sandbox/.codex/installation_id and synchronizes plugins under .codex/.tmp/plugins. Every derived sandbox then inherits one installation identity, and the transient plugin data materially increases the image.
  3. The example declares CODEX_AUTH_ACCOUNT_ID as a provider credential. OpenShell injects provider credentials as opaque handles, but Codex needs the actual, non-secret account ID for account routing.
  4. The provider profile does not authorize the WebSocket endpoint at chatgpt.com/backend-api/codex/responses, so model traffic cannot complete.

A five-second default app-server bootstrap left about 80 MiB under /sandbox/.codex in the tested image. Disabling plugins and removing build-only artifacts reduced that state to about 1.3 MiB.

Impact / Why This Matters

Following the example does not yield a usable Codex remote session. A straightforward bootstrap workaround also creates two packaging problems: cloned sandboxes share a Codex installation identity, and each image carries a large plugin cache that Codex can recreate at runtime.

Users should not need to weaken sandbox policy, expose refresh material, or accept process-wide state baked into the image to run the example.

Acceptance Criteria

  • A clean build and setup starts the Codex app server and reaches the OpenShell service readiness endpoint.
  • A host Codex client can connect through the exposed WebSocket URL and complete a model request.
  • The image initializes the SQLite state required before Landlock applies.
  • The image contains no .codex/installation_id and no synchronized plugin cache.
  • Each sandbox generates its own installation ID at runtime.
  • The non-secret account ID reaches Codex as its actual value, while access and refresh tokens retain the documented OpenShell credential boundaries.
  • The provider profile authorizes only the WebSocket path required for Codex responses.
  • The documented commands match the verified workflow.

Reproduction Steps

  1. Start a local Docker-backed OpenShell gateway.
  2. From examples/codex-app-server, build the image and import codex.yaml.
  3. Create the Codex provider from an existing host login and configure gateway-owned refresh.
  4. Create the sandbox with the example command and connect a host Codex client to the exposed URL.
  5. Observe that first-run database initialization and the provider/account/network configuration prevent a working model request.
  6. As a bootstrap workaround, run codex app-server for five seconds during the image build.
  7. Inspect /sandbox/.codex in the resulting image. It contains a shared installation_id and synchronized plugin data under .tmp/plugins.

Environment

  • OpenShell: 0.1.9
  • Codex CLI in the image: 0.171.0
  • Image base: Ubuntu 24.04
  • Gateway runtime: local Docker
  • Host: macOS
  • Repository base commit: 438e07b23

Suggested UX

Keep the documented provider boundary explicit:

openshell provider create \
  --name codex \
  --type codex \
  --credential CODEX_AUTH_ACCESS_TOKEN

env "CODEX_AUTH_ACCOUNT_ID=..." \
  openshell sandbox create \
    --name codex-app-server \
    --from openshell/codex-app-server:local \
    --provider codex \
    --env-from CODEX_AUTH_ACCOUNT_ID \
    --expose 4500 \
    --detach \
    -- start-codex-app-server

The image build may initialize required database schemas, but build-only identity and plugin synchronization artifacts must not remain in the final image.

Verification Notes

The corrected local image was rebuilt without cache. It contained neither installation_id nor .codex/.tmp, used about 1.3 MiB for initialized Codex state, and produced a fresh runtime installation ID. A newly created OpenShell sandbox reached /readyz with HTTP 200.

主要语言
Rust
星标
21.5k
派生
2.1k
PR 合并指标
30 天内没有已合并 PR

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

NVIDIA/OpenShell 的其他 Issue

查看 NVIDIA/OpenShell 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。