Repository navigation
Conversation
added 2 commits
November 6, 2026 23:32
…resh, refresh_lock exec::Exec::run copies the login into a fresh 0700 CODEX_HOME, runs `codex exec --json` with the prompt on stdin and the images attached, copies refreshed tokens back (serialised in-process), and removes the run dir when the Run is dropped. exec::failure reads why a run failed (a dead ChatGPT login, a 401, the turn's error); image_prompt and Run::generated_images serve image generation. auth::may_refresh says when a run may refresh the single-use refresh token, and refresh_lock lets such a run go alone.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Moves the Codex CLI runner out of a downstream image-generation tool into codexwire (macalinao/tala-agent#889), so callers keep only their own glue.
exec::Exec::run:codex exec --jsonin a fresh 0700 run dir (home/= the run's CODEX_HOME with only a copy ofauth.json,work/,refs/for--imageinputs); prompt on stdin; timeout with a bounded wait for the pipes after a kill; the parent's allowlisted env (client::child_env) plus the caller's,HOME/CODEX_HOME/TMPDIRforced to the run's. Refreshed tokens are copied back (auth::copy_back's rule, serialised in-process). TheRunremoves its dir on drop orremove().await.exec::failure: why a run failed, from its--jsonevents and log:LoginDead(spent/revoked refresh token),LoginRefused(401),Said(the turn's failure or last error, retry notices skipped).exec::image_prompt,Run::generated_images: for image generation (<CODEX_HOME>/generated_images/, regular files only, oldest first, size-capped).auth::may_refresh(access token within 10 min of expiry, or last refresh a week old, or unreadable) andauth::refresh_lock: runs that may spend the single-use refresh token go alone.New deps: base64, chrono (no default features), tokio
time.Tests: unit tests for may_refresh, failure, image_prompt, argv/env, file collection;
tests/exec.rsruns a fakecodex(sh) for the private home, image in/out, copy-back, failure, timeout and missing login. Locally: clippy -D warnings, cargo test --all-targets --locked (lib 18, spawn 2, exec 4, corpus 1, doctest 1), docs -D warnings, check-codegen, fmt.