Files
roboco/docker/agent-codex.Dockerfile
6374bbbed0 feat(kimi): Kimi K3 provider on the official kimi-code CLI (#713)
* feat(kimi): Kimi K3 provider on the official kimi-code CLI (Wave 1)

ModelProvider.KIMI routes through KimiCliProvider driving Moonshot's kimi
CLI on a Kimi subscription (OAuth device-code, no metered key). One-shot
delivery roles only (V1), interactive ban wired in both guard lists.

Auth: one shared RW auth mount; containers symlink credentials/ and
oauth/ (the CLI's cross-process refresh-lock dir) into a container-local
KIMI_CODE_HOME so every container and the host redeem the SAME rotating
refresh chain - live-verified that per-copy chains cross-invalidate after
the reuse-grace window. No orchestrator refresh daemon; an expires_at
preflight exits 78.

Config renderer mirrors the login-managed provider/model blocks
field-for-field (live-captured; the model value is the CLI-side name,
never the raw API id), plus per-role deny rules and the bash-guard as a
PreToolUse hook via a wrapper script (an env key on a hooks entry makes
the CLI silently drop ALL hooks - live-verified). Usage capture sums
wire.jsonl usage.record 4-bucket events; sniff classifies rate-limit/auth
from structured error text only, mapped to the shared 75/78 park
contract. Image installs the CLI latest-at-build (no version pin, by
policy) with the resolved version stamped as provenance, binary split to
/usr/local away from mutable state.

Migrations 090 (enum) + 091 (provider seed); catalog, pricing, routing
mode, and orchestrator park/usage wiring mirror the codex integration.

* feat(kimi): surface sweep + fleet-wide pin drop (Wave 2)

Compose x3 gain the agent-kimi-image service and the orchestrator's
read-write ~/.kimi-code mount + kimi-usage dir; .env.example documents
the Kimi block. Panel mirrors ModelProvider.KIMI and adds the kimi
routing mode (catalog filter, mode button, mix-picker group, badge) with
tests; provider routes gain the kimi remediation entry. CLAUDE.md and
docs/map document the runtime. Per the no-pins policy, agent-grok/
gemini/codex Dockerfiles drop their version pins for latest-at-build
with resolved-version provenance stamps (grok resolves 0.2.112 vs the
old 0.2.56 pin - verified by real builds of all four images).

---------

Co-authored-by: Renn F <rennf93@users.noreply.github.com>
2026-07-29 01:48:55 +02:00

53 lines
2.7 KiB
Docker

# Codex (OpenAI) Agent Image
# =============================================================================
# Runs OpenAI's Codex agent through the official `codex` CLI, authenticated by a
# ChatGPT subscription via a mounted ~/.codex/auth.json — the parity analogue of
# the Grok path's mounted ~/.grok (no metered API key). Reuses the base image's
# roboco venv + uv + the RoboCo MCP gateway servers. The entrypoint renders
# ~/.codex/config.toml (the gateway) + the execpolicy deny rules + the per-role
# sandbox flag from the mounted mcp-config.json (see
# roboco.llm.providers.codex_cli_config) and runs the CLI headless. One runtime
# image serves every one-shot delivery role — role behaviour comes from the
# mounted system prompt / manifest / mcp-config, exactly as on the grok path.
#
# V1 scope: no interactive intake/secretary variant of this image exists (unlike
# grok's agent-grok-prompter / agent-grok-secretary) — Codex is one-shot delivery
# roles only for now.
# =============================================================================
FROM roboco-agent-base
USER root
# Install the official codex CLI globally via npm. NO version pin (2026-07-28
# policy: latest-at-build, always adapt — fleet-wide across grok/gemini/codex/
# kimi). The npm route (not chatgpt.com/codex/install.sh, which the CDN denies
# to non-browser clients) has no postinstall network fetch: the native binary
# rides an optionalDependency (@openai/codex-linux-x64) served from the public
# npm registry. Global install symlinks `codex` onto PATH for the agent user;
# verify it runs so a broken install fails the build, not spawn; the resolved
# version is stamped to /etc/codex-cli-version for per-image provenance.
RUN npm install -g @openai/codex \
&& command -v codex \
&& codex --version | tee /etc/codex-cli-version
# Entrypoint: render ~/.codex/config.toml + execpolicy rules + the per-role
# sandbox flag, then run codex headless (overrides the base image's `claude`
# entrypoint). ~/.codex is already agent:agent-owned (installed above via
# `su agent`), so no chown needed here.
COPY docker/scripts/codex-cli-agent-entrypoint.sh /app/scripts/codex-cli-agent-entrypoint.sh
RUN chmod 0755 /app/scripts/codex-cli-agent-entrypoint.sh
USER agent
# codex installs to ~/.codex/bin (or ~/.local/bin, depending on the installer);
# put both ahead of the venv on PATH so the entrypoint finds `codex` (and still
# resolves `python` to /app/.venv/bin).
ENV PATH="/home/agent/.codex/bin:/home/agent/.local/bin:/app/.venv/bin:$PATH"
LABEL role="codex-cli-runtime"
LABEL description="Codex (OpenAI) agent runtime — Codex Build via the official codex CLI"
LABEL codex.cli.pinned="false"
ENTRYPOINT ["/app/scripts/codex-cli-agent-entrypoint.sh"]