An installable Codex skill that runs local training, backtesting, build, or other long-running jobs and returns to the original Codex desktop task when the process completes, fails, or times out. An ordinary Python process waits for the job, so no model polling is involved. The callback itself starts a normal Codex model turn.
Experimental community project; not an OpenAI product. It currently targets Linux/Unix and requires a compatible Codex App Server running on the same host. Version 0.154.0 has been validated. Native Windows is not supported.
The complete runtime is bundled under skills/codex-callback/scripts/runtime/.
It requires only Python 3.11+ and the standard library—no pip installation,
virtual environment, Conda environment, or OpenAI API key is needed.
After cloning or downloading this repository, copy the entire skill directory into your Codex skills directory:
mkdir -p "${CODEX_HOME:-$HOME/.codex}/skills"
test ! -e "${CODEX_HOME:-$HOME/.codex}/skills/codex-callback" && \
cp -R skills/codex-callback "${CODEX_HOME:-$HOME/.codex}/skills/codex-callback"If the destination already exists, review the installed copy before updating it. Start a new Codex task after installation so Codex can discover the skill.
In the Codex task where you want to run a long job, provide the command and the follow-up work to perform after completion. For example:
Use
$codex-callbackto run this training job. Analyze the validation metrics when it succeeds. If it fails, inspect the log and explain the cause without restarting the training.
The skill binds the callback to the current task's CODEX_THREAD_ID, launches a
detached supervisor, and ends the current reply. When the job finishes, the
follow-up message returns to the same task. Status, stdout/stderr, and delivery
receipts are stored by default under:
~/.local/state/codex-callback/runs/
Use XDG_STATE_HOME or CODEX_CALLBACK_RUNS to change this location. Run records
may contain commands, task IDs, local paths, and logs. Do not commit them to a
public repository or attach them unredacted to bug reports.
Check the current task and local daemon connection without sending a message or starting a model turn:
python3 skills/codex-callback/scripts/runtime/check_connection.pyThe live test starts a ten-second process and sends a real callback to the current Codex task. Run it only in a disposable or otherwise authorized task. It starts a normal model turn and uses normal Codex allowance:
python3 skills/codex-callback/scripts/runtime/live_test.pyThe callback checks for CODEX_CALLBACK_LIVE_TEST_OK, reports the result once,
and explicitly stops without rerunning the job or creating another callback.
Generated run records contain task IDs and local paths; do not publish them.
See validation status and expected results for the delivered package's verification scope and acceptance checklist.
Run Python from the runtime directory, or add that directory to PYTHONPATH for
the current command:
from codex_callback import start_job
directory = start_job(
["/path/to/python", "train.py"],
cwd="/path/to/project",
followup=(
"Analyze the metrics on success. Inspect the log on failure; "
"do not restart the job automatically."
),
timeout_seconds=24 * 3600,
)
print(directory)Commands are passed as argument lists and are not interpreted by a shell. Do not put passwords, tokens, or other secrets in command-line arguments or follow-up text.
The tests use temporary Unix sockets and short local processes. They do not send callbacks to a real Codex task:
(
cd skills/codex-callback/scripts/runtime
PYTHONPATH="$PWD" python3 -S -m unittest discover -s ../../../../tests -v
)- The skill connects only to an existing local Codex daemon. It does not start a service, create a task, or override the original task's model or permissions.
- The App Server queue methods are experimental. Re-run the connection check and a short callback test after upgrading Codex.
- A host reboot, forced supervisor termination, host-wide OOM, or daemon protocol change can prevent callback delivery.
- Delivery is not guaranteed to be exactly once under every failure mode. When the outcome is ambiguous, automatic resubmission stops to avoid duplicate turns.
skills/codex-callback/SKILL.md Skill instructions
skills/codex-callback/scripts/runtime/ Single runtime implementation
tests/ Automated tests
docs/VALIDATION.md Sanitized validation evidence
The project has no third-party runtime dependencies and requires neither a
pyproject.toml file nor a build step. The tests/ directory is only for
development and compatibility validation; it does not need to be installed.