hzhang d075fc408a feat(codex): SessionMutator stub + session-file resolver
Wires the host's mirror hook end-to-end: FindCodexSessionFile walks
~/.codex/sessions/<YYYY>/<MM>/<DD>/rollout-*-<thread_id>.jsonl to
prove the path for the captured thread_id, then logs the no-op.

Real rewrite is deferred to v2: codex keys tool calls by `call_<id>`
not the `toolu_<id>` Plexum's canonical block format uses, so a v1
rewriter would never find a matching id. When tool-call id round-trip
through codex's native surface lands, the rewriter plugs into this
file's path resolver.

Also rescues cmd/plexum-openai-provider-plugin/main.go from .gitignore
(the bare 'plexum-openai-provider-plugin' pattern was too greedy — it
matched the source directory). Tightened to '/plexum-openai-provider-plugin'
+ '/bin/' so only built binaries get ignored.
2026-06-01 14:01:15 +01:00

Plexum-openai-provider

Plexum ProviderPlugin that wraps the local codex CLI binary (OpenAI Codex CLI ≥ 0.135). Same CLI-driven pattern as Plexum-gemini-provider and Plexum-anthropic-provider's contractor mode.

Status

v0.1: subprocess-per-turn, JSONL stream parsing, per-workspace session continuity via codex exec resume <thread_id>. Single model codex advertised by default; operator can override.

Auth

No API key in this plugin's config. The codex CLI handles auth via ~/.codex/ (ChatGPT login OR OPENAI_API_KEY). Run codex login once (or set env) and this plugin just shells out.

Install

cd ~/Plexum-openai-provider
./scripts/install.sh

Operator notes in ~/.plexum/plugins/plexum-openai-provider/config.json:

{
  "binary": "/home/<you>/.local/bin/codex",
  "extra_args": []
}

(absolute path is required when the daemon runs under systemd — systemd doesn't inherit shell PATH).

Then .plugins.allow += ["plexum-openai-provider"] and:

plexum agent-add --model codex my-agent
systemctl --user restart plexum
plexum say --agent-id my-agent --session-id $(plexum new-session --agent-id my-agent) "hello"

How it works

Per Plexum turn:

codex exec [resume <thread_id>] \
  --skip-git-repo-check \
  --dangerously-bypass-approvals-and-sandbox \
  --json \
  [--model <m>] \
  "<last user message>"

cwd = <agent workspace>, stdin = /dev/null (codex would otherwise hang waiting for additional input). Codex emits JSONL:

{"type":"thread.started","thread_id":"..."}
{"type":"turn.started"}
{"type":"item.completed","item":{"id":"...","type":"agent_message","text":"..."}}
{"type":"turn.completed","usage":{"input_tokens":...,...}}

thread.started.thread_id is captured into <workspace>/.plexum-codex-session so the next turn passes exec resume <id> instead of exec. item.completed of type agent_message becomes text_delta; turn.completed.usage populates the canonical Usage on message_end.

ChatGPT account vs API key

ChatGPT-account installs only support the default model; explicit --model gpt-5-codex etc. returns 400 invalid_request_error. With an API key install, operator can declare more model ids via config.supported_models + config.model_args.

License

Same as Plexum.

Description
Plexum ProviderPlugin wrapping the codex CLI binary (OpenAI Codex CLI)
Readme 54 KiB
Languages
Go 93%
Shell 7%