Skip to main content

Module exec

Module exec 

Source
Expand description

One-shot codex exec runs on a ChatGPT login, each in a fresh private CODEX_HOME.

Exec::run makes <tmp_root>/<run>/ (0700) with home/ (the run’s CODEX_HOME, holding only a copy of the real auth.json), work/ (its working directory) and refs/ (the input images), runs codex exec there with the prompt on stdin and --json events on stdout, and copies the login back when Codex refreshed it (crate::auth::copy_back’s rule). A run that may_refresh the login goes alone (crate::auth::refresh_lock). The Run it returns holds the run’s directory, removed when it is dropped (or Run::remove).

failure reads why a run failed from its events and log; image_prompt and Run::generated_images are for image generation (Codex’s image tool writes to <CODEX_HOME>/generated_images/).

Unix only.

Structs§

Exec
How to run codex exec.
Input
What a run is given.
Run
A finished (or timed out) run. Its directory goes when it is dropped.

Enums§

ExecError
Why a run didn’t start or didn’t finish setting up.
Failure
Why a run failed, from its --json events and its log.

Functions§

failure
Why a codex exec --json run failed, from its events (stdout) and its log (stderr) (pure): a dead login; else a 401; else the turn’s failure or the last error event (retry notices skipped), if any.
image_prompt
A prompt that has Codex make exactly count images from brief and do nothing else; aspect_ratio like 16:9; with_images when the run attaches reference images.